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:
@@ -356,15 +356,15 @@ tosca.relationships.DependsOn:
|
|||||||
|
|
||||||
tosca.relationships.HostedOn:
|
tosca.relationships.HostedOn:
|
||||||
derived_from: tosca.relationships.DependsOn
|
derived_from: tosca.relationships.DependsOn
|
||||||
valid_targets: [ tosca.capabilities.Container ]
|
valid_target_types: [ tosca.capabilities.Container ]
|
||||||
|
|
||||||
tosca.relationships.ConnectsTo:
|
tosca.relationships.ConnectsTo:
|
||||||
derived_from: tosca.relationships.DependsOn
|
derived_from: tosca.relationships.DependsOn
|
||||||
valid_targets: [ tosca.capabilities.Endpoint ]
|
valid_target_types: [ tosca.capabilities.Endpoint ]
|
||||||
|
|
||||||
tosca.relationships.AttachesTo:
|
tosca.relationships.AttachesTo:
|
||||||
derived_from: tosca.relationships.Root
|
derived_from: tosca.relationships.Root
|
||||||
valid_targets: [ tosca.capabilities.Attachment ]
|
valid_target_types: [ tosca.capabilities.Attachment ]
|
||||||
properties:
|
properties:
|
||||||
location:
|
location:
|
||||||
required: true
|
required: true
|
||||||
@@ -377,11 +377,11 @@ tosca.relationships.AttachesTo:
|
|||||||
|
|
||||||
tosca.relationships.network.LinksTo:
|
tosca.relationships.network.LinksTo:
|
||||||
derived_from: tosca.relationships.DependsOn
|
derived_from: tosca.relationships.DependsOn
|
||||||
valid_targets: [ tosca.capabilities.network.Linkable ]
|
valid_target_types: [ tosca.capabilities.network.Linkable ]
|
||||||
|
|
||||||
tosca.relationships.network.BindsTo:
|
tosca.relationships.network.BindsTo:
|
||||||
derived_from: tosca.relationships.DependsOn
|
derived_from: tosca.relationships.DependsOn
|
||||||
valid_targets: [ tosca.capabilities.network.Bindable ]
|
valid_target_types: [ tosca.capabilities.network.Bindable ]
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# Capability Type.
|
# Capability Type.
|
||||||
|
|||||||
@@ -29,5 +29,5 @@ class RelationshipType(StatefulEntityType):
|
|||||||
return RelationshipType(prel)
|
return RelationshipType(prel)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def valid_targets(self):
|
def valid_target_types(self):
|
||||||
return self.entity_value(self.defs, 'valid_targets')
|
return self.entity_value(self.defs, 'valid_target_types')
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ class GetAttribute(Function):
|
|||||||
target_node = self._find_node_template(target_name)
|
target_node = self._find_node_template(target_name)
|
||||||
target_type = target_node.type_definition
|
target_type = target_node.type_definition
|
||||||
for capability in target_type.get_capabilities_objects():
|
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):
|
if self._attribute_exists_in_type(target_type):
|
||||||
return target_node
|
return target_node
|
||||||
return self._find_host_containing_attribute(
|
return self._find_host_containing_attribute(
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ class ToscaDefTest(TestCase):
|
|||||||
relation, node in component_type.relationship.items()])
|
relation, node in component_type.relationship.items()])
|
||||||
self.assertIn(
|
self.assertIn(
|
||||||
('tosca.relationships.HostedOn', ['tosca.capabilities.Container']),
|
('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())])
|
relation in list(component_type.relationship.keys())])
|
||||||
self.assertIn(
|
self.assertIn(
|
||||||
('tosca.relationships.network.BindsTo', 'tosca.nodes.Compute'),
|
('tosca.relationships.network.BindsTo', 'tosca.nodes.Compute'),
|
||||||
|
|||||||
Reference in New Issue
Block a user