diff options
author | Fu Jinhua <fu.jinhua@zte.com.cn> | 2018-10-11 11:43:43 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-10-11 11:43:43 +0000 |
commit | 52420611e4993f1fecaeb2fa85d84bef23d282b6 (patch) | |
tree | 9ee3912fa1bc7db0b0417e6a98e2d9c0c7000009 | |
parent | d1e5789d2a49b2a4364296d97f1f66f61c0c9839 (diff) | |
parent | c96c63ef6f0152118cadfe16d933ada24ac1b555 (diff) |
Merge "add VNFDID properties"
-rw-r--r-- | catalog/pub/utils/toscaparser/nsdmodel.py | 6 | ||||
-rw-r--r-- | catalog/pub/utils/toscaparser/servicemodel.py | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/catalog/pub/utils/toscaparser/nsdmodel.py b/catalog/pub/utils/toscaparser/nsdmodel.py index 22a75b94..03133861 100644 --- a/catalog/pub/utils/toscaparser/nsdmodel.py +++ b/catalog/pub/utils/toscaparser/nsdmodel.py @@ -57,8 +57,10 @@ class EtsiNsdInfoModel(BaseInfoModel): vnf['vnf_id'] = node['name'] vnf['description'] = node['description'] vnf['properties'] = node['properties'] - if node['metadata']: - vnf['properties']['id'] = node['metadata'].get('UUID', 'undefined') + if not vnf['properties'].get('id', None): + vnf['properties']['id'] = vnf['properties'].get('descriptor_id', None) + if not vnf['properties'].get('id', None) and node['metadata']: + vnf['properties']['id'] = node['metadata'].get('UUID', None) vnf['dependencies'] = self._get_networks(node, node_types) vnf['networks'] = self._get_networks(node, node_types) vnfs.append(vnf) diff --git a/catalog/pub/utils/toscaparser/servicemodel.py b/catalog/pub/utils/toscaparser/servicemodel.py index bccd417d..bc530ad9 100644 --- a/catalog/pub/utils/toscaparser/servicemodel.py +++ b/catalog/pub/utils/toscaparser/servicemodel.py @@ -98,8 +98,10 @@ class SdcServiceModel(BaseInfoModel): if self.isNodeTypeX(node, node_types, VF_TYPE): vnf = {} self.setTargetValues(vnf, VNF_SECTIONS, node, SDC_VF_SECTIONS) - if node['metadata']: - vnf['properties']['id'] = node['metadata'].get('UUID', 'undefined') + if not vnf['properties'].get('id', None): + vnf['properties']['id'] = vnf['properties'].get('descriptor_id', None) + if not vnf['properties'].get('id', None) and node['metadata']: + vnf['properties']['id'] = node['metadata'].get('UUID', None) vnf['dependencies'] = self._get_networks(node, node_types) vnf['networks'] = self._get_networks(node, node_types) vnfs.append(vnf) |