aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-10-17 09:31:27 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2017-10-17 09:31:27 +0800
commitff647e1bf572372f7eaf999ddafd0293339dbcee (patch)
tree35871a58d49572f908fb9302d31cc46ee6043d2e
parentd695cdf0bae15732beefc78e641924134fcfc898 (diff)
Fix vfc-lcm parse ns package bugs
Change-Id: If82ca9d999f834bb136aab2cbc38b9b158dd7931 Issue-ID: VFC-537 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r--lcm/pub/utils/toscaparser/basemodel.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/lcm/pub/utils/toscaparser/basemodel.py b/lcm/pub/utils/toscaparser/basemodel.py
index b80b275f..461e8e11 100644
--- a/lcm/pub/utils/toscaparser/basemodel.py
+++ b/lcm/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:
+ except Exception, 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")):
@@ -217,7 +222,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')