aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lcm/ns/ns_create.py4
-rw-r--r--lcm/ns/ns_get.py3
-rw-r--r--lcm/ns/ns_heal.py2
-rw-r--r--lcm/ns/ns_instant.py7
-rw-r--r--lcm/ns/ns_manual_scale.py1
-rw-r--r--lcm/ns/ns_terminate.py2
-rw-r--r--lcm/ns/urls.py2
-rw-r--r--lcm/ns/views.py13
8 files changed, 13 insertions, 21 deletions
diff --git a/lcm/ns/ns_create.py b/lcm/ns/ns_create.py
index 620427f3..ff501073 100644
--- a/lcm/ns/ns_create.py
+++ b/lcm/ns/ns_create.py
@@ -88,6 +88,6 @@ class CreateNSService(object):
}
resp_data, resp_status = create_customer_aai(global_customer_id, data)
if resp_data:
- logger.debug("Fail to create ns instance[%s] to aai, resp_status: [%s]." % (self.ns_inst_id, resp_status) )
+ logger.debug("Fail to create ns[%s] to aai: [%s].", self.ns_inst_id, resp_status)
else:
- logger.debug("Success to create ns instance[%s] to aai, resp_status: [%s]." % (self.ns_inst_id, resp_status) )
+ logger.debug("Success to create ns[%s] to aai: [%s].", self.ns_inst_id, resp_status)
diff --git a/lcm/ns/ns_get.py b/lcm/ns/ns_get.py
index 0bd39559..030e42c1 100644
--- a/lcm/ns/ns_get.py
+++ b/lcm/ns/ns_get.py
@@ -13,7 +13,6 @@
# limitations under the License.
import json
import logging
-import traceback
from lcm.ns.const import OWNER_TYPE
from lcm.pub.database.models import NSInstModel, NfInstModel, VLInstModel, CPInstModel, VNFFGInstModel
@@ -23,7 +22,7 @@ logger = logging.getLogger(__name__)
class GetNSInfoService(object):
def __init__(self, nsfilter=None):
- self.ns_filter=nsfilter
+ self.ns_filter = nsfilter
def get_ns_info(self):
if self.ns_filter:
diff --git a/lcm/ns/ns_heal.py b/lcm/ns/ns_heal.py
index 896c8c83..d777191c 100644
--- a/lcm/ns/ns_heal.py
+++ b/lcm/ns/ns_heal.py
@@ -19,7 +19,7 @@ import datetime
import time
from lcm.ns.const import NS_INST_STATUS
-from lcm.pub.database.models import JobModel, NSInstModel, NfInstModel
+from lcm.pub.database.models import JobModel, NSInstModel
from lcm.ns.vnfs.heal_vnfs import NFHealService
from lcm.pub.exceptions import NSLCMException
from lcm.pub.utils.jobutil import JobUtil, JOB_MODEL_STATUS
diff --git a/lcm/ns/ns_instant.py b/lcm/ns/ns_instant.py
index 255daffa..24a8d314 100644
--- a/lcm/ns/ns_instant.py
+++ b/lcm/ns/ns_instant.py
@@ -21,7 +21,7 @@ import uuid
from rest_framework import status
from lcm.pub.database.models import DefPkgMappingModel, ServiceBaseInfoModel, InputParamMappingModel
-from lcm.pub.database.models import NSInstModel, NfPackageModel, VNFFGInstModel, WFPlanModel, NSDModel
+from lcm.pub.database.models import NSInstModel, NfPackageModel, VNFFGInstModel, WFPlanModel
from lcm.pub.msapi.catalog import get_process_id, query_rawdata_from_catalog
from lcm.pub.msapi.catalog import get_servicetemplate_id, get_servicetemplate
from lcm.pub.msapi.wso2bpel import workflow_run
@@ -60,14 +60,13 @@ class InstantNSService(object):
location_constraints = []
if 'locationConstraints' in self.req_data:
location_constraints = self.req_data['locationConstraints']
-
+
JobUtil.add_job_status(job_id, 5, 'Start query nsd(%s)' % ns_inst.nspackage_id)
dst_plan = None
if WORKFLOW_OPTION == "wso2":
src_plan = query_rawdata_from_catalog(ns_inst.nspackage_id, input_parameters)
dst_plan = toscautil.convert_nsd_model(src_plan["rawData"])
else:
- nsd_pkg = NSDModel.objects.get(id=ns_inst.nspackage_id)
dst_plan = sdc_run_catalog.parse_nsd(ns_inst.nspackage_id, input_parameters)
logger.debug('tosca plan dest:%s' % dst_plan)
@@ -117,7 +116,7 @@ class InstantNSService(object):
active_status='--',
status=ns_inst.status,
creator='--',
- create_time=int(time.time()*1000)).save()
+ create_time=int(time.time() * 1000)).save()
if WORKFLOW_OPTION == "wso2":
service_tpl = get_servicetemplate(ns_inst.nsd_id)
diff --git a/lcm/ns/ns_manual_scale.py b/lcm/ns/ns_manual_scale.py
index dc2d1b4a..d8a089a8 100644
--- a/lcm/ns/ns_manual_scale.py
+++ b/lcm/ns/ns_manual_scale.py
@@ -69,7 +69,6 @@ class NSManualScaleService(threading.Thread):
self.scale_vnf_data = get_scale_vnf_data(self.scale_ns_data,self.ns_instance_id)
logger.debug('scale_vnf_data = %s' % self.scale_vnf_data)
# Get data if SCALE_VNF
- #self.scale_vnf_data = ignore_case_get(self.request_data, 'scaleVnfData')
if not self.scale_vnf_data:
logger.error('scaleVnfData parameter does not exist or value incorrect')
raise NSLCMException('scaleVnfData parameter does not exist or value incorrect')
diff --git a/lcm/ns/ns_terminate.py b/lcm/ns/ns_terminate.py
index 2a79fb31..e2f19312 100644
--- a/lcm/ns/ns_terminate.py
+++ b/lcm/ns/ns_terminate.py
@@ -48,7 +48,7 @@ class TerminateNsService(threading.Thread):
JobUtil.add_job_status(self.job_id, JOB_ERROR, e.message)
except:
logger.error(traceback.format_exc())
- JobUtil.add_job_status(self.job_id, JOB_ERROR, "ns terminate fail.", '')
+ JobUtil.add_job_status(self.job_id, JOB_ERROR, "ns terminate fail.", '')
def do_biz(self):
if not self.check_data():
diff --git a/lcm/ns/urls.py b/lcm/ns/urls.py
index f2025bfd..f61b4444 100644
--- a/lcm/ns/urls.py
+++ b/lcm/ns/urls.py
@@ -14,7 +14,7 @@
from django.conf.urls import patterns, url
from rest_framework.urlpatterns import format_suffix_patterns
-from lcm.ns.views import CreateNSView, NSInstView, TerminateNSView, NSDetailView, SwaggerJsonView, NSInstPostDealView, \
+from lcm.ns.views import CreateNSView, NSInstView, TerminateNSView, NSDetailView, NSInstPostDealView, \
NSManualScaleView, NSHealView
urlpatterns = patterns('',
diff --git a/lcm/ns/views.py b/lcm/ns/views.py
index dbf285e7..78fc51bf 100644
--- a/lcm/ns/views.py
+++ b/lcm/ns/views.py
@@ -40,12 +40,10 @@ logger = logging.getLogger(__name__)
class CreateNSView(APIView):
def get(self, request):
logger.debug("CreateNSView::get")
- filter=None
+ filter = None
csarId = ignore_case_get(request.META, 'csarId')
if csarId:
- filter ={
- "csarId":csarId
- }
+ filter = {"csarId": csarId}
ret = GetNSInfoService(filter).get_ns_info()
logger.debug("CreateNSView::get::ret=%s", ret)
@@ -107,7 +105,7 @@ class NSHealView(APIView):
class NSDetailView(APIView):
def get(self, request, ns_instance_id):
logger.debug("Enter NSDetailView::get ns(%s)", ns_instance_id)
- ns_filter ={"ns_inst_id":ns_instance_id}
+ ns_filter = {"ns_inst_id": ns_instance_id}
ret = GetNSInfoService(ns_filter).get_ns_info()
if not ret:
return Response(status=status.HTTP_404_NOT_FOUND)
@@ -130,8 +128,6 @@ class SwaggerJsonView(APIView):
class NSInstPostDealView(APIView):
-
-
def post(self, request, ns_instance_id):
logger.debug("Enter NSInstPostDealView::post %s, %s", request.data, ns_instance_id)
ns_post_status = ignore_case_get(request.data, 'status')
@@ -170,7 +166,6 @@ class NSInstPostDealView(APIView):
ret = req_by_msb(policy_engine_url, "POST", req_param)
if ret[0] != 0:
logger.error("Failed to send ns policy req")
- #raise NSLCMException('Failed to send ns policy req)')
class NSManualScaleView(APIView):
@@ -184,4 +179,4 @@ class NSManualScaleView(APIView):
JobUtil.add_job_status(job_id, 255, 'NS scale failed: %s' % e.message)
return Response(data={'error': 'NS scale failed: %s' % ns_instance_id},
status=status.HTTP_500_INTERNAL_SERVER_ERROR)
- return Response(data={'jobId': job_id}, status=status.HTTP_202_ACCEPTED) \ No newline at end of file
+ return Response(data={'jobId': job_id}, status=status.HTTP_202_ACCEPTED)