resp_data, resp_status = create_ns_aai(self.global_customer_id, self.service_type, self.ns_inst_id, data)
logger.debug("Success to create ns[%s] to aai:[%s],[%s].", self.ns_inst_id, resp_data, resp_status)
except NSLCMException as e:
- logger.debug("Fail to createns[%s] to aai, detail message: %s" % (self.ns_inst_id, e.message))
+ logger.debug("Fail to createns[%s] to aai, detail message: %s" % (self.ns_inst_id, e.args[0]))
except:
logger.error(traceback.format_exc())
self.ns_inst_id, resource_version)
logger.debug("Success to delete ns[%s] from aai, resp_status: [%s]." % (self.ns_inst_id, resp_status))
except NSLCMException as e:
- logger.debug("Fail to delete ns[%s] from aai, detail message: %s" % (self.ns_inst_id, e.message))
+ logger.debug("Fail to delete ns[%s] from aai, detail message: %s" % (self.ns_inst_id, e.args[0]))
except:
logger.error(traceback.format_exc())
NsLcmOpOcc.update(occ_id, "COMPLETED")
ns_instantiate_ok = True
except NSLCMException as e:
- logger.error("Failded to Create NS: %s", e.message)
+ logger.error("Failded to Create NS: %s", e.args[0])
update_job(job_id, JOB_PROGRESS.ERROR, JOB_ERROR_CODE.ERROR, "Failded to Create NS.")
- NsLcmOpOcc.update(occ_id, operationState="FAILED", error=e.message)
+ NsLcmOpOcc.update(occ_id, operationState="FAILED", error=e.args[0])
post_deal(ns_inst_id, "false")
except Exception as e:
logger.error(traceback.format_exc())
update_job(job_id, JOB_PROGRESS.ERROR, JOB_ERROR_CODE.ERROR, "Failded to Create NS.")
- NsLcmOpOcc.update(occ_id, operationState="FAILED", error=e.message)
+ NsLcmOpOcc.update(occ_id, operationState="FAILED", error=e.args[0])
post_deal(ns_inst_id, "false")
return ns_instantiate_ok
JobUtil.add_job_status(self.job_id, JOB_PROGRESS.FINISHED, "ns terminate ends.", '')
NsLcmOpOcc.update(self.occ_id, "COMPLETED")
except NSLCMException as e:
- JobUtil.add_job_status(self.job_id, JOB_PROGRESS.ERROR, e.message)
- NsLcmOpOcc.update(self.occ_id, operationState="FAILED", error=e.message)
+ JobUtil.add_job_status(self.job_id, JOB_PROGRESS.ERROR, e.args[0])
+ NsLcmOpOcc.update(self.occ_id, operationState="FAILED", error=e.args[0])
except Exception as e:
- logger.error(e.message)
+ logger.error(e.args[0])
logger.error(traceback.format_exc())
JobUtil.add_job_status(self.job_id, JOB_PROGRESS.ERROR, "ns terminate fail.")
- NsLcmOpOcc.update(self.occ_id, operationState="FAILED", error=e.message)
+ NsLcmOpOcc.update(self.occ_id, operationState="FAILED", error=e.args[0])
def cancel_vl_list(self):
array_vlinst = VLInstModel.objects.filter(ownertype=OWNER_TYPE.NS, ownerid=self.ns_inst_id)
if str(result) == '0':
delete_result = "success"
except Exception as e:
- logger.error("[cancel_vl_list] error[%s]!" % e.message)
+ logger.error("[cancel_vl_list] error[%s]!" % e.args[0])
logger.error(traceback.format_exc())
job_msg = "Delete vlinst:[%s] %s." % (vlinst.vlinstanceid, delete_result)
JobUtil.add_job_status(self.job_id, cur_progress, job_msg)
if str(result) == '0':
delete_result = "success"
except Exception as e:
- logger.error("[cancel_sfc_list] error[%s]!" % e.message)
+ logger.error("[cancel_sfc_list] error[%s]!" % e.args[0])
logger.error(traceback.format_exc())
job_msg = "Delete sfcinst:[%s] %s." % (sfcinst.sfcid, delete_result)
JobUtil.add_job_status(self.job_id, cur_progress, job_msg)
if vnf_job_id:
delete_result = "deleting"
except Exception as e:
- logger.error("[cancel_vnf_list] error[%s]!" % e.message)
+ logger.error("[cancel_vnf_list] error[%s]!" % e.args[0])
logger.error(traceback.format_exc())
job_msg = "Delete vnfinst:[%s] %s." % (vnfinst.nfinstid, delete_result)
JobUtil.add_job_status(self.job_id, cur_progress, job_msg)
if ret[0] == 0:
delete_result = "success"
except Exception as e:
- logger.error("[cancel_pnf_list] error[%s]!" % e.message)
+ logger.error("[cancel_pnf_list] error[%s]!" % e.args[0])
logger.error(traceback.format_exc())
job_msg = "Delete pnfinst:[%s] %s" % (pnfinst.pnfId, delete_result)
cur_progress += step_progress
self.do_biz()
except NSLCMException as e:
logger.error(traceback.format_exc())
- JobUtil.add_job_status(self.job_id, JOB_PROGRESS.ERROR, e.message)
- NsLcmOpOcc.update(self.occ_id, operationState="FAILED", error=e.message)
+ JobUtil.add_job_status(self.job_id, JOB_PROGRESS.ERROR, e.args[0])
+ NsLcmOpOcc.update(self.occ_id, operationState="FAILED", error=e.args[0])
except Exception as e:
logger.error(traceback.format_exc())
JobUtil.add_job_status(self.job_id, JOB_PROGRESS.ERROR, 'ns update fail')
- NsLcmOpOcc.update(self.occ_id, operationState="FAILED", error=e.message)
+ NsLcmOpOcc.update(self.occ_id, operationState="FAILED", error=e.args[0])
def do_biz(self):
self.update_job(JOB_PROGRESS.STARTED, desc='ns update start')
return Response(data=resp_serializer.data, status=status.HTTP_200_OK)
except Exception as e:
logger.error(traceback.format_exc())
- logger.error("Exception in GetNS: %s", e.message)
- return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+ logger.error("Exception in GetNS: %s", e.args[0])
+ return Response(data={'error': e.args[0]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
@swagger_auto_schema(
request_body=_CreateNsReqSerializer(),
return Response(data=resp_serializer.data, status=status.HTTP_200_OK)
except Exception as e:
logger.error(traceback.format_exc())
- logger.error("Exception in GetNSDetail: %s", e.message)
- return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+ logger.error("Exception in GetNSDetail: %s", e.args[0])
+ return Response(data={'error': e.args[0]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
@swagger_auto_schema(
request_body=None,
return Response(data={}, status=status.HTTP_204_NO_CONTENT)
except Exception as e:
logger.error(traceback.format_exc())
- logger.error("Exception in delete NS: %s", e.message)
- return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+ logger.error("Exception in delete NS: %s", e.args[0])
+ return Response(data={'error': e.args[0]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
return Response(data=resp_serializer.data, status=status.HTTP_200_OK)
except Exception as e:
logger.error(traceback.format_exc())
- logger.error("Exception in GetPnf: %s", e.message)
- return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+ logger.error("Exception in GetPnf: %s", e.args[0])
+ return Response(data={'error': e.args[0]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
class IndividualPnfView(APIView):
return Response(data={}, status=status.HTTP_204_NO_CONTENT)
except Exception as e:
logger.error(traceback.format_exc())
- logger.error("Exception in delete pnf: %s", e.message)
- return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+ logger.error("Exception in delete pnf: %s", e.args[0])
+ return Response(data={'error': e.args[0]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
@swagger_auto_schema(
request_body=None,
return Response(data=resp_serializer.data, status=status.HTTP_200_OK)
except Exception as e:
logger.error(traceback.format_exc())
- logger.error("Exception in IndividualPnfView: %s", e.message)
- return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+ logger.error("Exception in IndividualPnfView: %s", e.args[0])
+ return Response(data={'error': e.args[0]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
self.handle_exception(e)
def handle_exception(self, e):
- detail = "sfc instantiation failed, detail message: %s" % e.message
+ detail = "sfc instantiation failed, detail message: %s" % e.args[0]
JobUtil.add_job_status(self.job_id, 255, "create sfc failed!", "")
logger.error(traceback.format_exc())
logger.error(detail)
return self.exception_handle(e)
def exception_handle(self, e):
- detail = 'sfc delete failed, detail message: %s' % e.message
+ detail = 'sfc delete failed, detail message: %s' % e.args[0]
logger.error(detail)
return {"result": 1, "detail": detail}
return Response(data=rsp, status=status.HTTP_200_OK)
except Exception as e:
logger.error(traceback.format_exc())
- return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+ return Response(data={'error': e.args[0]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
class PortPairGpView(APIView):
if not req_serializer.is_valid():
raise Exception(req_serializer.errors)
except Exception as e:
- logger.error("Exception occurs: %s", e.message)
+ logger.error("Exception occurs: %s", e.args[0])
logger.error(traceback.format_exc())
data = {
'nsinstid': ignorcase_get(request.data, 'nsInstanceId'),
return self.exception_handle(e)
def exception_handle(self, e):
- detail = "vl instantiation failed, detail message: %s" % e.message
+ detail = "vl instantiation failed, detail message: %s" % e.args[0]
logger.error(detail)
return {"result": 1, "detail": detail, "vlId": self.vl_inst_id}
resp_data, resp_status = create_network_aai(self.vl_inst_id, data)
logger.debug("Success to create network[%s] to aai: [%s].", self.vl_inst_id, resp_status)
except NSLCMException as e:
- logger.debug("Fail to create network[%s] to aai, detail message: %s" % (self.vl_inst_id, e.message))
+ logger.debug("Fail to create network[%s] to aai, detail message: %s" % (self.vl_inst_id, e.args[0]))
except:
logger.error(traceback.format_exc())
resp_data, resp_status = delete_network_aai(self.vl_inst_id, resource_version)
logger.debug("Delete network[%s] from aai successfully, status: %s", self.vl_inst_id, resp_status)
except NSLCMException as e:
- logger.debug("Fail to delete network[%s] from aai: %s", self.vl_inst_id, e.message)
+ logger.debug("Fail to delete network[%s] from aai: %s", self.vl_inst_id, e.args[0])
except Exception as e:
- logger.error("Exception occurs when delete network[%s] from aai: %s", self.vl_inst_id, e.message)
+ logger.error("Exception occurs when delete network[%s] from aai: %s", self.vl_inst_id, e.args[0])
logger.error(traceback.format_exc())
def delete_vl_from_db(self, vl_inst_info):
self.save_info_to_db()
JobUtil.add_job_status(self.job_id, JOB_PROGRESS.FINISHED, 'vnf instantiation success', JOB_ERROR_CODE.NO_ERROR)
except NSLCMException as e:
- self.vnf_inst_failed_handle(e.message)
+ self.vnf_inst_failed_handle(e.args[0])
except Exception:
logger.error(traceback.format_exc())
self.vnf_inst_failed_handle('unexpected exception')
try:
SubscriptionCreation(data).do_biz()
except Exception as e:
- logger.error("subscribe failed: %s", e.message)
+ logger.error("subscribe failed: %s", e.args[0])
def write_vnf_creation_info(self):
logger.debug("write_vnf_creation_info start")
% (self.nf_inst_id, self.ns_inst_id, resp_status))
except NSLCMException as e:
logger.debug("Fail to create vnf[%s] to aai, ns instance=[%s], detail message: %s"
- % (self.nf_inst_id, self.ns_inst_id, e.message))
+ % (self.nf_inst_id, self.ns_inst_id, e.args[0]))
except:
logger.error(traceback.format_exc())
self.update_network_in_aai()
logger.debug("notify lcm end")
except NSLCMException as e:
- exception(e.message)
+ exception(e.args[0])
except Exception:
logger.error(traceback.format_exc())
exception('unexpected exception')
else:
logger.error('affectedVl struct error: changeType not in {ADDED, REMOVED, MODIFIED, TEMPORARY}')
except NSLCMException as e:
- logger.debug("Fail to create internal network to aai, detail message: %s" % e.message)
+ logger.debug("Fail to create internal network to aai, detail message: %s" % e.args[0])
except:
logger.error(traceback.format_exc())
resp_data, resp_status = create_network_aai(vlInstanceId, data)
logger.debug("Success to create network[%s] to aai: [%s].", vlInstanceId, resp_status)
except NSLCMException as e:
- logger.debug("Fail to create network[%s] to aai, detail message: %s" % (vlInstanceId, e.message))
+ logger.debug("Fail to create network[%s] to aai, detail message: %s" % (vlInstanceId, e.args[0]))
except:
logger.error(traceback.format_exc())
logger.debug("Success to delete network[%s] from aai, resp_status: [%s]."
% (vlInstanceId, resp_status))
except NSLCMException as e:
- logger.debug("Fail to delete network[%s] to aai, detail message: %s" % (vlInstanceId, e.message))
+ logger.debug("Fail to delete network[%s] to aai, detail message: %s" % (vlInstanceId, e.args[0]))
except:
logger.error(traceback.format_exc())
% (vserver_id, self.vnf_instid, resp_status))
except NSLCMException as e:
logger.debug("Fail to create vserver to aai, vnf instance=[%s], detail message: %s"
- % (self.vnf_instid, e.message))
+ % (self.vnf_instid, e.args[0]))
except:
logger.error(traceback.format_exc())
(vserver_id, resp_status))
logger.debug("delete_vserver_in_aai end!")
except NSLCMException as e:
- logger.debug("Fail to delete vserver from aai, detail message: %s" % e.message)
+ logger.debug("Fail to delete vserver from aai, detail message: %s" % e.args[0])
except:
logger.error(traceback.format_exc())
self.update_network_in_aai()
logger.debug("notify lcm end")
except NSLCMException as e:
- self.exception(e.message)
+ self.exception(e.args[0])
except Exception:
logger.error(traceback.format_exc())
self.exception('unexpected exception')
(vserver_id, resp_status))
logger.debug("delete_vserver_in_aai end!")
except NSLCMException as e:
- logger.debug("Fail to delete vserver from aai, detail message: %s" % e.message)
+ logger.debug("Fail to delete vserver from aai, detail message: %s" % e.args[0])
except:
logger.error(traceback.format_exc())
else:
logger.error('affectedVl struct error: changeType not in {added,removed,modified}')
except NSLCMException as e:
- logger.debug("Fail to create internal network to aai, detail message: %s" % e.message)
+ logger.debug("Fail to create internal network to aai, detail message: %s" % e.args[0])
except:
logger.error(traceback.format_exc())
resp_data, resp_status = create_network_aai(vlInstanceId, data)
logger.debug("Success to create network[%s] to aai: [%s].", vlInstanceId, resp_status)
except NSLCMException as e:
- logger.debug("Fail to create network[%s] to aai, detail message: %s" % (vlInstanceId, e.message))
+ logger.debug("Fail to create network[%s] to aai, detail message: %s" % (vlInstanceId, e.args[0]))
except:
logger.error(traceback.format_exc())
logger.debug("Success to delete network[%s] from aai, resp_status: [%s]."
% (vlInstanceId, resp_status))
except NSLCMException as e:
- logger.debug("Fail to delete network[%s] to aai, detail message: %s" % (vlInstanceId, e.message))
+ logger.debug("Fail to delete network[%s] to aai, detail message: %s" % (vlInstanceId, e.args[0]))
except:
logger.error(traceback.format_exc())
% (vserver_id, self.vnf_instid, resp_status))
except NSLCMException as e:
logger.debug("Fail to create vserver to aai, vnf instance=[%s], detail message: %s"
- % (self.vnf_instid, e.message))
+ % (self.vnf_instid, e.args[0]))
except:
logger.error(traceback.format_exc())
self.delete_subscription()
self.delete_data_from_db()
except NSLCMException as e:
- self.set_job_err(e.message)
+ self.set_job_err(e.args[0])
except Exception as ex:
logger.error(traceback.format_exc())
- self.set_job_err(ex.message)
+ self.set_job_err(ex.args[0])
def set_vnf_status(self, vnf_inst_info):
vnf_status = vnf_inst_info.status
try:
SubscriptionDeletion(self.vnfm_inst_id, self.vnf_inst_id).do_biz()
except Exception as e:
- logger.error("delete_subscription failed: %s", e.message)
+ logger.error("delete_subscription failed: %s", e.args[0])
def delete_data_from_db(self):
NfInstModel.objects.filter(nfinstid=self.vnf_inst_id).delete()
logger.debug(
"Success to delete vnf[%s] from aai, resp_status: [%s]." % (self.vnf_inst_id, resp_status))
except NSLCMException as e:
- logger.debug("Fail to delete vnf from aai[%s], detail message: %s" % (self.vnf_inst_id, e.message))
+ logger.debug("Fail to delete vnf from aai[%s], detail message: %s" % (self.vnf_inst_id, e.args[0]))
except:
logger.error(traceback.format_exc())
(vserver_id, resp_status))
logger.debug("delete_vserver_in_aai end!")
except NSLCMException as e:
- logger.debug("Fail to delete vserver from aai, detail message: %s" % e.message)
+ logger.debug("Fail to delete vserver from aai, detail message: %s" % e.args[0])
except:
logger.error(traceback.format_exc())
try:
self.do_biz()
except NSLCMException as e:
- JobUtil.add_job_status(self.job_id, JOB_PROGRESS.ERROR, e.message)
+ JobUtil.add_job_status(self.job_id, JOB_PROGRESS.ERROR, e.args[0])
except:
logger.error(traceback.format_exc())
JobUtil.add_job_status(self.job_id, JOB_PROGRESS.ERROR, 'nf update fail')
return Response(data={}, status=status.HTTP_204_NO_CONTENT)
except Exception as e:
logger.error(traceback.format_exc())
- logger.error("Exception in VnfLcmOoc Notification: %s", e.message)
- return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+ logger.error("Exception in VnfLcmOoc Notification: %s", e.args[0])
+ return Response(data={'error': e.args[0]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
@swagger_auto_schema(
responses={
self.glance.images.upload(self.image_id, open(self.image_path, 'rb'))
except Exception as ex:
logger.error(traceback.format_exc())
- err_msg = ex.message if ex.message else str(sys.exc_info())
+ err_msg = ex.args[0] if ex.args[0] else str(sys.exc_info())
logger.error("Failed to upload image(%s): %s", self.image_id, err_msg)
except:
logger.error(traceback.format_exc())
keystone = auth_info["keystone"]
tenant = keystone.tenants.get(tenant_id=net["tenant_id"])
except NetworkNotFoundClient as e:
- logger.warn("NetworkNotFoundClient: %s", e.message)
- return [2, e.message]
+ logger.warn("NetworkNotFoundClient: %s", e.args[0])
+ return [2, e.args[0]]
return [0, {
"id": net["id"],
"name": net["name"],
try:
subnet_info = neutron.show_subnet(subnet_id)["subnet"]
except SubnetNotFound as e:
- logger.warn("SubnetNotFound: %s", e.message)
- return [2, e.message]
+ logger.warn("SubnetNotFound: %s", e.args[0])
+ return [2, e.args[0]]
ret = [0, {}]
ret[1]["id"] = subnet_id
ret[1]["name"] = subnet_info["name"]
try:
port_info = neutron.show_port(port_id)["port"]
except NeutronClientException as e:
- logger.warn("NeutronClientException: %s", e.message)
- return [2, e.message]
+ logger.warn("NeutronClientException: %s", e.args[0])
+ return [2, e.args[0]]
ret = [0, {}]
ret[1]["id"] = port_id
ret[1]["name"] = port_info["name"]
try:
port_created = neutron.create_port(create_param)
except NeutronClientException as ex:
- logger.info("create_port exception: %s, %s", str(sys.exc_info()), ex.message)
+ logger.info("create_port exception: %s, %s", str(sys.exc_info()), ex.args[0])
create_param['port'].pop('security_groups')
if 'allowed_address_pairs' in create_param['port']:
create_param['port'].pop('allowed_address_pairs')
except Exception as ex:
logger.error(traceback.format_exc())
logger.error(str(sys.exc_info()))
- return [1, ex.message if ex.message else str(sys.exc_info())]
+ return [1, ex.args[0] if ex.args[0] else str(sys.exc_info())]
def rollback(neutron, network_data):
neutron.delete_network(network_id)
except Exception as ex:
logger.error(traceback.format_exc())
- msg = ex.message if ex.message else str(sys.exc_info())
+ msg = ex.args[0] if ex.args[0] else str(sys.exc_info())
logger.error(msg)
if 404 == ex.status_code:
- return [0, ex.message]
+ return [0, ex.args[0]]
return [1, "Vim exception."]
return [0, "Network(%s) is deleted" % network_id]
try:
neutron.delete_subnet(subnet_id)
except NeutronClientException as e:
- logger.warn("[%s]NetworkNotFoundClient: %s", fun_name(), e.message)
- return [0, e.message]
+ logger.warn("[%s]NetworkNotFoundClient: %s", fun_name(), e.args[0])
+ return [0, e.args[0]]
return [0, "Subnet(%s) is deleted" % subnet_id]
try:
neutron.delete_port(port_id)
except NeutronClientException as e:
- logger.warn("[%s]NeutronClientException: %s", fun_name(), e.message)
- return [0, e.message]
+ logger.warn("[%s]NeutronClientException: %s", fun_name(), e.args[0])
+ return [0, e.args[0]]
return [0, "Port(%s) is deleted" % port_id]
try:
ret = fun(self.authInfo[1], *args) if self.authInfo[0] == 0 else self.authInfo
except VimException as e:
- ret = [1, e.message]
+ ret = [1, e.args[0]]
except RequestException as e:
logger.error("request=%s, url=%s" % (e.request.headers._store, e.request.url))
logger.error(traceback.format_exc())
- ret = [1, e.message if e.message else str(sys.exc_info())]
+ ret = [1, e.args[0] if e.args[0] else str(sys.exc_info())]
except Exception as ex:
logger.error(traceback.format_exc())
- ret = [1, ex.message if ex.message else str(sys.exc_info())]
+ ret = [1, ex.args[0] if ex.args[0] else str(sys.exc_info())]
except:
logger.error(traceback.format_exc())
ret = [1, str(sys.exc_info())]
raise Exception(resp_serializer.errors)
return Response(data=resp_serializer.data, status=status.HTTP_200_OK)
except Exception as e:
- logger.error(e.message)
+ logger.error(e.args[0])
logger.error(traceback.format_exc())
- return Response(data={"error": e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+ return Response(data={"error": e.args[0]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)