From d65c6995f44e22b72d61c294db3edd44fead2248 Mon Sep 17 00:00:00 2001 From: spzala Date: Mon, 2 Mar 2015 15:54:50 -0800 Subject: [PATCH] TOSCA: consider nodejs as web server only Per the latest TOSCA TC discussion, nodejs should be considered as a web server only for the monitoring use case. This requires to remove connection requirement of nodejs. Change-Id: I192ed0ca02a9fed1dcfdeb1a78536bc136fd39e6 --- translator/tests/data/tosca_elk.yaml | 1 - translator/tests/test_elk.py | 22 +++++-------------- .../tests/data/custom_types/nodejs.yaml | 13 ----------- translator/toscalib/tests/data/tosca_elk.yaml | 12 ++-------- 4 files changed, 8 insertions(+), 40 deletions(-) diff --git a/translator/tests/data/tosca_elk.yaml b/translator/tests/data/tosca_elk.yaml index 7e3072b..b507854 100644 --- a/translator/tests/data/tosca_elk.yaml +++ b/translator/tests/data/tosca_elk.yaml @@ -37,7 +37,6 @@ node_templates: github_url: https://github.com/sample.git requirements: - host: app_server - - database_endpoint: mongo_dbms interfaces: tosca.interfaces.node.lifecycle.Standard: create: nodejs/create.sh diff --git a/translator/tests/test_elk.py b/translator/tests/test_elk.py index 099b0dd..d6463f8 100755 --- a/translator/tests/test_elk.py +++ b/translator/tests/test_elk.py @@ -29,9 +29,8 @@ class ToscaMongoNodejsTest(TestCase): tosca = ToscaTemplate(tosca_tpl) def test_relationship_def(self): - expected_relationship = ['tosca.relationships.ConnectsTo', - 'tosca.relationships.HostedOn'] - expected_capabilities_names = ['database_endpoint', 'host'] + expected_relationship = ['tosca.relationships.HostedOn'] + expected_capabilities_names = ['host'] for tpl in self.tosca.nodetemplates: if tpl.name == 'nodejs': def_keys = tpl.type_definition.relationship.keys() @@ -43,9 +42,8 @@ class ToscaMongoNodejsTest(TestCase): sorted([x.capability_name for x in def_keys])) def test_relationships(self): - expected_relationship = ['tosca.relationships.ConnectsTo', - 'tosca.relationships.HostedOn'] - expected_relatednodes = ['app_server', 'mongo_dbms'] + expected_relationship = ['tosca.relationships.HostedOn'] + expected_relatednodes = ['app_server'] for tpl in self.tosca.nodetemplates: rels = tpl.relationships if rels: @@ -58,19 +56,13 @@ class ToscaMongoNodejsTest(TestCase): sorted([y.name for y in tpl.relationships.values()])) def test_related_nodes(self): - expected_nodejs = ['app_server', 'mongo_dbms'] + expected_nodejs = ['app_server'] actual_nodejs = [] - expected_mongo = ['mongo_server'] - actual_mongo = [] for tpl in self.tosca.nodetemplates: if tpl.name == 'nodejs': for node in tpl.related_nodes: actual_nodejs.append(node.name) - if tpl.name == 'mongo_dbms': - for node in tpl.related_nodes: - actual_mongo.append(node.name) self.assertEqual(sorted(actual_nodejs), expected_nodejs) - self.assertEqual(actual_mongo, expected_mongo) def test_translate_nodejs_mongodb(self): translate = TOSCATranslator(self.tosca, self.parsed_params) @@ -141,9 +133,7 @@ class ToscaMongoNodejsTest(TestCase): 'server': {'get_resource': 'mongo_server'}}}, 'nodejs_create_deploy': - {'depends_on': - ['mongo_dbms_start_deploy'], - 'properties': + {'properties': {'config': {'get_resource': 'nodejs_create_config'}, 'server': diff --git a/translator/toscalib/tests/data/custom_types/nodejs.yaml b/translator/toscalib/tests/data/custom_types/nodejs.yaml index 4983e45..3eb8918 100644 --- a/translator/toscalib/tests/data/custom_types/nodejs.yaml +++ b/translator/toscalib/tests/data/custom_types/nodejs.yaml @@ -9,19 +9,6 @@ node_types: type: string description: location of the application on the github. default: https://github.com/mmm/testnode.git - requirements: - - database_endpoint: tosca.nodes.Database - relationship: tosca.relationships.ConnectsTo - interfaces: - tosca.interfaces.relationship.Configure: - pre_configure_source: - implementation: - type: string - inputs: - host: - type: string - port: - type: integer interfaces: tosca.interfaces.node.lifecycle.Standard: inputs: diff --git a/translator/toscalib/tests/data/tosca_elk.yaml b/translator/toscalib/tests/data/tosca_elk.yaml index dac6219..9b7b4a9 100644 --- a/translator/toscalib/tests/data/tosca_elk.yaml +++ b/translator/toscalib/tests/data/tosca_elk.yaml @@ -23,7 +23,7 @@ dsl_definitions: os_distribution: Ubuntu os_version: 14.04 collectd_interface: &collectd_interface - tosca.interfaces.relation.Configure: + tosca.interfaces.relationship.Configure: pre_configure_source: implementation: collectd/pre_configure_source.py inputs: @@ -32,7 +32,7 @@ dsl_definitions: pre_configure_target: implementation: collectd/pre_configure_target.py rsyslog_interface: &rsyslog_interface - tosca.interfaces.relation.Configure: + tosca.interfaces.relationship.Configure: pre_configure_source: implementation: rsyslog/pre_configure_source.py inputs: @@ -61,14 +61,6 @@ node_templates: github_url: { get_input: github_url } requirements: - host: app_server - - database_endpoint: mongo_db - interfaces: - tosca.interfaces.relationship.Configure: - pre_configure_source: - implementation: nodejs/pre_configure_source.sh - inputs: - host: { get_attribute: [ TARGET, ip_address ] } - port: { get_property: [ mongo_dbms, dbms_port ] } interfaces: tosca.interfaces.node.lifecycle.Standard: create: nodejs/create.sh