diff options
author | Zhaoxing <meng.zhaoxing1@zte.com.cn> | 2017-09-22 15:40:57 +0800 |
---|---|---|
committer | Zhaoxing <meng.zhaoxing1@zte.com.cn> | 2017-09-22 15:40:57 +0800 |
commit | 6a3e9d53686eda1d45fb54b97869a594741f089c (patch) | |
tree | 9afe1eaae4311726ea30dd65142cd22325324c98 /nfvparser/toscaparser/tests/data/functions | |
parent | 723a89591b73ed1f7ad43a31c38b40b2cc784e0e (diff) |
Move python files to root dir
Change-Id: I16a66e1f6bcb65cbb68f2b622618252885ab47fc
Issue-Id: MODELING-20
Signed-off-by: Zhaoxing <meng.zhaoxing1@zte.com.cn>
Diffstat (limited to 'nfvparser/toscaparser/tests/data/functions')
22 files changed, 590 insertions, 0 deletions
diff --git a/nfvparser/toscaparser/tests/data/functions/test_capabilties_inheritance.yaml b/nfvparser/toscaparser/tests/data/functions/test_capabilties_inheritance.yaml new file mode 100644 index 0000000..f0bec84 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_capabilties_inheritance.yaml @@ -0,0 +1,25 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: TOSCA simple profile to test the attribute inheritance + +imports: + - ../custom_types/node_with_cap.yaml + +topology_template: + + node_templates: + + some_node: + type: tosca.nodes.SomeNode + requirements: + - some_req: node_cap + interfaces: + Standard: + configure: + implementation: some_script.sh + inputs: + some_input: { get_property: [ SELF, some_req, type ] } + + node_cap: + type: tosca.nodes.NodeWithCap + diff --git a/nfvparser/toscaparser/tests/data/functions/test_concat.yaml b/nfvparser/toscaparser/tests/data/functions/test_concat.yaml new file mode 100644 index 0000000..22fcfb4 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_concat.yaml @@ -0,0 +1,30 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: Template for deploying a single server with concat function. + +topology_template: + node_templates: + server: + type: tosca.nodes.Compute + capabilities: + # Host container properties + host: + properties: + num_cpus: 2 + disk_size: 10 GB + mem_size: 512 MB + # Guest Operating System properties + os: + properties: + # host Operating System image properties + architecture: x86_64 + type: Linux + distribution: RHEL + version: 6.5 + outputs: + url: + description: Concatenate the URL for a server from template values. + value: { concat: [ 'http://', + get_attribute: [ server, public_address ], + ':' , + get_attribute: [ server, port ] ] }
\ No newline at end of file diff --git a/nfvparser/toscaparser/tests/data/functions/test_concat_invalid.yaml b/nfvparser/toscaparser/tests/data/functions/test_concat_invalid.yaml new file mode 100644 index 0000000..7c7b0aa --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_concat_invalid.yaml @@ -0,0 +1,9 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: Template for deploying a single server with invalid concat function. + +topology_template: + outputs: + invalid_concat_syntax: + description: test concat with invalid syntax. + value: { concat: []}
\ No newline at end of file diff --git a/nfvparser/toscaparser/tests/data/functions/test_get_attribute_host_keyword.yaml b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_host_keyword.yaml new file mode 100644 index 0000000..90ffbe2 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_host_keyword.yaml @@ -0,0 +1,33 @@ +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/nfvparser/toscaparser/tests/data/functions/test_get_attribute_host_not_found.yaml b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_host_not_found.yaml new file mode 100644 index 0000000..69679ff --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_host_not_found.yaml @@ -0,0 +1,20 @@ +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/nfvparser/toscaparser/tests/data/functions/test_get_attribute_illegal_host_in_outputs.yaml b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_illegal_host_in_outputs.yaml new file mode 100644 index 0000000..6c7d9bb --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_illegal_host_in_outputs.yaml @@ -0,0 +1,17 @@ +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/nfvparser/toscaparser/tests/data/functions/test_get_attribute_source_target_keywords.yaml b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_source_target_keywords.yaml new file mode 100644 index 0000000..047387f --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_source_target_keywords.yaml @@ -0,0 +1,30 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: > + TOSCA template for testing get_attribute with TARGET ans SOURCE keywords. + +topology_template: + + node_templates: + + mysql: + type: tosca.nodes.DBMS + properties: + root_password: rootpw + port: 3306 + requirements: + - host: + node: db_server + relationship: + type: tosca.relationships.HostedOn + interfaces: + Configure: + pre_configure_source: + implementation: some_script.sh + inputs: + target_test: { get_attribute: [ TARGET, public_address ] } + source_port: { get_attribute: [ SOURCE, tosca_name ] } + + db_server: + type: tosca.nodes.Compute + diff --git a/nfvparser/toscaparser/tests/data/functions/test_get_attribute_unknown_attribute_name.yaml b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_unknown_attribute_name.yaml new file mode 100644 index 0000000..0570c7c --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_unknown_attribute_name.yaml @@ -0,0 +1,28 @@ +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/nfvparser/toscaparser/tests/data/functions/test_get_attribute_unknown_node_template_name.yaml b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_unknown_node_template_name.yaml new file mode 100644 index 0000000..34c1c33 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_unknown_node_template_name.yaml @@ -0,0 +1,30 @@ +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 ] } + network: + value: { get_attribute: [ unknown_node_template, networks, public ] } diff --git a/nfvparser/toscaparser/tests/data/functions/test_get_attribute_with_index.yaml b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_with_index.yaml new file mode 100644 index 0000000..5766490 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_with_index.yaml @@ -0,0 +1,19 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: > + TOSCA template for testing get_attribute with a list attribute and an index + +imports: + - ../custom_types/compute_with_attribute_list.yaml + +topology_template: + node_templates: + server: + type: tosca.nodes.ComputeWithAttrList + interfaces: + Standard: + configure: + implementation: configure.sh + inputs: + ip_address: { get_attribute: [ SELF, attr_list, 0 ] } + diff --git a/nfvparser/toscaparser/tests/data/functions/test_get_attribute_with_index_error.yaml b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_with_index_error.yaml new file mode 100644 index 0000000..7511999 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_with_index_error.yaml @@ -0,0 +1,19 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: > + TOSCA template for testing get_attribute with an incorrect index + +imports: + - ../custom_types/compute_with_attribute_list.yaml + +topology_template: + node_templates: + server: + type: tosca.nodes.ComputeWithAttrList + interfaces: + Standard: + configure: + implementation: configure.sh + inputs: + ip_address: { get_attribute: [ SELF, private_address, 0 ] } + diff --git a/nfvparser/toscaparser/tests/data/functions/test_get_attribute_with_nested_params.yaml b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_with_nested_params.yaml new file mode 100644 index 0000000..79e632c --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_with_nested_params.yaml @@ -0,0 +1,23 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: > + TOSCA template for testing get_attribute with nested attributes + +imports: + - ../custom_types/compute_with_nested_atributes.yaml + +topology_template: + node_templates: + server: + type: tosca.nodes.ComputeWithCapWithAttr + capabilities: + endpoint: + properties: + port: 80 + interfaces: + Standard: + configure: + implementation: configure.sh + inputs: + ip_address: { get_attribute: [ SELF, endpoint, credential, 0, token ] } + diff --git a/nfvparser/toscaparser/tests/data/functions/test_get_implicit_attribute.yaml b/nfvparser/toscaparser/tests/data/functions/test_get_implicit_attribute.yaml new file mode 100644 index 0000000..a269005 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_get_implicit_attribute.yaml @@ -0,0 +1,25 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: > + Attribute can be defined explicitly as part of type definition + or implicitly via property. This TOSCA template tests validation + of attribute name implicitly created as a property and referenced + via get_attribute function. + +node_types: + ServerNode: + derived_from: SoftwareComponent + properties: + notification_port: + type: integer + +topology_template: + node_templates: + my_server: + type: ServerNode + properties: + notification_port: 8000 + + outputs: + ip_address: + value: { get_attribute: [ my_server, notification_port ] }
\ No newline at end of file diff --git a/nfvparser/toscaparser/tests/data/functions/test_get_property_source_target_keywords.yaml b/nfvparser/toscaparser/tests/data/functions/test_get_property_source_target_keywords.yaml new file mode 100644 index 0000000..c460257 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_get_property_source_target_keywords.yaml @@ -0,0 +1,35 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: > + TOSCA template for testing get_property with TARGET ans SOURCE keywords. + +imports: + - ../custom_types/compute_with_prop.yaml + +topology_template: + + node_templates: + + mysql: + type: tosca.nodes.DBMS + properties: + root_password: rootpw + port: 3306 + requirements: + - host: + node: db_server + relationship: + type: tosca.relationships.HostedOn + interfaces: + Configure: + pre_configure_source: + implementation: some_script.sh + inputs: + target_test: { get_property: [ TARGET, test ] } + source_port: { get_property: [ SOURCE, port ] } + + db_server: + type: tosca.nodes.ComputeWithProp + properties: + test: 1 + diff --git a/nfvparser/toscaparser/tests/data/functions/test_get_property_with_host.yaml b/nfvparser/toscaparser/tests/data/functions/test_get_property_with_host.yaml new file mode 100644 index 0000000..1ca69ca --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_get_property_with_host.yaml @@ -0,0 +1,65 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: > + TOSCA simple profile to test the get property function with HOST parameter + +imports: + - ../custom_types/compute_with_prop.yaml + +topology_template: + inputs: + db_name: + type: string + description: The name of the database. + default: wordpress + db_user: + type: string + description: The user name of the DB user. + default: wp_user + db_pwd: + type: string + description: The WordPress database admin account password. + default: wp_pass + db_root_pwd: + type: string + description: Root password for MySQL. + db_port: + type: PortDef + description: Port for the MySQL database. + default: 3306 + + node_templates: + + mysql_database: + type: tosca.nodes.Database + properties: + name: { get_input: db_name } + user: { get_input: db_user } + password: { get_input: db_pwd } + capabilities: + database_endpoint: + properties: + port: { get_input: db_port } + requirements: + - host: mysql_dbms + interfaces: + Standard: + configure: + implementation: mysql/mysql_database_configure.sh + inputs: + db_port: { get_property: [ HOST, port ] } + test: { get_property: [ HOST, test ] } + + mysql_dbms: + type: tosca.nodes.DBMS + properties: + root_password: { get_input: db_root_pwd } + port: { get_input: db_port } + requirements: + - host: server + + server: + type: tosca.nodes.ComputeWithProp + properties: + test: 1 + diff --git a/nfvparser/toscaparser/tests/data/functions/test_invalid_function_signature.yaml b/nfvparser/toscaparser/tests/data/functions/test_invalid_function_signature.yaml new file mode 100644 index 0000000..dde8427 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_invalid_function_signature.yaml @@ -0,0 +1,34 @@ +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 GB + num_cpus: { get_input: [cpus, 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/nfvparser/toscaparser/tests/data/functions/test_token.yaml b/nfvparser/toscaparser/tests/data/functions/test_token.yaml new file mode 100644 index 0000000..495a930 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_token.yaml @@ -0,0 +1,15 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: Template for deploying a single server with token function. + +topology_template: + node_templates: + server: + type: tosca.nodes.Compute + + outputs: + url: + description: Get the first part of the ip + value: { token: [ get_attribute: [ server, public_address ], + '.' , + 0 ] } diff --git a/nfvparser/toscaparser/tests/data/functions/test_token_invalid.yaml b/nfvparser/toscaparser/tests/data/functions/test_token_invalid.yaml new file mode 100644 index 0000000..35ae2ff --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_token_invalid.yaml @@ -0,0 +1,17 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: Template for deploying a single server with invalid token function. + +topology_template: + outputs: + invalid_token_syntax_1: + description: test token with only two paremeters. + value: { token: ["some_string", "_"]} + + invalid_token_syntax_2: + description: test token with invalid string as third argument. + value: { token: ["some_string", "_", "1"]} + + invalid_token_syntax_3: + description: test token with invalid string as second argument. + value: { token: ["some_string", "aa", "1"]} diff --git a/nfvparser/toscaparser/tests/data/functions/test_unknown_capability_property.yaml b/nfvparser/toscaparser/tests/data/functions/test_unknown_capability_property.yaml new file mode 100644 index 0000000..4a92530 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_unknown_capability_property.yaml @@ -0,0 +1,36 @@ +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/nfvparser/toscaparser/tests/data/functions/test_unknown_input_in_interface.yaml b/nfvparser/toscaparser/tests/data/functions/test_unknown_input_in_interface.yaml new file mode 100644 index 0000000..cbfb391 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_unknown_input_in_interface.yaml @@ -0,0 +1,20 @@ + +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/nfvparser/toscaparser/tests/data/functions/test_unknown_input_in_property.yaml b/nfvparser/toscaparser/tests/data/functions/test_unknown_input_in_property.yaml new file mode 100644 index 0000000..9ba7ee5 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_unknown_input_in_property.yaml @@ -0,0 +1,13 @@ +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/nfvparser/toscaparser/tests/data/functions/tosca_nested_property_names_indexes.yaml b/nfvparser/toscaparser/tests/data/functions/tosca_nested_property_names_indexes.yaml new file mode 100644 index 0000000..8fb7b96 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/tosca_nested_property_names_indexes.yaml @@ -0,0 +1,47 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: TOSCA simple profile with nested property names or indexes. + +imports: + - ../custom_types/wordpress.yaml + - ../custom_types/db_with_list_param.yaml + +topology_template: + + node_templates: + + wordpress: + type: tosca.nodes.WebApplication.WordPress + requirements: + - host: server + - database_endpoint: mysql_database + interfaces: + Standard: + configure: + implementation: wordpress/wordpress_configure.sh + inputs: + wp_endpoint_protocol: { get_property: [ SELF, database_endpoint, ports, user_port, protocol ] } + wp_list_prop: { get_property: [ mysql_database, list_prop, 2 ] } + + mysql_database: + type: tosca.nodes.DatabaseWithListParam + properties: + list_prop: [1,2,3] + capabilities: + database_endpoint: + properties: + ports: + user_port: + protocol: tcp + target: 50000 + source: 9000 + requirements: + - host: mysql_dbms + + mysql_dbms: + type: tosca.nodes.DBMS + requirements: + - host: server + + server: + type: tosca.nodes.Compute |