diff --git a/toscaparser/elements/capabilitytype.py b/toscaparser/elements/capabilitytype.py index dc36dd86..a3afa0e5 100644 --- a/toscaparser/elements/capabilitytype.py +++ b/toscaparser/elements/capabilitytype.py @@ -66,10 +66,10 @@ class CapabilityTypeDef(StatefulEntityType): if parent_cap: parent_cap = parent_cap.type while parent_cap != self.TOSCA_TYPEURI_CAPABILITY_ROOT: - if parent_cap in self.TOSCA_DEF.keys(): - capabilities[parent_cap] = self.TOSCA_DEF[parent_cap] - elif custom_def and parent_cap in custom_def.keys(): + if custom_def and parent_cap in custom_def.keys(): capabilities[parent_cap] = custom_def[parent_cap] + elif parent_cap in self.TOSCA_DEF.keys(): + capabilities[parent_cap] = self.TOSCA_DEF[parent_cap] parent_cap = capabilities[parent_cap]['derived_from'] return capabilities diff --git a/toscaparser/elements/relationshiptype.py b/toscaparser/elements/relationshiptype.py index 50ecd4a1..3419804f 100644 --- a/toscaparser/elements/relationshiptype.py +++ b/toscaparser/elements/relationshiptype.py @@ -35,11 +35,22 @@ class RelationshipType(StatefulEntityType): '''Return a relationship this reletionship is derived from.''' prel = self.derived_from(self.defs) if prel: - return RelationshipType(prel, self.custom_def) + return RelationshipType(prel, custom_def=self.custom_def) @property def interfaces(self): - return self.get_value(self.INTERFACES) + interfaces = self.get_value(self.INTERFACES) + + if self.parent_type is not None: + if self.parent_type.interfaces is not None: + import copy + parent_interfaces = copy.deepcopy(self.parent_type.interfaces) + + if parent_interfaces: + if interfaces: + parent_interfaces.update(interfaces) + interfaces = parent_interfaces + return interfaces @property def valid_target_types(self):