Add parent interfaces to the list of NodeType interfaces
Change-Id: Ia957ad11985a3b6665f0015d17dacfd79a1a3d95 Closes-Bug: #1883563
This commit is contained in:
parent
b43f595fd3
commit
9f575be0ea
@ -169,7 +169,23 @@ class NodeType(StatefulEntityType):
|
||||
|
||||
@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)
|
||||
parent_interfaces.pop(ifaces.LIFECYCLE, None)
|
||||
parent_interfaces.pop(ifaces.CONFIGURE, None)
|
||||
parent_interfaces.pop(ifaces.LIFECYCLE_SHORTNAME, None)
|
||||
parent_interfaces.pop(ifaces.CONFIGURE_SHORTNAME, None)
|
||||
|
||||
if parent_interfaces:
|
||||
if interfaces:
|
||||
parent_interfaces.update(interfaces)
|
||||
interfaces = parent_interfaces
|
||||
|
||||
return interfaces
|
||||
|
||||
@property
|
||||
def lifecycle_inputs(self):
|
||||
|
@ -264,16 +264,20 @@ class NodeTemplate(EntityTemplate):
|
||||
value, InterfacesDef.
|
||||
interfaces_relationship_configure_operations,
|
||||
'interfaces')
|
||||
elif name in self.type_definition.interfaces.keys():
|
||||
self._common_validate_field(
|
||||
value,
|
||||
self._collect_custom_iface_operations(name),
|
||||
'interfaces')
|
||||
else:
|
||||
ExceptionCollector.appendException(
|
||||
UnknownFieldError(
|
||||
what='"interfaces" of template "%s"' %
|
||||
self.name, field=name))
|
||||
interfaces = self.type_definition.interfaces
|
||||
if interfaces is None:
|
||||
interfaces = dict()
|
||||
if name in interfaces.keys():
|
||||
self._common_validate_field(
|
||||
value,
|
||||
self._collect_custom_iface_operations(name),
|
||||
'interfaces')
|
||||
else:
|
||||
ExceptionCollector.appendException(
|
||||
UnknownFieldError(
|
||||
what='"interfaces" of template "%s"' %
|
||||
self.name, field=name))
|
||||
|
||||
def _collect_custom_iface_operations(self, name):
|
||||
allowed_operations = []
|
||||
|
Loading…
x
Reference in New Issue
Block a user