Update TOSCA relationship valid targets

The spec has added a new keyword to represent valid target types for
TOSCA relationship as ideally it's not targets but capability types.

Change-Id: Ib2531010a9f0fc5b529c9917bbf486d99e5ea339
This commit is contained in:
spzala
2015-07-07 08:51:09 -07:00
parent 45ce5a00ee
commit 741cb2831b
4 changed files with 9 additions and 9 deletions

View File

@@ -356,15 +356,15 @@ tosca.relationships.DependsOn:
tosca.relationships.HostedOn:
derived_from: tosca.relationships.DependsOn
valid_targets: [ tosca.capabilities.Container ]
valid_target_types: [ tosca.capabilities.Container ]
tosca.relationships.ConnectsTo:
derived_from: tosca.relationships.DependsOn
valid_targets: [ tosca.capabilities.Endpoint ]
valid_target_types: [ tosca.capabilities.Endpoint ]
tosca.relationships.AttachesTo:
derived_from: tosca.relationships.Root
valid_targets: [ tosca.capabilities.Attachment ]
valid_target_types: [ tosca.capabilities.Attachment ]
properties:
location:
required: true
@@ -377,11 +377,11 @@ tosca.relationships.AttachesTo:
tosca.relationships.network.LinksTo:
derived_from: tosca.relationships.DependsOn
valid_targets: [ tosca.capabilities.network.Linkable ]
valid_target_types: [ tosca.capabilities.network.Linkable ]
tosca.relationships.network.BindsTo:
derived_from: tosca.relationships.DependsOn
valid_targets: [ tosca.capabilities.network.Bindable ]
valid_target_types: [ tosca.capabilities.network.Bindable ]
##########################################################################
# Capability Type.

View File

@@ -29,5 +29,5 @@ class RelationshipType(StatefulEntityType):
return RelationshipType(prel)
@property
def valid_targets(self):
return self.entity_value(self.defs, 'valid_targets')
def valid_target_types(self):
return self.entity_value(self.defs, 'valid_target_types')

View File

@@ -168,7 +168,7 @@ class GetAttribute(Function):
target_node = self._find_node_template(target_name)
target_type = target_node.type_definition
for capability in target_type.get_capabilities_objects():
if capability.type in hosted_on_rel['valid_targets']:
if capability.type in hosted_on_rel['valid_target_types']:
if self._attribute_exists_in_type(target_type):
return target_node
return self._find_host_containing_attribute(

View File

@@ -145,7 +145,7 @@ class ToscaDefTest(TestCase):
relation, node in component_type.relationship.items()])
self.assertIn(
('tosca.relationships.HostedOn', ['tosca.capabilities.Container']),
[(relation.type, relation.valid_targets) for
[(relation.type, relation.valid_target_types) for
relation in list(component_type.relationship.keys())])
self.assertIn(
('tosca.relationships.network.BindsTo', 'tosca.nodes.Compute'),