X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=genericparser%2Fpub%2Futils%2Ftoscaparsers%2Fbasemodel.py;h=2b21456a7d721bb55c91fd49532b70d9537fd55c;hb=e7310fb508784f72f54fbad5762cec67b134241b;hp=a5c1f452d23b1ec451046566dba7c5525b25d824;hpb=0cd4e54ded5de005d5480d5b0d85535c1462b8eb;p=modeling%2Fetsicatalog.git diff --git a/genericparser/pub/utils/toscaparsers/basemodel.py b/genericparser/pub/utils/toscaparsers/basemodel.py index a5c1f45..2b21456 100644 --- a/genericparser/pub/utils/toscaparsers/basemodel.py +++ b/genericparser/pub/utils/toscaparsers/basemodel.py @@ -515,10 +515,23 @@ class BaseInfoModel(object): metadata = None substitution_mappings = tosca.tpl['topology_template'].get('substitution_mappings', None) if substitution_mappings: - node['type'] = substitution_mappings['node_type'] - node['properties'] = substitution_mappings.get('properties', {}) - node['requirements'] = substitution_mappings.get('requirements', {}) - node['capabilities'] = substitution_mappings.get('capabilities', {}) - metadata = substitution_mappings.get('metadata', {}) + nodeType = substitution_mappings['node_type'] + logger.debug("nodeType %s", nodeType) + if "node_types" in tosca.tpl: + node_types = tosca.tpl['node_types'].get(nodeType, None) + derivedFrom = node_types.get('derived_from', "") + node['type'] = derivedFrom + node['properties'] = node_types.get('properties', {}) + node['requirements'] = node_types.get('requirements', {}) + node['capabilities'] = node_types.get('capabilities', {}) + metadata = node_types.get('metadata', {}) + + if "type" not in node or node['type'] == "": + node['type'] = nodeType + node['properties'] = substitution_mappings.get('properties', {}) + node['requirements'] = substitution_mappings.get('requirements', {}) + node['capabilities'] = substitution_mappings.get('capabilities', {}) + metadata = substitution_mappings.get('metadata', {}) + node['metadata'] = metadata if metadata and metadata != {} else self.buildMetadata(tosca) return node