summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormaopengzhang <zhang.maopeng1@zte.com.cn>2019-07-08 11:53:13 +0800
committermaopengzhang <zhang.maopeng1@zte.com.cn>2019-07-08 11:53:13 +0800
commita2034b62ab086f2bd459695401af4901ffb3ff96 (patch)
tree0a2702ac31464c0b7e28537a82f5569533d509bf
parent6ed46a1d793c660cb08ac60df96343149db010ce (diff)
resolve python2->python3 issues
resolve e.message issues Change-Id: Ib55c1ddfe12a428c06b018d60008d1fa90fca979 Issue-ID: VFC-1429 Signed-off-by: maopengzhang <zhang.maopeng1@zte.com.cn>
-rw-r--r--lcm/ns/biz/ns_create.py2
-rw-r--r--lcm/ns/biz/ns_delete.py2
-rw-r--r--lcm/ns/biz/ns_instantiate_flow.py6
-rw-r--r--lcm/ns/biz/ns_terminate.py16
-rw-r--r--lcm/ns/biz/ns_update.py6
-rw-r--r--lcm/ns/views/deprecated/create_ns_view.py4
-rw-r--r--lcm/ns/views/deprecated/get_del_ns_view.py8
-rw-r--r--lcm/ns_pnfs/views/pnf_view.py12
-rw-r--r--lcm/ns_sfcs/biz/create_sfc_worker.py2
-rw-r--r--lcm/ns_sfcs/biz/delete_sfcs.py2
-rw-r--r--lcm/ns_sfcs/views/views.py4
-rw-r--r--lcm/ns_vls/biz/create_vls.py4
-rw-r--r--lcm/ns_vls/biz/delete_vls.py4
-rw-r--r--lcm/ns_vnfs/biz/create_vnfs.py6
-rw-r--r--lcm/ns_vnfs/biz/handle_notification.py12
-rw-r--r--lcm/ns_vnfs/biz/notify_lcm.py12
-rw-r--r--lcm/ns_vnfs/biz/terminate_nfs.py10
-rw-r--r--lcm/ns_vnfs/biz/update_vnfs.py2
-rw-r--r--lcm/ns_vnfs/views/vnf_views.py4
-rw-r--r--lcm/pub/nfvi/vim/api/openstack/image.py2
-rw-r--r--lcm/pub/nfvi/vim/api/openstack/network.py28
-rw-r--r--lcm/pub/nfvi/vim/vimadaptor.py6
-rw-r--r--lcm/samples/views.py4
23 files changed, 79 insertions, 79 deletions
diff --git a/lcm/ns/biz/ns_create.py b/lcm/ns/biz/ns_create.py
index 5fba81bc..1cb4e0ca 100644
--- a/lcm/ns/biz/ns_create.py
+++ b/lcm/ns/biz/ns_create.py
@@ -89,6 +89,6 @@ class CreateNSService(object):
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())
diff --git a/lcm/ns/biz/ns_delete.py b/lcm/ns/biz/ns_delete.py
index 2d251907..9bfad7b8 100644
--- a/lcm/ns/biz/ns_delete.py
+++ b/lcm/ns/biz/ns_delete.py
@@ -67,6 +67,6 @@ class DeleteNsService(object):
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())
diff --git a/lcm/ns/biz/ns_instantiate_flow.py b/lcm/ns/biz/ns_instantiate_flow.py
index c840a754..06057516 100644
--- a/lcm/ns/biz/ns_instantiate_flow.py
+++ b/lcm/ns/biz/ns_instantiate_flow.py
@@ -82,14 +82,14 @@ def run_ns_instantiate(input_data, occ_id):
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
diff --git a/lcm/ns/biz/ns_terminate.py b/lcm/ns/biz/ns_terminate.py
index 59c99da4..b2776a69 100644
--- a/lcm/ns/biz/ns_terminate.py
+++ b/lcm/ns/biz/ns_terminate.py
@@ -57,13 +57,13 @@ class TerminateNsService(threading.Thread):
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)
@@ -82,7 +82,7 @@ class TerminateNsService(threading.Thread):
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)
@@ -104,7 +104,7 @@ class TerminateNsService(threading.Thread):
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)
@@ -126,7 +126,7 @@ class TerminateNsService(threading.Thread):
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)
@@ -209,7 +209,7 @@ class TerminateNsService(threading.Thread):
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
diff --git a/lcm/ns/biz/ns_update.py b/lcm/ns/biz/ns_update.py
index 95edd3b7..6d996d29 100644
--- a/lcm/ns/biz/ns_update.py
+++ b/lcm/ns/biz/ns_update.py
@@ -44,12 +44,12 @@ class NSUpdateService(threading.Thread):
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')
diff --git a/lcm/ns/views/deprecated/create_ns_view.py b/lcm/ns/views/deprecated/create_ns_view.py
index cdc72cf9..4fb6f938 100644
--- a/lcm/ns/views/deprecated/create_ns_view.py
+++ b/lcm/ns/views/deprecated/create_ns_view.py
@@ -50,8 +50,8 @@ class CreateNSView(APIView):
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(),
diff --git a/lcm/ns/views/deprecated/get_del_ns_view.py b/lcm/ns/views/deprecated/get_del_ns_view.py
index da403b0b..2bb34c05 100644
--- a/lcm/ns/views/deprecated/get_del_ns_view.py
+++ b/lcm/ns/views/deprecated/get_del_ns_view.py
@@ -50,8 +50,8 @@ class NSDetailView(APIView):
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,
@@ -67,5 +67,5 @@ class NSDetailView(APIView):
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)
diff --git a/lcm/ns_pnfs/views/pnf_view.py b/lcm/ns_pnfs/views/pnf_view.py
index ad435f9b..72dddaf6 100644
--- a/lcm/ns_pnfs/views/pnf_view.py
+++ b/lcm/ns_pnfs/views/pnf_view.py
@@ -76,8 +76,8 @@ class PnfView(APIView):
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):
@@ -95,8 +95,8 @@ 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,
@@ -120,5 +120,5 @@ class IndividualPnfView(APIView):
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)
diff --git a/lcm/ns_sfcs/biz/create_sfc_worker.py b/lcm/ns_sfcs/biz/create_sfc_worker.py
index 04216eea..9e2bca89 100644
--- a/lcm/ns_sfcs/biz/create_sfc_worker.py
+++ b/lcm/ns_sfcs/biz/create_sfc_worker.py
@@ -61,7 +61,7 @@ class CreateSfcWorker(Thread):
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)
diff --git a/lcm/ns_sfcs/biz/delete_sfcs.py b/lcm/ns_sfcs/biz/delete_sfcs.py
index 23fed4c2..292e83e1 100644
--- a/lcm/ns_sfcs/biz/delete_sfcs.py
+++ b/lcm/ns_sfcs/biz/delete_sfcs.py
@@ -46,7 +46,7 @@ class DeleteSfcs(object):
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}
diff --git a/lcm/ns_sfcs/views/views.py b/lcm/ns_sfcs/views/views.py
index 67257001..6f1d81c0 100644
--- a/lcm/ns_sfcs/views/views.py
+++ b/lcm/ns_sfcs/views/views.py
@@ -68,7 +68,7 @@ class SfcInstanceView(APIView):
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):
@@ -151,7 +151,7 @@ class SfcView(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'),
diff --git a/lcm/ns_vls/biz/create_vls.py b/lcm/ns_vls/biz/create_vls.py
index 0746af59..1ddd7ce6 100644
--- a/lcm/ns_vls/biz/create_vls.py
+++ b/lcm/ns_vls/biz/create_vls.py
@@ -67,7 +67,7 @@ class CreateVls(object):
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}
@@ -247,6 +247,6 @@ class CreateVls(object):
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())
diff --git a/lcm/ns_vls/biz/delete_vls.py b/lcm/ns_vls/biz/delete_vls.py
index 77a8ae5a..65ca90d6 100644
--- a/lcm/ns_vls/biz/delete_vls.py
+++ b/lcm/ns_vls/biz/delete_vls.py
@@ -97,9 +97,9 @@ class DeleteVls(object):
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):
diff --git a/lcm/ns_vnfs/biz/create_vnfs.py b/lcm/ns_vnfs/biz/create_vnfs.py
index 4d7457b6..28758870 100644
--- a/lcm/ns_vnfs/biz/create_vnfs.py
+++ b/lcm/ns_vnfs/biz/create_vnfs.py
@@ -96,7 +96,7 @@ class CreateVnfs(Thread):
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')
@@ -398,7 +398,7 @@ class CreateVnfs(Thread):
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")
@@ -474,6 +474,6 @@ class CreateVnfs(Thread):
% (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())
diff --git a/lcm/ns_vnfs/biz/handle_notification.py b/lcm/ns_vnfs/biz/handle_notification.py
index fcc8bf0f..b9077800 100644
--- a/lcm/ns_vnfs/biz/handle_notification.py
+++ b/lcm/ns_vnfs/biz/handle_notification.py
@@ -55,7 +55,7 @@ class HandleVnfLcmOocNotification(object):
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')
@@ -177,7 +177,7 @@ class HandleVnfLcmOocNotification(object):
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())
@@ -208,7 +208,7 @@ class HandleVnfLcmOocNotification(object):
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())
@@ -224,7 +224,7 @@ class HandleVnfLcmOocNotification(object):
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())
@@ -264,7 +264,7 @@ class HandleVnfLcmOocNotification(object):
% (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())
@@ -288,7 +288,7 @@ class HandleVnfLcmOocNotification(object):
(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())
diff --git a/lcm/ns_vnfs/biz/notify_lcm.py b/lcm/ns_vnfs/biz/notify_lcm.py
index e5d42a22..22a24241 100644
--- a/lcm/ns_vnfs/biz/notify_lcm.py
+++ b/lcm/ns_vnfs/biz/notify_lcm.py
@@ -57,7 +57,7 @@ class NotifyLcm(object):
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')
@@ -122,7 +122,7 @@ class NotifyLcm(object):
(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())
@@ -224,7 +224,7 @@ class NotifyLcm(object):
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())
@@ -255,7 +255,7 @@ class NotifyLcm(object):
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())
@@ -271,7 +271,7 @@ class NotifyLcm(object):
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())
@@ -311,6 +311,6 @@ class NotifyLcm(object):
% (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())
diff --git a/lcm/ns_vnfs/biz/terminate_nfs.py b/lcm/ns_vnfs/biz/terminate_nfs.py
index 6cbabc16..86d608e8 100644
--- a/lcm/ns_vnfs/biz/terminate_nfs.py
+++ b/lcm/ns_vnfs/biz/terminate_nfs.py
@@ -64,10 +64,10 @@ class TerminateVnfs(threading.Thread):
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
@@ -141,7 +141,7 @@ class TerminateVnfs(threading.Thread):
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()
@@ -161,7 +161,7 @@ class TerminateVnfs(threading.Thread):
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())
@@ -189,6 +189,6 @@ class TerminateVnfs(threading.Thread):
(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())
diff --git a/lcm/ns_vnfs/biz/update_vnfs.py b/lcm/ns_vnfs/biz/update_vnfs.py
index ad587fd3..012abd9f 100644
--- a/lcm/ns_vnfs/biz/update_vnfs.py
+++ b/lcm/ns_vnfs/biz/update_vnfs.py
@@ -46,7 +46,7 @@ class NFOperateService(threading.Thread):
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')
diff --git a/lcm/ns_vnfs/views/vnf_views.py b/lcm/ns_vnfs/views/vnf_views.py
index 593ac763..d5388b4a 100644
--- a/lcm/ns_vnfs/views/vnf_views.py
+++ b/lcm/ns_vnfs/views/vnf_views.py
@@ -94,8 +94,8 @@ class VnfNotifyView(APIView):
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={
diff --git a/lcm/pub/nfvi/vim/api/openstack/image.py b/lcm/pub/nfvi/vim/api/openstack/image.py
index 2a04cb9a..8189aa72 100644
--- a/lcm/pub/nfvi/vim/api/openstack/image.py
+++ b/lcm/pub/nfvi/vim/api/openstack/image.py
@@ -36,7 +36,7 @@ class ImageUploadThread(threading.Thread):
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())
diff --git a/lcm/pub/nfvi/vim/api/openstack/network.py b/lcm/pub/nfvi/vim/api/openstack/network.py
index 3c3db3d2..adeab6b1 100644
--- a/lcm/pub/nfvi/vim/api/openstack/network.py
+++ b/lcm/pub/nfvi/vim/api/openstack/network.py
@@ -37,8 +37,8 @@ def query_net(auth_info, net_id):
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"],
@@ -86,8 +86,8 @@ def query_subnet(auth_info, subnet_id):
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"]
@@ -108,8 +108,8 @@ def query_port(auth_info, port_id):
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"]
@@ -236,7 +236,7 @@ def create_port(auth_info, data):
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')
@@ -372,7 +372,7 @@ def create_subnet(neutron, network_id, data):
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):
@@ -398,10 +398,10 @@ def delete_network(auth_info, network_id):
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]
@@ -411,8 +411,8 @@ def delete_subnet(auth_info, subnet_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]
@@ -421,6 +421,6 @@ def delete_port(auth_info, port_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]
diff --git a/lcm/pub/nfvi/vim/vimadaptor.py b/lcm/pub/nfvi/vim/vimadaptor.py
index 1ad0a482..6203383c 100644
--- a/lcm/pub/nfvi/vim/vimadaptor.py
+++ b/lcm/pub/nfvi/vim/vimadaptor.py
@@ -43,14 +43,14 @@ class VimAdaptor:
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())]
diff --git a/lcm/samples/views.py b/lcm/samples/views.py
index 5889aaca..a22b7b17 100644
--- a/lcm/samples/views.py
+++ b/lcm/samples/views.py
@@ -82,6 +82,6 @@ class TablesList(APIView):
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)