Merge "Update TOSCA interfaces naming"

This commit is contained in:
Jenkins
2015-02-19 23:41:23 +00:00
committed by Gerrit Code Review
18 changed files with 48 additions and 44 deletions

View File

@@ -24,7 +24,7 @@
tosca.nodes.Root:
description: >
The TOSCA root node all other TOSCA base node types derive from.
interfaces: [ tosca.interfaces.node.Lifecycle ]
interfaces: [ tosca.interfaces.node.lifecycle.Standard ]
tosca.nodes.Compute:
derived_from: tosca.nodes.Root
@@ -272,17 +272,17 @@ tosca.capabilities.Attachment:
# definitions for a modelable entity (e.g., a Node or Relationship Type)
# as defined within the TOSCA Simple Profile specification.
##########################################################################
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
create:
description: Basic lifecycle create operation.
description: Standard lifecycle create operation.
configure:
description: Basic lifecycle configure operation.
description: Standard lifecycle configure operation.
start:
description: Basic lifecycle start operation.
description: Standard lifecycle start operation.
stop:
description: Basic lifecycle stop operation.
description: Standard lifecycle stop operation.
delete:
description: Basic lifecycle delete operation.
description: Standard lifecycle delete operation.
tosca.interfaces.relationship.Configure:
pre_configure_source:

View File

@@ -14,7 +14,7 @@ from translator.toscalib.common.exception import UnknownFieldError
from translator.toscalib.elements.statefulentitytype import StatefulEntityType
SECTIONS = (LIFECYCLE, CONFIGURE) = \
('tosca.interfaces.node.Lifecycle',
('tosca.interfaces.node.lifecycle.Standard',
'tosca.interfaces.relationship.Configure')
INTERFACEVALUE = (IMPLEMENTATION, INPUTS) = ('implementation', 'inputs')

View File

@@ -11,6 +11,7 @@
# under the License.
from translator.toscalib.elements.capabilitytype import CapabilityTypeDef
import translator.toscalib.elements.interfaces as ifaces
from translator.toscalib.elements.interfaces import InterfacesDef
from translator.toscalib.elements.relationshiptype import RelationshipType
from translator.toscalib.elements.statefulentitytype import StatefulEntityType
@@ -138,7 +139,7 @@ class NodeType(StatefulEntityType):
interfaces = self.interfaces
if interfaces:
for name, value in interfaces.items():
if name == 'tosca.interfaces.node.Lifecycle':
if name == ifaces.LIFECYCLE:
for x, y in value.items():
if x == 'inputs':
for i in y.iterkeys():
@@ -151,7 +152,7 @@ class NodeType(StatefulEntityType):
ops = None
interfaces = self.interfaces
if interfaces:
i = InterfacesDef(self.type, 'tosca.interfaces.node.Lifecycle')
i = InterfacesDef(self.type, ifaces.LIFECYCLE)
ops = i.lifecycle_ops
return ops

View File

@@ -35,7 +35,7 @@ node_templates:
- host: webserver
- database_endpoint: mysql_database
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
create: Scripts/WordPress/install.sh
configure:
implementation: Scripts/WordPress/configure.sh
@@ -53,7 +53,7 @@ node_templates:
requirements:
- host: mysql_dbms
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
configure:
implementation: Scripts/MYSQLDatabase/configure.sh
inputs:
@@ -70,7 +70,7 @@ node_templates:
requirements:
- host: server
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
create: Scripts/MYSQLDBMS/install.sh
start: Scripts/MYSQLDBMS/start.sh
configure:
@@ -83,7 +83,7 @@ node_templates:
requirements:
- host: server
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
create: Scripts/WebServer/install.sh
start: Scripts/WebServer/start.sh

View File

@@ -13,7 +13,7 @@ node_types:
requirements:
- database_endpoint: tosca.nodes.Database
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
inputs:
db_port:
type: integer

View File

@@ -23,7 +23,7 @@ node_types:
port:
type: integer
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
inputs:
github_url:
type: string

View File

@@ -16,7 +16,7 @@ node_types:
requirements:
- database_endpoint: tosca.nodes.Database
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
inputs:
db_host:
type: string

View File

@@ -14,7 +14,7 @@ node_templates:
requirements:
- host: server
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
configure:
implementation: configure.sh
inputs:
@@ -25,7 +25,7 @@ node_templates:
requirements:
- host: dbms
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
configure:
implementation: configure.sh
inputs:

View File

@@ -9,7 +9,7 @@ node_templates:
properties:
os_type: Linux
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
configure:
implementation: configure.sh
inputs:

View File

@@ -14,7 +14,7 @@ node_templates:
properties:
os_type: Linux
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
configure:
implementation: start_server.sh
inputs:

View File

@@ -14,7 +14,7 @@ node_templates:
properties:
os_type: Linux
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
configure:
implementation: start_server.sh
inputs:

View File

@@ -28,7 +28,7 @@ node_templates:
requirements:
- host: dbms
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
configure:
implementation: database_configure.sh
inputs:

View File

@@ -10,7 +10,7 @@ node_templates:
properties:
os_type: Linux
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
configure:
implementation: start_server.sh
inputs:

View File

@@ -70,7 +70,7 @@ node_templates:
host: { get_attribute: [ TARGET, ip_address ] }
port: { get_property: [ mongo_dbms, dbms_port ] }
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
create: nodejs/create.sh
configure:
implementation: nodejs/config.sh
@@ -88,7 +88,7 @@ node_templates:
properties:
dbms_port: 27017
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
create: mongodb/create.sh
configure: mongodb/config.sh
start: mongodb/start.sh
@@ -120,7 +120,7 @@ node_templates:
host: { get_attribute: [ TARGET, ip_address ] }
port: { get_attribute: [ TARGET, port ] }
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
create: lostash/create.sh
configure: logstash/config.sh
start: logstash/start.sh

View File

@@ -35,7 +35,7 @@ node_templates:
- host: webserver
- database_endpoint: mysql_database
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
create: wordpress_install.sh
configure:
implementation: wordpress_configure.sh
@@ -58,7 +58,7 @@ node_templates:
requirements:
- host: mysql_dbms
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
configure:
implementation: mysql_database_configure.sh
inputs:
@@ -72,7 +72,7 @@ node_templates:
requirements:
- host: server
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
create: mysql_dbms_install.sh
start: mysql_dbms_start.sh
configure:
@@ -86,7 +86,7 @@ node_templates:
requirements:
- host: server
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
create: webserver_install.sh
start: webserver_start.sh

View File

@@ -11,8 +11,10 @@
# under the License.
from translator.toscalib.common import exception
import translator.toscalib.elements.interfaces as ifaces
from translator.toscalib.elements.nodetype import NodeType
from translator.toscalib.tests.base import TestCase
compute_type = NodeType('tosca.nodes.Compute')
component_type = NodeType('tosca.nodes.SoftwareComponent')
@@ -63,4 +65,4 @@ class ToscaDefTest(TestCase):
def test_interfaces(self):
self.assertEqual(compute_type.interfaces, None)
root_node = NodeType('tosca.nodes.Root')
self.assertIn('tosca.interfaces.node.Lifecycle', root_node.interfaces)
self.assertIn(ifaces.LIFECYCLE, root_node.interfaces)

View File

@@ -12,6 +12,7 @@
import os
import translator.toscalib.elements.interfaces as ifaces
from translator.toscalib.elements.nodetype import NodeType
from translator.toscalib.functions import GetInput
from translator.toscalib.functions import GetProperty
@@ -67,7 +68,7 @@ class ToscaTemplateTest(TestCase):
expected_requirements = [{'host': 'mysql_dbms'}]
expected_relationshp = ['tosca.relationships.HostedOn']
expected_host = ['mysql_dbms']
expected_interface = ['tosca.interfaces.node.Lifecycle']
expected_interface = [ifaces.LIFECYCLE]
for tpl in self.tosca.nodetemplates:
if tpl_name == tpl.name:
@@ -120,13 +121,13 @@ class ToscaTemplateTest(TestCase):
self.assertEqual(2, len(interfaces))
for interface in interfaces:
if interface.name == 'create':
self.assertEqual('tosca.interfaces.node.Lifecycle',
self.assertEqual(ifaces.LIFECYCLE,
interface.type)
self.assertEqual('wordpress_install.sh',
interface.implementation)
self.assertIsNone(interface.inputs)
elif interface.name == 'configure':
self.assertEqual('tosca.interfaces.node.Lifecycle',
self.assertEqual(ifaces.LIFECYCLE,
interface.type)
self.assertEqual('wordpress_configure.sh',
interface.implementation)

View File

@@ -169,7 +169,7 @@ class ToscaTemplateValidationTest(TestCase):
requirement:
- host: server
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
create: mysql_dbms_install.sh
start: mysql_dbms_start.sh
configure:
@@ -201,7 +201,7 @@ class ToscaTemplateValidationTest(TestCase):
requirements:
- host: mysql_dbms
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
configure: mysql_database_configure.sh
'''
expectedmessage = ('Type "tosca.nodes.Databases" is not '
@@ -218,7 +218,7 @@ class ToscaTemplateValidationTest(TestCase):
requirements:
host: server
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
create: webserver_install.sh
start: d.sh
'''
@@ -244,7 +244,7 @@ class ToscaTemplateValidationTest(TestCase):
- host: mysql_dbms
- database_endpoint: mysql_database
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
configure: mysql_database_configure.sh
'''
expectedmessage = ('Requirements of template mysql_database '
@@ -270,7 +270,7 @@ class ToscaTemplateValidationTest(TestCase):
requirements:
- host: mysql_dbms
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
configure: mysql_database_configure.sh
'''
expectedmessage = ('Capabilities of template mysql_database '
@@ -334,7 +334,7 @@ class ToscaTemplateValidationTest(TestCase):
- host: webserver
- database_endpoint: mysql_database
interfaces:
tosca.interfaces.node.Lifecycles:
tosca.interfaces.node.lifecycle.Standards:
create: wordpress_install.sh
configure:
implementation: wordpress_configure.sh
@@ -348,7 +348,7 @@ class ToscaTemplateValidationTest(TestCase):
'''
expectedmessage = ('Interfaces of template wordpress '
'contain(s) unknown field: '
'"tosca.interfaces.node.Lifecycles", '
'"tosca.interfaces.node.lifecycle.Standards", '
'refer to the definition to verify valid values.')
self._single_node_template_content_test(tpl_snippet,
exception.UnknownFieldError,
@@ -362,7 +362,7 @@ class ToscaTemplateValidationTest(TestCase):
- host: webserver
- database_endpoint: mysql_database
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
create: wordpress_install.sh
config:
implementation: wordpress_configure.sh
@@ -389,7 +389,7 @@ class ToscaTemplateValidationTest(TestCase):
- host: webserver
- database_endpoint: mysql_database
interfaces:
tosca.interfaces.node.Lifecycle:
tosca.interfaces.node.lifecycle.Standard:
create: wordpress_install.sh
configure:
implementation: wordpress_configure.sh