X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=lcm%2Flcm%2Fnf%2Fbiz%2Finstantiate_vnf.py;h=58ca591bbb4f91d4a941d73a172ad8245d1006b1;hb=da7fa99b4472a891d9e0ab16e0224acdc4f63e8e;hp=0ecd95e1f08dbb102bba8700e516d4413a5bde46;hpb=19d668976f82fba24a39d064d29f9f9034638bd3;p=vfc%2Fgvnfm%2Fvnflcm.git diff --git a/lcm/lcm/nf/biz/instantiate_vnf.py b/lcm/lcm/nf/biz/instantiate_vnf.py index 0ecd95e1..58ca591b 100644 --- a/lcm/lcm/nf/biz/instantiate_vnf.py +++ b/lcm/lcm/nf/biz/instantiate_vnf.py @@ -59,10 +59,10 @@ class InstantiateVnf(Thread): operation=OPERATION_TYPE.INSTANTIATE, task=OPERATION_TASK.INSTANTIATE ) - self.pre_deal() def run(self): try: + self.pre_deal() self.inst_pre() self.lcm_op_occ.notify_lcm(OPERATION_STATE_TYPE.STARTING) self.apply_grant() @@ -83,9 +83,11 @@ class InstantiateVnf(Thread): operation_state=OPERATION_STATE_TYPE.COMPLETED ) except NFLCMException as e: - self.vnf_inst_failed_handle(e.message) + self.vnf_inst_failed_handle(e.args[0]) + except NFLCMExceptionConflict as e: + self.vnf_inst_failed_handle(e.args[0]) except Exception as e: - logger.error(e.message) + logger.error(str(e)) logger.error(traceback.format_exc()) self.vnf_inst_failed_handle('unexpected exception') @@ -113,9 +115,9 @@ class InstantiateVnf(Thread): input_parameters = [] inputs = ignore_case_get(self.data, "additionalParams") if inputs: - if isinstance(inputs, (str, unicode)): + if isinstance(inputs, str): inputs = json.loads(inputs) - for key, val in inputs.items(): + for key, val in list(inputs.items()): input_parameters.append({"key": key, "value": val}) vnf_package = query_vnfpackage_by_id(self.vnfd_id) pkg_info = ignore_case_get(vnf_package, "packageInfo") @@ -198,7 +200,7 @@ class InstantiateVnf(Thread): resp = notify_lcm_to_nfvo(json.dumps(notification_content)) logger.info('Lcm notify end, response %s' % resp) except Exception as e: - logger.error("Lcm instantiate notify failed: %s", e.message) + logger.error("Lcm instantiate notify failed: %s", e.args[0]) NotificationsUtil().send_notification(notification_content) def vnf_inst_failed_handle(self, error_msg):