diff options
author | maopengzhang <zhang.maopeng1@zte.com.cn> | 2018-10-11 15:43:55 +0800 |
---|---|---|
committer | maopengzhang <zhang.maopeng1@zte.com.cn> | 2018-10-11 18:52:08 +0800 |
commit | c96c63ef6f0152118cadfe16d933ada24ac1b555 (patch) | |
tree | a49be4fbc9c33c46927c2eff22894115b8af6109 | |
parent | 1563877dcaea3458b9e3a69026df4deb5a3cfbab (diff) |
add VNFDID properties
add VNFDID properties in VNF Node of NSD and Service Descriptor
Change-Id: I915861ecce519cfe0bb376131bd5251662553eb1
Issue-ID: VFC-635
Signed-off-by: maopengzhang <zhang.maopeng1@zte.com.cn>
-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) |