X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=catalog%2Fpub%2Futils%2Ftoscaparser%2Fbasemodel.py;fp=genericparser%2Fpub%2Futils%2Ftoscaparsers%2Fbasemodel.py;h=6ed26aa64dcac39742c811013af9b01bb030b0d2;hb=a32c2b20207885d895bd96204cc166fca14db97b;hp=643041dd84dcf377994bec53f1a488ec953b8ec5;hpb=431a5a35a8e0a26d21c663167303696db8a7a2a6;p=modeling%2Fetsicatalog.git diff --git a/genericparser/pub/utils/toscaparsers/basemodel.py b/catalog/pub/utils/toscaparser/basemodel.py similarity index 98% rename from genericparser/pub/utils/toscaparsers/basemodel.py rename to catalog/pub/utils/toscaparser/basemodel.py index 643041d..6ed26aa 100644 --- a/genericparser/pub/utils/toscaparsers/basemodel.py +++ b/catalog/pub/utils/toscaparser/basemodel.py @@ -24,9 +24,9 @@ import urllib from toscaparser.tosca_template import ToscaTemplate from toscaparser.properties import Property from toscaparser.functions import Function, Concat, GetInput, get_function, function_mappings -from genericparser.pub.utils.toscaparsers.graph import Graph +from catalog.pub.utils.toscaparser.graph import Graph -from genericparser.pub.utils.toscaparsers.dataentityext import DataEntityExt +from catalog.pub.utils.toscaparser.dataentityext import DataEntityExt logger = logging.getLogger(__name__) @@ -517,15 +517,6 @@ class BaseInfoModel(object): if substitution_mappings: 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', {}) @@ -533,5 +524,11 @@ class BaseInfoModel(object): node['capabilities'] = substitution_mappings.get('capabilities', {}) metadata = substitution_mappings.get('metadata', {}) + 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['metadata'] = metadata if metadata and metadata != {} else self.buildMetadata(tosca) return node