From 21ae1f37bd7588a83258b184e422898ef71a0744 Mon Sep 17 00:00:00 2001 From: spzala Date: Thu, 3 Sep 2015 23:30:00 -0700 Subject: [PATCH] Enable Translator with new TOSCA library (6) Remove all TOSCA templates which are TOSCA parser specific.. Partially Implements: blueprint use-tosca-parser-library Change-Id: I19e267e839272b3bf9e9c86466e0ecbfbbee8f39 --- .../hot/tests/test_translate_outputs.py | 5 +- translator/tests/test_template.py | 5 +- .../tests/test_tosca_hot_translation.py | 7 +- .../data/datatypes/custom_datatype_def.yaml | 48 ---------- ..._custom_datatypes_in_current_template.yaml | 65 ------------- ...ustom_datatypes_nested_datatype_error.yaml | 25 ----- .../test_custom_datatypes_positive.yaml | 24 ----- .../test_custom_datatypes_value_error.yaml | 18 ---- .../test_get_attribute_host_keyword.yaml | 33 ------- .../test_get_attribute_host_not_found.yaml | 20 ---- ...get_attribute_illegal_host_in_outputs.yaml | 17 ---- ..._get_attribute_unknown_attribute_name.yaml | 28 ------ ..._attribute_unknown_node_template_name.yaml | 28 ------ .../test_invalid_function_signature.yaml | 34 ------- .../test_unknown_capability_property.yaml | 36 ------- .../test_unknown_input_in_interface.yaml | 20 ---- .../test_unknown_input_in_property.yaml | 13 --- .../data/test_invalid_template_version.yaml | 14 --- .../data/test_no_inputs_in_template.yaml | 15 --- .../data/test_no_outputs_in_template.yaml | 15 --- .../tests/data/test_requirements.yaml | 67 ------------- ...est_tosca_normative_type_by_shortname.yaml | 33 ------- .../data/test_tosca_top_level_error1.yaml | 31 ------ .../data/test_tosca_top_level_error2.yaml | 33 ------- .../data/topology_template/definitions.yaml | 44 --------- .../data/topology_template/subsystem.yaml | 85 ---------------- .../tests/data/topology_template/system.yaml | 46 --------- .../tosca_nodejs_mongodb_two_instances.yaml | 96 +++++++++++++++++++ 28 files changed, 103 insertions(+), 802 deletions(-) delete mode 100644 translator/toscalib/tests/data/datatypes/custom_datatype_def.yaml delete mode 100644 translator/toscalib/tests/data/datatypes/test_custom_datatypes_in_current_template.yaml delete mode 100644 translator/toscalib/tests/data/datatypes/test_custom_datatypes_nested_datatype_error.yaml delete mode 100644 translator/toscalib/tests/data/datatypes/test_custom_datatypes_positive.yaml delete mode 100644 translator/toscalib/tests/data/datatypes/test_custom_datatypes_value_error.yaml delete mode 100644 translator/toscalib/tests/data/functions/test_get_attribute_host_keyword.yaml delete mode 100644 translator/toscalib/tests/data/functions/test_get_attribute_host_not_found.yaml delete mode 100644 translator/toscalib/tests/data/functions/test_get_attribute_illegal_host_in_outputs.yaml delete mode 100644 translator/toscalib/tests/data/functions/test_get_attribute_unknown_attribute_name.yaml delete mode 100644 translator/toscalib/tests/data/functions/test_get_attribute_unknown_node_template_name.yaml delete mode 100644 translator/toscalib/tests/data/functions/test_invalid_function_signature.yaml delete mode 100644 translator/toscalib/tests/data/functions/test_unknown_capability_property.yaml delete mode 100644 translator/toscalib/tests/data/functions/test_unknown_input_in_interface.yaml delete mode 100644 translator/toscalib/tests/data/functions/test_unknown_input_in_property.yaml delete mode 100644 translator/toscalib/tests/data/test_invalid_template_version.yaml delete mode 100644 translator/toscalib/tests/data/test_no_inputs_in_template.yaml delete mode 100644 translator/toscalib/tests/data/test_no_outputs_in_template.yaml delete mode 100644 translator/toscalib/tests/data/test_requirements.yaml delete mode 100644 translator/toscalib/tests/data/test_tosca_normative_type_by_shortname.yaml delete mode 100644 translator/toscalib/tests/data/test_tosca_top_level_error1.yaml delete mode 100644 translator/toscalib/tests/data/test_tosca_top_level_error2.yaml delete mode 100644 translator/toscalib/tests/data/topology_template/definitions.yaml delete mode 100644 translator/toscalib/tests/data/topology_template/subsystem.yaml delete mode 100644 translator/toscalib/tests/data/topology_template/system.yaml create mode 100644 translator/toscalib/tests/data/tosca_nodejs_mongodb_two_instances.yaml diff --git a/translator/hot/tests/test_translate_outputs.py b/translator/hot/tests/test_translate_outputs.py index 625cf114..1ebf7ead 100644 --- a/translator/hot/tests/test_translate_outputs.py +++ b/translator/hot/tests/test_translate_outputs.py @@ -21,8 +21,9 @@ class ToscaTemplateOutputTest(TestCase): def test_translate_output(self): tosca_tpl = os.path.join( - os.path.dirname(os.path.abspath(toscaparser.__file__)), - "tests/data/", "tosca_nodejs_mongodb_two_instances.yaml") + os.path.dirname(os.path.abspath(__file__)), + "../../toscalib/tests/data/" + "tosca_nodejs_mongodb_two_instances.yaml") tosca = ToscaTemplate(tosca_tpl) translate = TOSCATranslator(tosca, []) hot_translation = translate.translate() diff --git a/translator/tests/test_template.py b/translator/tests/test_template.py index e68e70b2..7fa0c90e 100755 --- a/translator/tests/test_template.py +++ b/translator/tests/test_template.py @@ -11,7 +11,6 @@ # under the License. import os -import toscaparser from toscaparser.tosca_template import ToscaTemplate from translator.tests.base import TestCase @@ -23,8 +22,8 @@ class ToscaMongoNodejsTest(TestCase): '''TOSCA template with nodejs, app and mongodb on 2 servers.''' tosca_tpl = os.path.join( - os.path.dirname(os.path.abspath(toscaparser.__file__)), - "tests/data/", "tosca_nodejs_mongodb_two_instances.yaml") + os.path.dirname(os.path.abspath(__file__)), + "../toscalib/tests/data/tosca_nodejs_mongodb_two_instances.yaml") tosca = ToscaTemplate(tosca_tpl, parsed_params) def test_relationship_def(self): diff --git a/translator/tests/test_tosca_hot_translation.py b/translator/tests/test_tosca_hot_translation.py index 4a90b97a..2a47d49a 100644 --- a/translator/tests/test_tosca_hot_translation.py +++ b/translator/tests/test_tosca_hot_translation.py @@ -11,8 +11,6 @@ # under the License. import json -import os -import toscaparser from translator.common.utils import TranslationUtils from translator.tests.base import TestCase @@ -83,9 +81,8 @@ class ToscaHotTranslationTest(TestCase): json.dumps(diff, indent=4, separators=(', ', ': '))) def test_hot_translate_nodejs_mongodb_two_instances(self): - tosca_file = os.path.join( - os.path.dirname(os.path.abspath(toscaparser.__file__)), - "tests/data/", "tosca_nodejs_mongodb_two_instances.yaml") + tosca_file = \ + '../toscalib/tests/data/tosca_nodejs_mongodb_two_instances.yaml' hot_file = '../toscalib/tests/data/hot_output/' \ 'hot_nodejs_mongodb_two_instances.yaml' params = {'github_url': diff --git a/translator/toscalib/tests/data/datatypes/custom_datatype_def.yaml b/translator/toscalib/tests/data/datatypes/custom_datatype_def.yaml deleted file mode 100644 index 4b7da714..00000000 --- a/translator/toscalib/tests/data/datatypes/custom_datatype_def.yaml +++ /dev/null @@ -1,48 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0 - -description: > - Custom type and node definition used to test custom datatypes. - -node_types: - tosca.nodes.my.SomeNode: - derived_from: tosca.nodes.Root - properties: - people: - type: tosca.my.datatypes.People - -datatype_definitions: - tosca.my.datatypes.PeopleBase: - properties: - name: - type: string - required: true - constraints: - - min_length: 2 - gender: - type: string - default: unknown - - tosca.my.datatypes.People: - derived_from: tosca.my.datatypes.PeopleBase - properties: - addresses: - type: map - entry_schema: - type: string - contacts: - type: list - entry_schema: - type: tosca.my.datatypes.ContactInfo - - tosca.my.datatypes.ContactInfo: - description: simple contact information - properties: - contact_name: - type: string - required: true - constraints: - - min_length: 2 - contact_email: - type: string - contact_phone: - type: string diff --git a/translator/toscalib/tests/data/datatypes/test_custom_datatypes_in_current_template.yaml b/translator/toscalib/tests/data/datatypes/test_custom_datatypes_in_current_template.yaml deleted file mode 100644 index aefe862a..00000000 --- a/translator/toscalib/tests/data/datatypes/test_custom_datatypes_in_current_template.yaml +++ /dev/null @@ -1,65 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0 - -description: > - TOSCA templates used to test custom datatypes. - -node_types: - tosca.nodes.my.SomeNode: - derived_from: tosca.nodes.Root - properties: - people: - type: tosca.my.datatypes.People - -datatype_definitions: - tosca.my.datatypes.PeopleBase: - properties: - name: - type: string - required: true - constraints: - - min_length: 2 - gender: - type: string - default: unknown - - tosca.my.datatypes.People: - derived_from: tosca.my.datatypes.PeopleBase - properties: - addresses: - type: map - entry_schema: - type: string - contacts: - type: list - entry_schema: - type: tosca.my.datatypes.ContactInfo - - tosca.my.datatypes.ContactInfo: - description: simple contact information - properties: - contact_name: - type: string - required: true - constraints: - - min_length: 2 - contact_email: - type: string - contact_phone: - type: string - -topology_template: - node_templates: - positive: - type: tosca.nodes.my.SomeNode - properties: - people: - name: Mike - gender: male - addresses: {Home: 1 foo street, Office: 9 bar avenue} - contacts: - - {contact_name: Tom, - contact_email: tom@email.com, - contact_phone: '123456789'} - - {contact_name: Jerry, - contact_email: jerry@email.com, - contact_phone: '321654987'} \ No newline at end of file diff --git a/translator/toscalib/tests/data/datatypes/test_custom_datatypes_nested_datatype_error.yaml b/translator/toscalib/tests/data/datatypes/test_custom_datatypes_nested_datatype_error.yaml deleted file mode 100644 index b28f4995..00000000 --- a/translator/toscalib/tests/data/datatypes/test_custom_datatypes_nested_datatype_error.yaml +++ /dev/null @@ -1,25 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0 - -description: > - TOSCA templates used to test custom datatypes. - -imports: - - custom_datatype_def.yaml - -topology_template: - node_templates: - # 123456789 is not a string - error in nested datatype: - type: tosca.nodes.my.SomeNode - properties: - people: - name: Mike - gender: male - addresses: {Home: 1 foo street, Office: 9 bar avenue} - contacts: - - {contact_name: Tom, - contact_email: tom@email.com, - contact_phone: 123456789} - - {contact_name: Jerry, - contact_email: jerry@email.com, - contact_phone: '321654987'} diff --git a/translator/toscalib/tests/data/datatypes/test_custom_datatypes_positive.yaml b/translator/toscalib/tests/data/datatypes/test_custom_datatypes_positive.yaml deleted file mode 100644 index f1762f4c..00000000 --- a/translator/toscalib/tests/data/datatypes/test_custom_datatypes_positive.yaml +++ /dev/null @@ -1,24 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0 - -description: > - TOSCA templates used to test custom datatypes. - -imports: - - custom_datatype_def.yaml - -topology_template: - node_templates: - positive: - type: tosca.nodes.my.SomeNode - properties: - people: - name: Mike - gender: male - addresses: {Home: 1 foo street, Office: 9 bar avenue} - contacts: - - {contact_name: Tom, - contact_email: tom@email.com, - contact_phone: '123456789'} - - {contact_name: Jerry, - contact_email: jerry@email.com, - contact_phone: '321654987'} diff --git a/translator/toscalib/tests/data/datatypes/test_custom_datatypes_value_error.yaml b/translator/toscalib/tests/data/datatypes/test_custom_datatypes_value_error.yaml deleted file mode 100644 index 31cf681e..00000000 --- a/translator/toscalib/tests/data/datatypes/test_custom_datatypes_value_error.yaml +++ /dev/null @@ -1,18 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0 - -description: > - TOSCA templates used to test custom datatypes. - -imports: - - custom_datatype_def.yaml - -topology_template: - node_templates: - # addresses is not a map - error in field value: - type: tosca.nodes.my.SomeNode - properties: - people: - name: Mike - gender: male - addresses: [1 foo street, 9 bar avenue] diff --git a/translator/toscalib/tests/data/functions/test_get_attribute_host_keyword.yaml b/translator/toscalib/tests/data/functions/test_get_attribute_host_keyword.yaml deleted file mode 100644 index 90ffbe25..00000000 --- a/translator/toscalib/tests/data/functions/test_get_attribute_host_keyword.yaml +++ /dev/null @@ -1,33 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0 - -description: > - TOSCA template for testing get_attribute with HOST keyword. - -topology_template: - node_templates: - server: - type: tosca.nodes.Compute - capabilities: - host: - properties: - num_cpus: 2 - dbms: - type: tosca.nodes.DBMS - requirements: - - host: server - interfaces: - Standard: - configure: - implementation: configure.sh - inputs: - ip_address: { get_attribute: [ HOST, private_address ] } - database: - type: tosca.nodes.Database - requirements: - - host: dbms - interfaces: - Standard: - configure: - implementation: configure.sh - inputs: - ip_address: { get_attribute: [ HOST, private_address ] } diff --git a/translator/toscalib/tests/data/functions/test_get_attribute_host_not_found.yaml b/translator/toscalib/tests/data/functions/test_get_attribute_host_not_found.yaml deleted file mode 100644 index 69679ffe..00000000 --- a/translator/toscalib/tests/data/functions/test_get_attribute_host_not_found.yaml +++ /dev/null @@ -1,20 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0 - -description: > - TOSCA template for testing get_attribute with HOST keyword. - -topology_template: - node_templates: - server: - type: tosca.nodes.Compute - capabilities: - host: - properties: - num_cpus: 2 - interfaces: - Standard: - configure: - implementation: configure.sh - inputs: - ip_address: { get_attribute: [ HOST, private_address ] } - diff --git a/translator/toscalib/tests/data/functions/test_get_attribute_illegal_host_in_outputs.yaml b/translator/toscalib/tests/data/functions/test_get_attribute_illegal_host_in_outputs.yaml deleted file mode 100644 index 6c7d9bbc..00000000 --- a/translator/toscalib/tests/data/functions/test_get_attribute_illegal_host_in_outputs.yaml +++ /dev/null @@ -1,17 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0 - -description: > - TOSCA template for testing get_attribute with HOST keyword. - -topology_template: - node_templates: - server: - type: tosca.nodes.Compute - capabilities: - host: - properties: - num_cpus: 2 - - outputs: - ip_address: - value: { get_attribute: [ HOST, private_address ] } diff --git a/translator/toscalib/tests/data/functions/test_get_attribute_unknown_attribute_name.yaml b/translator/toscalib/tests/data/functions/test_get_attribute_unknown_attribute_name.yaml deleted file mode 100644 index 0570c7ca..00000000 --- a/translator/toscalib/tests/data/functions/test_get_attribute_unknown_attribute_name.yaml +++ /dev/null @@ -1,28 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0 - -description: > - Tosca template for testing unknown attribute name in get_attribute - function. - -topology_template: - inputs: - image_id: - type: string - - node_templates: - server: - type: tosca.nodes.Compute - capabilities: - host: - properties: - num_cpus: 2 - interfaces: - Standard: - configure: - implementation: start_server.sh - inputs: - image_id: { get_input: image_id } - - outputs: - ip_address: - value: { get_attribute: [ server, unknown_attribute ] } diff --git a/translator/toscalib/tests/data/functions/test_get_attribute_unknown_node_template_name.yaml b/translator/toscalib/tests/data/functions/test_get_attribute_unknown_node_template_name.yaml deleted file mode 100644 index 923305c6..00000000 --- a/translator/toscalib/tests/data/functions/test_get_attribute_unknown_node_template_name.yaml +++ /dev/null @@ -1,28 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0 - -description: > - Tosca template for testing unknown node template name in get_attribute - function. - -topology_template: - inputs: - image_id: - type: string - - node_templates: - server: - type: tosca.nodes.Compute - capabilities: - host: - properties: - num_cpus: 2 - interfaces: - Standard: - configure: - implementation: start_server.sh - inputs: - image_id: { get_input: image_id } - - outputs: - ip_address: - value: { get_attribute: [ unknown_node_template, private_address ] } diff --git a/translator/toscalib/tests/data/functions/test_invalid_function_signature.yaml b/translator/toscalib/tests/data/functions/test_invalid_function_signature.yaml deleted file mode 100644 index 13cf0187..00000000 --- a/translator/toscalib/tests/data/functions/test_invalid_function_signature.yaml +++ /dev/null @@ -1,34 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0 - -description: > - TOSCA simple profile template to test invalid get_input function. - -topology_template: - inputs: - cpus: - type: integer - description: Number of CPUs for the server. - constraints: - - valid_values: [ 1, 2, 4, 8 ] - - node_templates: - server: - type: tosca.nodes.Compute - capabilities: - host: - properties: - # compute properties (flavor) - disk_size: 10 - num_cpus: { get_input: [cpus, cpus] } - mem_size: 4096 - os: - properties: - architecture: x86_64 - type: Linux - distribution: Fedora - version: 18.0 - - outputs: - server_address: - description: IP address of server instance. - value: { get_attribute: [server, private_address] } diff --git a/translator/toscalib/tests/data/functions/test_unknown_capability_property.yaml b/translator/toscalib/tests/data/functions/test_unknown_capability_property.yaml deleted file mode 100644 index 4a925306..00000000 --- a/translator/toscalib/tests/data/functions/test_unknown_capability_property.yaml +++ /dev/null @@ -1,36 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0 - -description: > - Tosca template for testing an unknown capability property. - -topology_template: - node_templates: - server: - type: tosca.nodes.Compute - capabilities: - host: - properties: - num_cpus: 2 - dbms: - type: tosca.nodes.DBMS - properties: - root_password: 1234 - port: 3672 - database: - type: tosca.nodes.Database - properties: - name: my_db - user: abcd - password: 1234 - capabilities: - database_endpoint: - properties: - port: { get_property: [ dbms, port ] } - requirements: - - host: dbms - interfaces: - Standard: - configure: - implementation: database_configure.sh - inputs: - db_port: { get_property: [ SELF, database_endpoint, unknown ] } diff --git a/translator/toscalib/tests/data/functions/test_unknown_input_in_interface.yaml b/translator/toscalib/tests/data/functions/test_unknown_input_in_interface.yaml deleted file mode 100644 index cbfb3917..00000000 --- a/translator/toscalib/tests/data/functions/test_unknown_input_in_interface.yaml +++ /dev/null @@ -1,20 +0,0 @@ - -tosca_definitions_version: tosca_simple_yaml_1_0 - -description: > - Tosca template for testing an unknown input. - -topology_template: - node_templates: - server: - type: tosca.nodes.Compute - capabilities: - host: - properties: - num_cpus: 2 - interfaces: - Standard: - configure: - implementation: start_server.sh - inputs: - image_id: { get_input: image_id } diff --git a/translator/toscalib/tests/data/functions/test_unknown_input_in_property.yaml b/translator/toscalib/tests/data/functions/test_unknown_input_in_property.yaml deleted file mode 100644 index 9ba7ee58..00000000 --- a/translator/toscalib/tests/data/functions/test_unknown_input_in_property.yaml +++ /dev/null @@ -1,13 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0 - -description: > - Tosca template for testing an unknown input. - -topology_template: - node_templates: - obj_store_server: - type: tosca.nodes.ObjectStorage - properties: - name: { get_input: objectstore_name } - size: 1024 MB - maxsize: 1 GB diff --git a/translator/toscalib/tests/data/test_invalid_template_version.yaml b/translator/toscalib/tests/data/test_invalid_template_version.yaml deleted file mode 100644 index 86dce79c..00000000 --- a/translator/toscalib/tests/data/test_invalid_template_version.yaml +++ /dev/null @@ -1,14 +0,0 @@ -tosca_definitions_version: tosca_xyz - -description: > - Test template with an invalid template version. - -topology_template: - node_templates: - server: - type: tosca.nodes.Compute - capabilities: - host: - properties: - num_cpus: 2 - diff --git a/translator/toscalib/tests/data/test_no_inputs_in_template.yaml b/translator/toscalib/tests/data/test_no_inputs_in_template.yaml deleted file mode 100644 index 9be54ef8..00000000 --- a/translator/toscalib/tests/data/test_no_inputs_in_template.yaml +++ /dev/null @@ -1,15 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0 - -description: > - Tosca template for testing a template with no inputs. - -topology_template: - node_templates: - server: - type: tosca.nodes.Compute - capabilities: - host: - properties: - num_cpus: 2 - - outputs: diff --git a/translator/toscalib/tests/data/test_no_outputs_in_template.yaml b/translator/toscalib/tests/data/test_no_outputs_in_template.yaml deleted file mode 100644 index 51d42ff5..00000000 --- a/translator/toscalib/tests/data/test_no_outputs_in_template.yaml +++ /dev/null @@ -1,15 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0 - -description: > - Tosca template for testing a template with no outputs. - -topology_template: - inputs: - - node_templates: - server: - type: tosca.nodes.Compute - capabilities: - host: - properties: - num_cpus: 2 diff --git a/translator/toscalib/tests/data/test_requirements.yaml b/translator/toscalib/tests/data/test_requirements.yaml deleted file mode 100644 index 269c46d9..00000000 --- a/translator/toscalib/tests/data/test_requirements.yaml +++ /dev/null @@ -1,67 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0 - -description: > - Test Requirements. - -imports: - - custom_types/wordpress.yaml - -topology_template: - node_templates: - my_app: - description: > - Specify multiple requirement via node and relationship keyword, - as an explicit relationship. Also demonstrates relationship with - type keyword and without it as an in-line reference. - type: tosca.nodes.WebApplication.WordPress - requirements: - - req1: - node: my_webserver - relationship: tosca.relationships.HostedOn - - req2: - node: mysql_database - relationship: - type: tosca.relationships.ConnectsTo - mysql_database: - description: Specify requirement via a capability as an implicit relationship. - type: tosca.nodes.Database - requirements: - - host: - node: my_dbms - relationship: tosca.relationships.HostedOn - my_dbms: - type: tosca.nodes.DBMS - my_webserver: - type: tosca.nodes.WebServer - my_server: - description: > - Specify requirement via a relationship template, as an explicit relationship. - type: tosca.nodes.Compute - capabilities: - host: - properties: - num_cpus: 2 - disk_size: 10 GB - mem_size: 4 MB - os: - properties: - # host Operating System image properties - architecture: x86_64 - type: linux - distribution: rhel - version: 6.5 - requirements: - - req1: - node: my_storage - relationship: storage_attachment - my_storage: - type: tosca.nodes.BlockStorage - properties: - size: 1 GiB - snapshot_id: id - - relationship_templates: - storage_attachment: - type: tosca.relationships.AttachesTo - properties: - location: /temp diff --git a/translator/toscalib/tests/data/test_tosca_normative_type_by_shortname.yaml b/translator/toscalib/tests/data/test_tosca_normative_type_by_shortname.yaml deleted file mode 100644 index 8a702fb7..00000000 --- a/translator/toscalib/tests/data/test_tosca_normative_type_by_shortname.yaml +++ /dev/null @@ -1,33 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0 - -description: > - TOSCA simple profile with short type name for Compute. - -topology_template: - inputs: - cpus: - type: integer - description: Number of CPUs for the server. - constraints: - - valid_values: [ 1, 2, 4, 8 ] - - node_templates: - server: - type: Compute - capabilities: - host: - properties: - disk_size: 10 GB - num_cpus: { get_input: cpus } - mem_size: 4096 MB - os: - properties: - architecture: x86_64 - type: Linux - distribution: Fedora - version: 18.0 - - outputs: - server_address: - description: IP address of server instance. - value: { get_attribute: [server, private_address] } diff --git a/translator/toscalib/tests/data/test_tosca_top_level_error1.yaml b/translator/toscalib/tests/data/test_tosca_top_level_error1.yaml deleted file mode 100644 index 591ee97e..00000000 --- a/translator/toscalib/tests/data/test_tosca_top_level_error1.yaml +++ /dev/null @@ -1,31 +0,0 @@ -description: > - TOSCA simple profile missing version section. - -topology_template: - inputs: - cpus: - type: integer - description: Number of CPUs for the server. - constraints: - - valid_values: [ 1, 2, 4, 8 ] - - node_templates: - server: - type: tosca.nodes.Compute - capabilities: - host: - properties: - disk_size: 10 GB - num_cpus: { get_input: cpus } - mem_size: 4096 MB - os: - properties: - architecture: x86_64 - type: Linux - distribution: Fedora - version: 18.0 - - outputs: - server_address: - description: IP address of server instance. - value: { get_property: [server, private_address] } diff --git a/translator/toscalib/tests/data/test_tosca_top_level_error2.yaml b/translator/toscalib/tests/data/test_tosca_top_level_error2.yaml deleted file mode 100644 index 683e6234..00000000 --- a/translator/toscalib/tests/data/test_tosca_top_level_error2.yaml +++ /dev/null @@ -1,33 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0 - -description: > - TOSCA simple profile with invalid top-level key: 'node_template'. - -topology_template: - inputs: - cpus: - type: integer - description: Number of CPUs for the server. - constraints: - - valid_values: [ 1, 2, 4, 8 ] - - node_template: - server: - type: tosca.nodes.Compute - capabilities: - host: - properties: - disk_size: 10 GB - num_cpus: { get_input: cpus } - mem_size: 4096 MB - os: - properties: - architecture: x86_64 - type: Linux - distribution: Fedora - version: 18.0 - - outputs: - server_address: - description: IP address of server instance. - value: { get_property: [server, private_address] } diff --git a/translator/toscalib/tests/data/topology_template/definitions.yaml b/translator/toscalib/tests/data/topology_template/definitions.yaml deleted file mode 100644 index ab430507..00000000 --- a/translator/toscalib/tests/data/topology_template/definitions.yaml +++ /dev/null @@ -1,44 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0 - -node_types: - example.TransactionSubsystem: - properties: - mq_server_ip: - type: string - receiver_port: - type: integer - attributes: - receiver_ip: - type: string - receiver_port: - type: integer - capabilities: - message_receiver: - type: example.capabilities.Receiver - requirements: - - database_endpoint: tosca.capabilities.Endpoint.Database - - example.QueuingSubsystem: - derived_from: tosca.nodes.SoftwareComponent - - example.DatabaseSubsystem: - derived_from: tosca.nodes.Database - - example.SomeApp: - derived_from: tosca.nodes.SoftwareComponent - properties: - admin_user: - type: string - pool_size: - type: integer - capabilities: - message_receiver: - type: example.capabilities.Receiver - -capability_types: - example.capabilities.Receiver: - derived_from: tosca.capabilities.Endpoint - properties: - server_ip: - type: string - diff --git a/translator/toscalib/tests/data/topology_template/subsystem.yaml b/translator/toscalib/tests/data/topology_template/subsystem.yaml deleted file mode 100644 index ddbc94e7..00000000 --- a/translator/toscalib/tests/data/topology_template/subsystem.yaml +++ /dev/null @@ -1,85 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0 - -description: > - Service template with topology_template, act as a nested system inside another system. - -imports: - - definitions.yaml - -topology_template: - description: Template of a database including its hosting stack. - - inputs: - mq_server_ip: - type: string - description: IP address of the message queuing server to receive messages from. - receiver_port: - type: string - description: Port to be used for receiving messages. - my_cpus: - type: integer - description: Number of CPUs for the server. - constraints: - - valid_values: [ 1, 2, 4, 8 ] - - substitution_mappings: - node_type: example.TransactionSubsystem - capabilities: - message_receiver: [ app, message_receiver ] - requirements: - database_endpoint: [ app, database ] - - node_templates: - app: - type: example.SomeApp - properties: - admin_user: foo - pool_size: 10 - capabilities: - message_receiver: - properties: - server_ip: { get_input: mq_server_ip } - requirements: - - host: - node: websrv - - websrv: - type: tosca.nodes.WebServer - capabilities: - data_endpoint: - properties: - port_name: { get_input: receiver_port } - requirements: - - host: - node: server - - server: - type: tosca.nodes.Compute - capabilities: - host: - properties: - disk_size: 10 GB - num_cpus: { get_input: my_cpus } - mem_size: 4096 MB - os: - properties: - architecture: x86_64 - type: Linux - distribution: Ubuntu - version: 14.04 - - outputs: - receiver_ip: - description: private IP address of the message receiver application - value: { get_attribute: [ server, private_address ] } -# It seems current _process_intrisic_function can not handle more than 2 arguments, save it for later -# receiver_port: -# description: Port of the message receiver endpoint -# value: { get_attribute: [ app, data_endpoint, port_name ] } - - groups: - webserver_group: - members: [ websrv, server ] - policies: - - policy_name: none - diff --git a/translator/toscalib/tests/data/topology_template/system.yaml b/translator/toscalib/tests/data/topology_template/system.yaml deleted file mode 100644 index 350e94ec..00000000 --- a/translator/toscalib/tests/data/topology_template/system.yaml +++ /dev/null @@ -1,46 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0 - -topology_template: - description: Template of online transaction processing service. - - node_templates: - mq: - type: example.QueuingSubsystem - # properties: - # to be updated when substitution_mapping is implemented - # capabilities: - # message_queue_endpoint: - # to be updated when substitution_mapping is implemented - requirements: - - receiver: trans1 - - receiver: trans2 - - trans1: - type: example.TransactionSubsystem - properties: - mq_server_ip: { get_attribute: [ mq, server_ip ] } - receiver_port: 8080 - # capabilities: - # message_receiver: - # to be updated when substitution_mapping is implemented - requirements: - - database_endpoint: dbsys - - trans2: - type: example.TransactionSubsystem - properties: - mq_server_ip: { get_attribute: [ mq, server_ip ] } - receiver_port: 8080 - # capabilities: - # message_receiver: - # to be updated when substitution_mapping is implemented - requirements: - - database_endpoint: dbsys - - dbsys: - type: example.DatabaseSubsystem - # properties: - # to be updated when substitution_mapping is implemented - # capabilities: - # database_endpoint: - # to be updated when substitution_mapping is implemented \ No newline at end of file diff --git a/translator/toscalib/tests/data/tosca_nodejs_mongodb_two_instances.yaml b/translator/toscalib/tests/data/tosca_nodejs_mongodb_two_instances.yaml new file mode 100644 index 00000000..f6110716 --- /dev/null +++ b/translator/toscalib/tests/data/tosca_nodejs_mongodb_two_instances.yaml @@ -0,0 +1,96 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: > + TOSCA simple profile with nodejs and mongodb. + +imports: + - custom_types/paypalpizzastore_nodejs_app.yaml + +dsl_definitions: + host_capabilities: &host_capabilities + disk_size: 10 GB + num_cpus: 1 + mem_size: 4096 MB + os_capabilities: &os_capabilities + architecture: x86_64 + type: Linux + distribution: Ubuntu + version: 14.04 + +topology_template: + inputs: + my_cpus: + type: integer + description: Number of CPUs for the server. + constraints: + - valid_values: [ 1, 2, 4, 8 ] + default: 1 + github_url: + type: string + description: The URL to download nodejs. + default: http://github.com/paypal/rest-api-sample-app-nodejs.git + + node_templates: + paypal_pizzastore: + type: tosca.nodes.WebApplication.PayPalPizzaStore + properties: + github_url: { get_input: github_url } + requirements: + - host: nodejs + - database_connection: mongo_db + interfaces: + Standard: + configure: + implementation: nodejs/config.sh + inputs: + github_url: http://github.com/paypal/rest-api-sample-app-nodejs.git + mongodb_ip: { get_attribute: [mongo_server, private_address] } + start: nodejs/start.sh + nodejs: + type: tosca.nodes.WebServer + requirements: + - host: app_server + interfaces: + Standard: + create: nodejs/create.sh + mongo_db: + type: tosca.nodes.Database + requirements: + - host: mongo_dbms + interfaces: + Standard: + create: mongodb/create_database.sh + mongo_dbms: + type: tosca.nodes.DBMS + requirements: + - host: mongo_server + interfaces: + Standard: + create: mongodb/create.sh + configure: + implementation: mongodb/config.sh + inputs: + mongodb_ip: { get_attribute: [mongo_server, private_address] } + start: mongodb/start.sh + mongo_server: + type: tosca.nodes.Compute + capabilities: + host: + properties: *host_capabilities + os: + properties: *os_capabilities + app_server: + type: tosca.nodes.Compute + capabilities: + host: + properties: *host_capabilities + os: + properties: *os_capabilities + + outputs: + nodejs_url: + description: URL for the nodejs server, http://:3000 + value: { get_attribute: [app_server, private_address] } + mongodb_url: + description: URL for the mongodb server. + value: { get_attribute: [mongo_server, private_address] }