aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFu Jinhua <fu.jinhua@zte.com.cn>2018-10-11 11:43:43 +0000
committerGerrit Code Review <gerrit@onap.org>2018-10-11 11:43:43 +0000
commit52420611e4993f1fecaeb2fa85d84bef23d282b6 (patch)
tree9ee3912fa1bc7db0b0417e6a98e2d9c0c7000009
parentd1e5789d2a49b2a4364296d97f1f66f61c0c9839 (diff)
parentc96c63ef6f0152118cadfe16d933ada24ac1b555 (diff)
Merge "add VNFDID properties"
-rw-r--r--catalog/pub/utils/toscaparser/nsdmodel.py6
-rw-r--r--catalog/pub/utils/toscaparser/servicemodel.py6
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)