aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2017-09-26 10:46:58 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2017-09-26 10:46:58 +0800
commit8df64c4e5d4eeed111fb41efe30785fc6d7ac03c (patch)
treec12150079385456a5a943ed3d529aaf3d7462679
parentbeaf2b13fefba455e576b90b8866c94afdc2076b (diff)
Fix pep8 error for vnfs
Change-Id: I894c692c01af838e19d209dd2e43a4034c5d58f0 Issue-Id: VFC-455 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r--lcm/ns/vnfs/create_vnfs.py3
-rw-r--r--lcm/ns/vnfs/grant_vnfs.py8
-rw-r--r--lcm/ns/vnfs/heal_vnfs.py8
-rw-r--r--lcm/ns/vnfs/notify_lcm.py9
-rw-r--r--lcm/ns/vnfs/scale_vnfs.py2
-rw-r--r--lcm/ns/vnfs/terminate_nfs.py2
-rw-r--r--lcm/ns/vnfs/verify_vnfs.py4
-rw-r--r--lcm/ns/vnfs/views.py3
-rw-r--r--lcm/ns/vnfs/wait_job.py3
9 files changed, 12 insertions, 30 deletions
diff --git a/lcm/ns/vnfs/create_vnfs.py b/lcm/ns/vnfs/create_vnfs.py
index 6850ba07..0af4c6d0 100644
--- a/lcm/ns/vnfs/create_vnfs.py
+++ b/lcm/ns/vnfs/create_vnfs.py
@@ -107,7 +107,7 @@ class CreateVnfs(Thread):
def get_vnfd_id(self):
if self.vnfd_id:
logger.debug("need not get vnfd_id")
- self.nsd_model={'vnfs': [], 'vls': [], 'vnffgs': []}
+ self.nsd_model = {'vnfs': [], 'vls': [], 'vnffgs': []}
self.vnf_inst_name = self.vnfd_id + str(uuid.uuid4())
self.vnf_inst_name = self.vnf_inst_name[:30]
return
@@ -271,7 +271,6 @@ class CreateVnfs(Thread):
vnf_list = vnffg_inst_infos[0].vnflist
vnffg_inst_infos.update(vnf_list=vnf_list + ',' + self.nf_inst_id if vnf_list else self.nf_inst_id)
-
def create_vnf_in_aai(self):
logger.debug("CreateVnfs::create_vnf_in_aai::report vnf instance[%s] to aai." % self.nf_inst_id)
data = {
diff --git a/lcm/ns/vnfs/grant_vnfs.py b/lcm/ns/vnfs/grant_vnfs.py
index c93647f6..0bef6131 100644
--- a/lcm/ns/vnfs/grant_vnfs.py
+++ b/lcm/ns/vnfs/grant_vnfs.py
@@ -42,7 +42,6 @@ class GrantVnfs(object):
elif ignore_case_get(self.data, "removeResource"):
grant_type = "removeResource"
else:
- #raise NSLCMException("No grant resource is found.")
has_res_tpl = True
for res in ignore_case_get(self.data, grant_type):
@@ -116,10 +115,3 @@ class GrantVnfs(object):
if storage_id == storage["local_storage_id"]:
return int(storage["properties"]["size"])
return 0
-
-
-
-
-
-
-
diff --git a/lcm/ns/vnfs/heal_vnfs.py b/lcm/ns/vnfs/heal_vnfs.py
index 8b5847ce..2ba7c8a9 100644
--- a/lcm/ns/vnfs/heal_vnfs.py
+++ b/lcm/ns/vnfs/heal_vnfs.py
@@ -83,8 +83,6 @@ class NFHealService(threading.Thread):
vmid = ignore_case_get(actionvminfo, 'vmid')
vmname = ignore_case_get(actionvminfo, 'vmname')
-
- # Gets vduid
vduid = self.get_vudId(vmid, self.vnf_instance_id)
self.nf_heal_params = {
@@ -108,11 +106,11 @@ class NFHealService(threading.Thread):
# Gets vdu id according to the given vm id.
def get_vudId(self, vmid):
- vnfcInstances = VNFCInstModel.objects.filter(vmid = vmid, nfinstid=self.vnf_instance_id)
- if not vnfcInstances or len(vnfcInstances) > 1:
+ vnfcInstances = VNFCInstModel.objects.filter(vmid=vmid, nfinstid=self.vnf_instance_id)
+ if not vnfcInstances:
raise NSLCMException('VDU [vmid=%s, vnfInstanceId=%s] does not exist' % (vmid, self.vnf_instance_id))
- vnfcInstance = VNFCInstModel.objects.filter(vmid = vmid,nfinstid=self.vnf_instance_id).first()
+ vnfcInstance = VNFCInstModel.objects.filter(vmid=vmid, nfinstid=self.vnf_instance_id).first()
return vnfcInstance.vduid
def update_job(self, progress, desc=''):
diff --git a/lcm/ns/vnfs/notify_lcm.py b/lcm/ns/vnfs/notify_lcm.py
index 6342f7a6..3c23a4ee 100644
--- a/lcm/ns/vnfs/notify_lcm.py
+++ b/lcm/ns/vnfs/notify_lcm.py
@@ -48,7 +48,6 @@ class NotifyLcm(object):
self.update_Vl()
self.update_Cp()
self.update_Storage()
- #self.update_vnf_by_vnfdmodule()
logger.debug("notify lcm end")
except NSLCMException as e:
self.exception(e.message)
@@ -75,12 +74,6 @@ class NotifyLcm(object):
vimId = ignore_case_get(vnfc, 'vimid')
vmId = ignore_case_get(vnfc, 'vmid')
vmName = ignore_case_get(vnfc, 'vmname')
- # resourceType = ignore_case_get(vmResource, 'resourceType')
- # resourceId = ignore_case_get(vmId, 'resourceId')
-
-
- # if resourceType != 'vm':
- # self.exception('affectedVnfc struct error: resourceType not euqal vm')
if changeType == 'added':
VNFCInstModel(vnfcinstanceid=vnfcInstanceId, vduid=vduId,
@@ -125,7 +118,6 @@ class NotifyLcm(object):
def update_Cp(self):
for cp in self.affectedCp:
virtualLinkInstanceId = ignore_case_get(cp, 'virtualLinkInstanceId')
- #ownerid = ignore_case_get(cp, 'ownerid')
ownertype = ignore_case_get(cp, 'ownertype')
if not ownertype:
ownertype = 0
@@ -142,7 +134,6 @@ class NotifyLcm(object):
tenant = ignore_case_get(portResource, 'tenant')
ipAddress = ignore_case_get(portResource, 'ipAddress')
macAddress = ignore_case_get(portResource, 'macAddress')
- sfcEncapsulation = ignore_case_get(portResource, 'sfcEncapsulation')
instId = ignore_case_get(portResource, 'instId')
portid = str(uuid.uuid4())
PortInstModel(portid=portid, networkid='unknown', subnetworkid='unknown', vimid=vimId,
diff --git a/lcm/ns/vnfs/scale_vnfs.py b/lcm/ns/vnfs/scale_vnfs.py
index fb4f2bee..61d84cf3 100644
--- a/lcm/ns/vnfs/scale_vnfs.py
+++ b/lcm/ns/vnfs/scale_vnfs.py
@@ -102,4 +102,4 @@ class NFManualScaleService(threading.Thread):
NfInstModel.objects.filter(nfinstid=self.vnf_instance_id).update(status=status)
def update_job(self, progress, desc=''):
- JobUtil.add_job_status(self.job_id, progress, desc) \ No newline at end of file
+ JobUtil.add_job_status(self.job_id, progress, desc)
diff --git a/lcm/ns/vnfs/terminate_nfs.py b/lcm/ns/vnfs/terminate_nfs.py
index b42ceee6..14edc0f1 100644
--- a/lcm/ns/vnfs/terminate_nfs.py
+++ b/lcm/ns/vnfs/terminate_nfs.py
@@ -22,7 +22,7 @@ from lcm.pub.config.config import REPORT_TO_AAI
from lcm.pub.database.models import NfInstModel, VmInstModel
from lcm.ns.vnfs.const import VNF_STATUS, NFVO_VNF_INST_TIMEOUT_SECOND, INST_TYPE
from lcm.pub.msapi.aai import query_vnf_aai, delete_vnf_aai, query_vserver_aai, delete_vserver_aai
-from lcm.pub.msapi.extsys import get_vnfm_by_id, split_vim_to_owner_region, get_vim_by_id
+from lcm.pub.msapi.extsys import split_vim_to_owner_region, get_vim_by_id
from lcm.pub.utils.values import ignore_case_get
from lcm.pub.utils.jobutil import JOB_MODEL_STATUS, JobUtil
from lcm.pub.exceptions import NSLCMException
diff --git a/lcm/ns/vnfs/verify_vnfs.py b/lcm/ns/vnfs/verify_vnfs.py
index aa6761b1..8375acbd 100644
--- a/lcm/ns/vnfs/verify_vnfs.py
+++ b/lcm/ns/vnfs/verify_vnfs.py
@@ -19,7 +19,7 @@ import traceback
import time
from lcm.pub.exceptions import NSLCMException
-from lcm.pub.utils.jobutil import JobUtil, JOB_TYPE, JOB_MODEL_STATUS
+from lcm.pub.utils.jobutil import JobUtil, JOB_TYPE
from lcm.pub.utils.values import ignore_case_get
from lcm.pub.utils.restcall import req_by_msb
@@ -27,6 +27,7 @@ logger = logging.getLogger(__name__)
JOB_ERROR = 255
+
class VerifyVnfs(threading.Thread):
def __init__(self, data, job_id):
super(VerifyVnfs, self).__init__()
@@ -53,7 +54,6 @@ class VerifyVnfs(threading.Thread):
logger.warn("Ignore terminate vnf operation")
if self.verify_ok:
self.update_job(100, "Ignore terminate vnf operation.")
- #self.do_term_vnf()
def do_on_boarding(self):
self.update_job(10, "Start vnf on boarding.")
diff --git a/lcm/ns/vnfs/views.py b/lcm/ns/vnfs/views.py
index ea04bdc4..2a94c8ce 100644
--- a/lcm/ns/vnfs/views.py
+++ b/lcm/ns/vnfs/views.py
@@ -118,6 +118,7 @@ class NfScaleView(APIView):
except Exception as e:
return Response(data={'error': '%s' % e.message}, status=status.HTTP_409_CONFLICT)
+
class NfVerifyView(APIView):
def post(self, request):
job_id = "VNFSDK_" + str(uuid.uuid4())
@@ -125,6 +126,7 @@ class NfVerifyView(APIView):
VerifyVnfs(request.data, job_id).start()
return Response(data={"jobId": job_id}, status=status.HTTP_202_ACCEPTED)
+
class NfVnfmInfoView(APIView):
def get(self, request, vnfmid):
logger.debug("NfVnfmInfoView--get::> %s" % vnfmid)
@@ -139,6 +141,7 @@ class NfVnfmInfoView(APIView):
status=status.HTTP_500_INTERNAL_SERVER_ERROR)
return Response(data=vnfm_info, status=status.HTTP_200_OK)
+
class NfVimInfoView(APIView):
def get(self, request, vimid):
logger.debug("NfVimInfoView--get::> %s" % vimid)
diff --git a/lcm/ns/vnfs/wait_job.py b/lcm/ns/vnfs/wait_job.py
index 39a9555b..99b45076 100644
--- a/lcm/ns/vnfs/wait_job.py
+++ b/lcm/ns/vnfs/wait_job.py
@@ -54,8 +54,7 @@ def default_callback(vnfo_job_id, vnfm_job_id, job_status, jobs, progress_range,
return False, JOB_MODEL_STATUS.PROCESSING
-def wait_job_finish(vnfm_id, vnfo_job_id, vnfm_job_id, progress_range=None, timeout=600,
- job_callback=default_callback, **kwargs):
+def wait_job_finish(vnfm_id, vnfo_job_id, vnfm_job_id, progress_range=None, timeout=600, job_callback=default_callback, **kwargs):
progress_range = [0, 100] if not progress_range else progress_range
response_id = 0
query_interval = 2