diff options
author | 2017-10-19 14:58:06 +0800 | |
---|---|---|
committer | 2017-10-19 14:58:06 +0800 | |
commit | 556fb2a46374005e835dd717ca4f3e96053ee2e2 (patch) | |
tree | 85968594f6832b84d789c746d5d9d7c40547cc13 | |
parent | a851bdb93648e5e9935fd119498a1b3d80064de2 (diff) |
Fix vfc-catalog parse ns/vnf bugs
Change-Id: I569444d3292bc289f03caaf9940ae2d749ce846e
Issue-ID: VFC-543
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r-- | catalog/pub/utils/toscaparser/nsdmodel.py | 15 | ||||
-rw-r--r-- | catalog/pub/utils/toscaparser/vnfdmodel.py | 6 |
2 files changed, 21 insertions, 0 deletions
diff --git a/catalog/pub/utils/toscaparser/nsdmodel.py b/catalog/pub/utils/toscaparser/nsdmodel.py index 6c12ad64..46162326 100644 --- a/catalog/pub/utils/toscaparser/nsdmodel.py +++ b/catalog/pub/utils/toscaparser/nsdmodel.py @@ -81,6 +81,21 @@ class EtsiNsdInfoModel(BaseInfoModel): vnf['vnf_id'] = node['name'] vnf['description'] = node['description'] vnf['properties'] = node['properties'] + 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('_csarProvider'): + vnf['properties'].update(csarProvider=vnf['properties'].pop(key)) + if key.endswith('_csarVersion'): + vnf['properties'].update(csarVersion=vnf['properties'].pop(key)) + if key.endswith('_vendor'): + vnf['properties'].update(vendor=vnf['properties'].pop(key)) + if key.endswith('_csarType'): + vnf['properties'].update(csarType=vnf['properties'].pop(key)) + if key.endswith('_vnfm_type') or key.endswith('_vnfmType'): + vnf['properties'].update(vnfmType=vnf['properties'].pop(key)) vnf['dependencies'] = map(lambda x: self.get_requirement_node_name(x), self.getNodeDependencys(node)) vnf['networks'] = self.get_networks(node) diff --git a/catalog/pub/utils/toscaparser/vnfdmodel.py b/catalog/pub/utils/toscaparser/vnfdmodel.py index 80722f7f..84be93fb 100644 --- a/catalog/pub/utils/toscaparser/vnfdmodel.py +++ b/catalog/pub/utils/toscaparser/vnfdmodel.py @@ -30,6 +30,12 @@ class EtsiVnfdInfoModel(EtsiNsdInfoModel): nodeTemplates = map(functools.partial(self.buildNode, inputs=tosca.inputs, parsed_params=tosca.parsed_params), tosca.nodetemplates) + # convert property info to metadata + properties = nodeTemplates[0]['properties'] + self.metadata['vnfdVersion'] = properties.get('csarVersion', 'undefined') + self.metadata['vendor'] = properties.get('vendor', 'undefined') + self.metadata['version'] = properties.get('version', 'version') + self.services = self._get_all_services(nodeTemplates) self.vcloud = self._get_all_vcloud(nodeTemplates) self.vcenter = self._get_all_vcenter(nodeTemplates) |