diff options
-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) |