Merge "Update TOSCA relationship valid targets"

This commit is contained in:
Jenkins 2015-07-07 23:30:32 +00:00 committed by Gerrit Code Review
commit 13ea12f06a
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'),