Merge "Resolve interfaces by symbolic name not by type"
This commit is contained in:
commit
40f8c94c9f
@ -16,8 +16,10 @@ import logging
|
||||
from translator.toscalib.common.exception import TypeMismatchError
|
||||
from translator.toscalib.common.exception import UnknownFieldError
|
||||
from translator.toscalib.elements.interfaces import CONFIGURE
|
||||
from translator.toscalib.elements.interfaces import CONFIGURE_SHORTNAME
|
||||
from translator.toscalib.elements.interfaces import InterfacesDef
|
||||
from translator.toscalib.elements.interfaces import LIFECYCLE
|
||||
from translator.toscalib.elements.interfaces import LIFECYCLE_SHORTNAME
|
||||
from translator.toscalib.elements.relationshiptype import RelationshipType
|
||||
from translator.toscalib.entity_template import EntityTemplate
|
||||
from translator.toscalib.relationship_template import RelationshipTemplate
|
||||
@ -190,12 +192,12 @@ class NodeTemplate(EntityTemplate):
|
||||
if ifaces:
|
||||
for i in ifaces:
|
||||
for name, value in ifaces.items():
|
||||
if name == LIFECYCLE:
|
||||
if name in (LIFECYCLE, LIFECYCLE_SHORTNAME):
|
||||
self._common_validate_field(
|
||||
value, InterfacesDef.
|
||||
interfaces_node_lifecycle_operations,
|
||||
'Interfaces')
|
||||
elif name == CONFIGURE:
|
||||
elif name in (CONFIGURE, CONFIGURE_SHORTNAME):
|
||||
self._common_validate_field(
|
||||
value, InterfacesDef.
|
||||
interfaces_relationship_confiure_operations,
|
||||
|
@ -38,7 +38,7 @@ topology_template:
|
||||
- database_endpoint:
|
||||
node: mysql_database
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
create: Scripts/WordPress/install.sh
|
||||
configure:
|
||||
implementation: Scripts/WordPress/configure.sh
|
||||
@ -57,7 +57,7 @@ topology_template:
|
||||
- host:
|
||||
node: mysql_dbms
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
configure:
|
||||
implementation: Scripts/MYSQLDatabase/configure.sh
|
||||
inputs:
|
||||
@ -75,7 +75,7 @@ topology_template:
|
||||
- host:
|
||||
node: server
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
create: Scripts/MYSQLDBMS/install.sh
|
||||
start: Scripts/MYSQLDBMS/start.sh
|
||||
configure:
|
||||
@ -89,7 +89,7 @@ topology_template:
|
||||
- host:
|
||||
node: server
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
create: Scripts/WebServer/install.sh
|
||||
start: Scripts/WebServer/start.sh
|
||||
server:
|
||||
|
@ -13,7 +13,7 @@ node_types:
|
||||
requirements:
|
||||
- database_endpoint: tosca.nodes.Database
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
inputs:
|
||||
db_port:
|
||||
type: integer
|
||||
|
@ -10,7 +10,7 @@ node_types:
|
||||
description: location of the application on the github.
|
||||
default: https://github.com/mmm/testnode.git
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
inputs:
|
||||
github_url:
|
||||
type: string
|
||||
|
@ -20,7 +20,7 @@ node_types:
|
||||
node: tosca.nodes.Database
|
||||
relationship: tosca.relationships.ConnectsTo
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
configure:
|
||||
inputs:
|
||||
github_url:
|
||||
|
@ -19,7 +19,7 @@ node_types:
|
||||
node: tosca.nodes.Database
|
||||
relationship: tosca.relationships.ConnectsTo
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
inputs:
|
||||
db_host:
|
||||
type: string
|
||||
|
@ -16,7 +16,7 @@ topology_template:
|
||||
requirements:
|
||||
- host: server
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
configure:
|
||||
implementation: configure.sh
|
||||
inputs:
|
||||
@ -26,7 +26,7 @@ topology_template:
|
||||
requirements:
|
||||
- host: dbms
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
configure:
|
||||
implementation: configure.sh
|
||||
inputs:
|
||||
|
@ -12,7 +12,7 @@ topology_template:
|
||||
properties:
|
||||
num_cpus: 2
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
configure:
|
||||
implementation: configure.sh
|
||||
inputs:
|
||||
|
@ -17,7 +17,7 @@ topology_template:
|
||||
properties:
|
||||
num_cpus: 2
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
configure:
|
||||
implementation: start_server.sh
|
||||
inputs:
|
||||
|
@ -17,7 +17,7 @@ topology_template:
|
||||
properties:
|
||||
num_cpus: 2
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
configure:
|
||||
implementation: start_server.sh
|
||||
inputs:
|
||||
|
@ -29,7 +29,7 @@ topology_template:
|
||||
requirements:
|
||||
- host: dbms
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
configure:
|
||||
implementation: database_configure.sh
|
||||
inputs:
|
||||
|
@ -13,7 +13,7 @@ topology_template:
|
||||
properties:
|
||||
num_cpus: 2
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
configure:
|
||||
implementation: start_server.sh
|
||||
inputs:
|
||||
|
@ -44,7 +44,7 @@ topology_template:
|
||||
pre_configure_target:
|
||||
implementation: logstash/configure_collectd.py
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
create: collectd/create.sh
|
||||
configure:
|
||||
implementation: collectd/config.py
|
||||
@ -58,7 +58,7 @@ topology_template:
|
||||
- host:
|
||||
node: logstash_server
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
create: logstash/create.sh
|
||||
start: logstash/start.sh
|
||||
|
||||
|
@ -49,7 +49,7 @@ topology_template:
|
||||
- database_connection:
|
||||
node: mongo_db
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
configure:
|
||||
implementation: nodejs/config.sh
|
||||
inputs:
|
||||
@ -62,7 +62,7 @@ topology_template:
|
||||
- host:
|
||||
node: app_server
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
create: nodejs/create.sh
|
||||
mongo_db:
|
||||
type: tosca.nodes.Database
|
||||
@ -70,7 +70,7 @@ topology_template:
|
||||
- host:
|
||||
node: mongo_dbms
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
create: mongodb/create_database.sh
|
||||
mongo_dbms:
|
||||
type: tosca.nodes.DBMS
|
||||
@ -78,7 +78,7 @@ topology_template:
|
||||
- host:
|
||||
node: mongo_server
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
create: mongodb/create.sh
|
||||
configure:
|
||||
implementation: mongodb/config.sh
|
||||
@ -91,7 +91,7 @@ topology_template:
|
||||
- host:
|
||||
node: elasticsearch_server
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
create: elasticsearch/create.sh
|
||||
start: elasticsearch/start.sh
|
||||
logstash:
|
||||
@ -111,7 +111,7 @@ topology_template:
|
||||
inputs:
|
||||
elasticsearch_ip: { get_attribute: [elasticsearch_server, private_address] }
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
create: logstash/create.sh
|
||||
start: logstash/start.sh
|
||||
kibana:
|
||||
@ -123,7 +123,7 @@ topology_template:
|
||||
node: elasticsearch
|
||||
capability: search_endpoint
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
create: kibana/create.sh
|
||||
configure:
|
||||
implementation: kibana/config.sh
|
||||
@ -146,7 +146,7 @@ topology_template:
|
||||
pre_configure_target:
|
||||
implementation: logstash/configure_collectd.py
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
create: collectd/create.sh
|
||||
configure:
|
||||
implementation: collectd/config.py
|
||||
@ -168,7 +168,7 @@ topology_template:
|
||||
pre_configure_target:
|
||||
implementation: logstash/configure_rsyslog.py
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
create: rsyslog/create.sh
|
||||
configure:
|
||||
implementation: rsyslog/config.py
|
||||
|
@ -41,7 +41,7 @@ topology_template:
|
||||
node: app_server
|
||||
relationship: tosca.relationships.HostedOn
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
create: nodejs/create.sh
|
||||
configure:
|
||||
implementation: nodejs/config.sh
|
||||
@ -59,7 +59,7 @@ topology_template:
|
||||
properties:
|
||||
dbms_port: 27017
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
create: mongodb/create.sh
|
||||
configure:
|
||||
implementation: mongodb/config.sh
|
||||
|
@ -43,7 +43,7 @@ topology_template:
|
||||
- database_endpoint:
|
||||
node: mysql_database
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
create: wordpress/wordpress_install.sh
|
||||
configure:
|
||||
implementation: wordpress/wordpress_configure.sh
|
||||
@ -66,7 +66,7 @@ topology_template:
|
||||
- host:
|
||||
node: mysql_dbms
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
configure:
|
||||
implementation: mysql/mysql_database_configure.sh
|
||||
inputs:
|
||||
@ -83,7 +83,7 @@ topology_template:
|
||||
- host:
|
||||
node: server
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
create:
|
||||
implementation: mysql/mysql_dbms_install.sh
|
||||
inputs:
|
||||
@ -100,7 +100,7 @@ topology_template:
|
||||
- host:
|
||||
node: server
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
create: webserver/webserver_install.sh
|
||||
start: webserver/webserver_start.sh
|
||||
server:
|
||||
|
@ -72,7 +72,7 @@ class ToscaTemplateTest(TestCase):
|
||||
expected_relationshp = ['tosca.relationships.HostedOn']
|
||||
expected_host = ['mysql_dbms']
|
||||
'''
|
||||
expected_interface = [ifaces.LIFECYCLE]
|
||||
expected_interface = [ifaces.LIFECYCLE_SHORTNAME]
|
||||
|
||||
for tpl in self.tosca.nodetemplates:
|
||||
if tpl_name == tpl.name:
|
||||
@ -146,13 +146,13 @@ class ToscaTemplateTest(TestCase):
|
||||
self.assertEqual(2, len(interfaces))
|
||||
for interface in interfaces:
|
||||
if interface.name == 'create':
|
||||
self.assertEqual(ifaces.LIFECYCLE,
|
||||
self.assertEqual(ifaces.LIFECYCLE_SHORTNAME,
|
||||
interface.type)
|
||||
self.assertEqual('wordpress/wordpress_install.sh',
|
||||
interface.implementation)
|
||||
self.assertIsNone(interface.inputs)
|
||||
elif interface.name == 'configure':
|
||||
self.assertEqual(ifaces.LIFECYCLE,
|
||||
self.assertEqual(ifaces.LIFECYCLE_SHORTNAME,
|
||||
interface.type)
|
||||
self.assertEqual('wordpress/wordpress_configure.sh',
|
||||
interface.implementation)
|
||||
|
@ -172,7 +172,7 @@ class ToscaTemplateValidationTest(TestCase):
|
||||
requirement:
|
||||
- host: server
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
create: mysql_dbms_install.sh
|
||||
start: mysql_dbms_start.sh
|
||||
configure:
|
||||
@ -204,7 +204,7 @@ class ToscaTemplateValidationTest(TestCase):
|
||||
requirements:
|
||||
- host: mysql_dbms
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
configure: mysql_database_configure.sh
|
||||
'''
|
||||
expectedmessage = ('Type "tosca.nodes.Databases" is not '
|
||||
@ -221,7 +221,7 @@ class ToscaTemplateValidationTest(TestCase):
|
||||
requirements:
|
||||
host: server
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
create: webserver_install.sh
|
||||
start: d.sh
|
||||
'''
|
||||
@ -247,7 +247,7 @@ class ToscaTemplateValidationTest(TestCase):
|
||||
- host: mysql_dbms
|
||||
- database_endpoint: mysql_database
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
configure: mysql_database_configure.sh
|
||||
'''
|
||||
expectedmessage = ('Requirements of template mysql_database '
|
||||
@ -273,7 +273,7 @@ class ToscaTemplateValidationTest(TestCase):
|
||||
requirements:
|
||||
- host: mysql_dbms
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
configure: mysql_database_configure.sh
|
||||
'''
|
||||
expectedmessage = ('Capabilities of template mysql_database '
|
||||
@ -319,7 +319,7 @@ class ToscaTemplateValidationTest(TestCase):
|
||||
- host: webserver
|
||||
- database_endpoint: mysql_database
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standards:
|
||||
Standards:
|
||||
create: wordpress_install.sh
|
||||
configure:
|
||||
implementation: wordpress_configure.sh
|
||||
@ -333,7 +333,7 @@ class ToscaTemplateValidationTest(TestCase):
|
||||
'''
|
||||
expectedmessage = ('Interfaces of template wordpress '
|
||||
'contain(s) unknown field: '
|
||||
'"tosca.interfaces.node.lifecycle.Standards", '
|
||||
'"Standards", '
|
||||
'refer to the definition to verify valid values.')
|
||||
self._single_node_template_content_test(tpl_snippet,
|
||||
exception.UnknownFieldError,
|
||||
@ -347,7 +347,7 @@ class ToscaTemplateValidationTest(TestCase):
|
||||
- host: webserver
|
||||
- database_endpoint: mysql_database
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
create: wordpress_install.sh
|
||||
config:
|
||||
implementation: wordpress_configure.sh
|
||||
@ -374,7 +374,7 @@ class ToscaTemplateValidationTest(TestCase):
|
||||
- host: webserver
|
||||
- database_endpoint: mysql_database
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
Standard:
|
||||
create: wordpress_install.sh
|
||||
configure:
|
||||
implementation: wordpress_configure.sh
|
||||
|
Loading…
x
Reference in New Issue
Block a user