Merge "TOSCA: consider nodejs as web server only"
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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':
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user