diff options
author | 2017-10-17 14:44:39 +0800 | |
---|---|---|
committer | 2017-10-17 14:44:39 +0800 | |
commit | e5207f9539bbbe54cb26344af69a58521cbcdec3 (patch) | |
tree | b57631d1e5ecf0125f1b1c4518fd133474d27a57 | |
parent | 9f0fea639066a4db876776c0a81edd26bc0becc0 (diff) |
Fix vfc-catalog parse ns package bugs
Change-Id: I921b8b06b60c2481e433dde7b19693af170a61d9
Issue-ID: VFC-537
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r-- | catalog/pub/utils/toscaparser/basemodel.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/catalog/pub/utils/toscaparser/basemodel.py b/catalog/pub/utils/toscaparser/basemodel.py index 91dfc7d8..1b28b598 100644 --- a/catalog/pub/utils/toscaparser/basemodel.py +++ b/catalog/pub/utils/toscaparser/basemodel.py @@ -60,17 +60,22 @@ class BaseInfoModel(object): def _create_tosca_template(self, file_name, valid_params): tosca_tpl = None try: - tosca_tpl = ToscaTemplate(file_name, valid_params) - print "-----------------------------" - print '\n'.join(['%s:%s' % item for item in tosca_tpl.__dict__.items()]) - print "-----------------------------" - return tosca_tpl + tosca_tpl = ToscaTemplate(path=file_name, + parsed_params=valid_params, + no_required_paras_check=True, + debug_mode=True) + except Exception as e: + print e.message finally: if tosca_tpl is not None and hasattr(tosca_tpl, "temp_dir") and os.path.exists(tosca_tpl.temp_dir): try: shutil.rmtree(tosca_tpl.temp_dir) except Exception as e: logger.error("Failed to create tosca template, error: %s", e.message) + print "-----------------------------" + print '\n'.join(['%s:%s' % item for item in tosca_tpl.__dict__.items()]) + print "-----------------------------" + return tosca_tpl def _check_download_file(self, path): if (path.startswith("ftp") or path.startswith("sftp")): @@ -148,6 +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'] def buildProperties(self, nodeTemplate, parsed_params): properties = {} @@ -217,7 +223,8 @@ class BaseInfoModel(object): return None def isVnf(self, node): - return node['nodeType'].upper().find('.VNF.') >= 0 or node['nodeType'].upper().endswith('.VNF') + # return node['nodeType'].upper().find('.VNF.') >= 0 or node['nodeType'].upper().endswith('.VNF') + return node['nodeType'].upper().find('.VF.') >= 0 or node['nodeType'].upper().endswith('.VF') def isPnf(self, node): return node['nodeType'].upper().find('.PNF.') >= 0 or node['nodeType'].upper().endswith('.PNF') |