aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-10-25 16:03:42 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2017-10-25 16:15:23 +0800
commit2a138a6604bee099ea9e2f698c36a7260957aa78 (patch)
tree5acaf1a829db1120bbe8d90c9f19feba31595a18
parent49723a6d6cecbbb4812f377e19bc924c138d1831 (diff)
Fix catalog parse ns bug
Change-Id: I66235fa0796942c0011bd6525e9f0629cbf9263d Issue-ID: VFC-553 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r--catalog/pub/utils/toscaparser/basemodel.py2
-rw-r--r--catalog/pub/utils/toscaparser/nsdmodel.py9
-rw-r--r--tox.ini2
3 files changed, 9 insertions, 4 deletions
diff --git a/catalog/pub/utils/toscaparser/basemodel.py b/catalog/pub/utils/toscaparser/basemodel.py
index 1b28b598..83d17ee3 100644
--- a/catalog/pub/utils/toscaparser/basemodel.py
+++ b/catalog/pub/utils/toscaparser/basemodel.py
@@ -153,7 +153,7 @@ class BaseInfoModel(object):
def buidMetadata(self, tosca):
if 'metadata' in tosca.tpl:
self.metadata = copy.deepcopy(tosca.tpl['metadata'])
- self.metadata['id'] = tosca.tpl['metadata']['invariantUUID']
+ self.metadata['id'] = tosca.tpl['metadata']['UUID']
def buildProperties(self, nodeTemplate, parsed_params):
properties = {}
diff --git a/catalog/pub/utils/toscaparser/nsdmodel.py b/catalog/pub/utils/toscaparser/nsdmodel.py
index 46162326..47a05f09 100644
--- a/catalog/pub/utils/toscaparser/nsdmodel.py
+++ b/catalog/pub/utils/toscaparser/nsdmodel.py
@@ -63,6 +63,10 @@ class EtsiNsdInfoModel(BaseInfoModel):
ret['description'] = nodeTemplate.entity_tpl['description']
else:
ret['description'] = ''
+ if 'metadata' in nodeTemplate.entity_tpl:
+ ret['metadata'] = nodeTemplate.entity_tpl['metadata']
+ else:
+ ret['metadata'] = ''
props = self.buildProperties(nodeTemplate, parsed_params)
ret['properties'] = self.verify_properties(props, inputs, parsed_params)
ret['requirements'] = self.build_requirements(nodeTemplate)
@@ -81,11 +85,12 @@ class EtsiNsdInfoModel(BaseInfoModel):
vnf['vnf_id'] = node['name']
vnf['description'] = node['description']
vnf['properties'] = node['properties']
+ vnf['properties']['id'] = node['metadata'].get('UUID', 'undefined')
for key in vnf['properties'].iterkeys():
if key.endswith('_version'):
vnf['properties'].update(version=vnf['properties'].pop(key))
- if key.endswith('_id'):
- vnf['properties'].update(id=vnf['properties'].pop(key))
+ # if key.endswith('_id'):
+ # vnf['properties'].update(id=vnf['properties'].pop(key))
if key.endswith('_csarProvider'):
vnf['properties'].update(csarProvider=vnf['properties'].pop(key))
if key.endswith('_csarVersion'):
diff --git a/tox.ini b/tox.ini
index a45ee898..7facc7ce 100644
--- a/tox.ini
+++ b/tox.ini
@@ -6,7 +6,7 @@ skipsdist = true
downloadcache = ~/cache/pip
[flake8]
-ignore = E501
+ignore = E501,E722
exclude = ./venv-tox,./.tox
[testenv]