From f4ed3322a9142c38e59cf1d4deeb69a4615b571e Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Fri, 22 Apr 2016 09:15:24 +0200 Subject: [PATCH] Create new example templates for TOSCA Credential Data Type Change-Id: I360ceb7e318d3d96bd993f69d3bb2c457ebdd54c Partially-Implements: blueprint tosca-datatype-credential --- .../tests/data/test_credential_datatype.yaml | 77 +++++++++++++++++++ toscaparser/tests/test_toscatplvalidation.py | 6 ++ 2 files changed, 83 insertions(+) create mode 100644 toscaparser/tests/data/test_credential_datatype.yaml diff --git a/toscaparser/tests/data/test_credential_datatype.yaml b/toscaparser/tests/data/test_credential_datatype.yaml new file mode 100644 index 00000000..583ec827 --- /dev/null +++ b/toscaparser/tests/data/test_credential_datatype.yaml @@ -0,0 +1,77 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: > + TOSCA simple profile with to demonstrate the usage of the + TOSCA Credential Data Type. + +imports: + - custom_types/wordpress.yaml + +relationship_types: + my.types.WordpressDbConnection: + derived_from: tosca.relationships.ConnectsTo + properties: + credential: + user: db_user + token: db_pwd + +topology_template: + node_templates: + wordpress: + type: tosca.nodes.WebApplication.WordPress + requirements: + - host: webserver + - database_endpoint: + node: mysql_database + relationship: my.types.WordpressDbConnection + + mysql_database: + type: tosca.nodes.Database + properties: + name: db_name + user: db_user + password: db_pwd + capabilities: + database_endpoint: + properties: + port: 3306 + requirements: + - host: + node: mysql_dbms + + mysql_dbms: + type: tosca.nodes.DBMS + properties: + root_password: db_root_pwd + port: 3306 + requirements: + - host: server + + webserver: + type: tosca.nodes.WebServer + properties: + admin_credential: + user: username + token: some_pass + requirements: + - host: server + + server: + type: tosca.nodes.Compute + capabilities: + host: + properties: + disk_size: 10 GB + num_cpus: 1 + mem_size: 4096 MB + os: + properties: + architecture: x86_64 + type: Linux + distribution: Ubuntu + version: 14.04 + + outputs: + website_url: + description: URL for Wordpress wiki. + value: { get_attribute: [server, private_address] } diff --git a/toscaparser/tests/test_toscatplvalidation.py b/toscaparser/tests/test_toscatplvalidation.py index 81a1a6c4..dfc80594 100644 --- a/toscaparser/tests/test_toscatplvalidation.py +++ b/toscaparser/tests/test_toscatplvalidation.py @@ -1379,3 +1379,9 @@ heat-translator/master/translator/tests/data/custom_types/wordpress.yaml exception.MissingRequiredFieldError, lambda: Policy(name, policies[name], None, None)) self.assertEqual(expectedmessage, err.__str__()) + + def test_credential_datatype(self): + tosca_tpl = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "data/test_credential_datatype.yaml") + self.assertIsNotNone(ToscaTemplate(tosca_tpl))