summaryrefslogtreecommitdiffstats
path: root/lcm
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-03-02 09:25:26 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2017-03-02 09:25:26 +0800
commitcc8e51bd402ec135d7bfab7dcafedbdb47a95da1 (patch)
tree1f7208c10bc319d89eb53f9ccacf9e3b0187d8a9 /lcm
parentcdc405f4119d24a069932b0c446c55a2b8d40bdd (diff)
Modify code and testcase of jobs status
Change-Id: I5e988f72d8108b9d8bb1f347ff68a9fbd11298bc Issue-Id: GVNFM-42 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
Diffstat (limited to 'lcm')
-rw-r--r--lcm/lcm/jobs/tests.py2
-rw-r--r--lcm/lcm/jobs/urls.py2
-rw-r--r--lcm/lcm/jobs/views.py3
-rw-r--r--lcm/lcm/nf/vnfs/vnf_cancel/term_vnf.py2
-rw-r--r--lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py2
-rw-r--r--lcm/lcm/pub/msapi/nfvolcm.py8
6 files changed, 9 insertions, 10 deletions
diff --git a/lcm/lcm/jobs/tests.py b/lcm/lcm/jobs/tests.py
index 20ccc3ec..9957b9cf 100644
--- a/lcm/lcm/jobs/tests.py
+++ b/lcm/lcm/jobs/tests.py
@@ -28,5 +28,5 @@ class JobsViewTest(TestCase):
def test_job(self):
JobModel(jobid=self.job_id, jobtype='VNF', jobaction='INST', resid='1').save()
JobStatusModel(indexid=1, jobid=self.job_id, status='inst', progress=20, descp='inst').save()
- response = self.client.get("/openoapi/vnflcm/v1/jobs/%s" % self.job_id)
+ response = self.client.get("/openoapi/vnflcm/v1/vnf_lc_ops/%s?responseId=123456jhj" % self.job_id)
self.failUnlessEqual(status.HTTP_200_OK, response.status_code) \ No newline at end of file
diff --git a/lcm/lcm/jobs/urls.py b/lcm/lcm/jobs/urls.py
index e05cf873..f2ab2bbd 100644
--- a/lcm/lcm/jobs/urls.py
+++ b/lcm/lcm/jobs/urls.py
@@ -17,7 +17,7 @@ from rest_framework.urlpatterns import format_suffix_patterns
from lcm.jobs.views import JobView
urlpatterns = patterns('',
- url(r'^openoapi/vnflcm/v1/jobs/(?P<job_id>[0-9a-zA-Z_-]+)$', JobView.as_view()),
+ url(r'^openoapi/vnflcm/v1/vnf_lc_ops/(?P<job_id>[0-9a-zA-Z_-]+)$', JobView.as_view()),
)
urlpatterns = format_suffix_patterns(urlpatterns)
diff --git a/lcm/lcm/jobs/views.py b/lcm/lcm/jobs/views.py
index c0cd405c..24f3b19e 100644
--- a/lcm/lcm/jobs/views.py
+++ b/lcm/lcm/jobs/views.py
@@ -17,13 +17,12 @@ from rest_framework.response import Response
from rest_framework.views import APIView
from lcm.jobs.job_get import GetJobInfoService
-from lcm.pub.utils.values import ignore_case_get
logger = logging.getLogger(__name__)
class JobView(APIView):
def get(self, request, job_id):
- response_id = ignore_case_get(request.META, 'responseId')
+ response_id = request.GET.get('responseId')
ret = GetJobInfoService(job_id, response_id).do_biz()
return Response(data=ret)
diff --git a/lcm/lcm/nf/vnfs/vnf_cancel/term_vnf.py b/lcm/lcm/nf/vnfs/vnf_cancel/term_vnf.py
index 2775b42a..85df23cd 100644
--- a/lcm/lcm/nf/vnfs/vnf_cancel/term_vnf.py
+++ b/lcm/lcm/nf/vnfs/vnf_cancel/term_vnf.py
@@ -254,7 +254,7 @@ class TermVnf(Thread):
def lcm_notify(self):
NfInstModel.objects.filter(nfinstid=self.nf_inst_id).update(status='NOT_INSTANTIATED', lastuptime=now_time())
logger.info('[NF termination] send notify request to nfvo end')
- resp = notify_lcm_to_nfvo(self.notify_data, self.nf_inst_id)
+ resp = notify_lcm_to_nfvo(self.notify_data)
logger.info('[NF termination] get lcm response %s' % resp)
logger.info('[NF termination] send notify request to nfvo end')
diff --git a/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py b/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py
index cedc4a42..6ceddbb1 100644
--- a/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py
+++ b/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py
@@ -205,7 +205,7 @@ class InstVnf(Thread):
}
logger.info('content_args=%s' % content_args)
# call rest api
- resp = notify_lcm_to_nfvo(content_args, self.nf_inst_id)
+ resp = notify_lcm_to_nfvo(content_args)
logger.info('[NF instantiation] get lcm response %s' % resp)
logger.info('[NF instantiation] send notify request to nfvo end')
diff --git a/lcm/lcm/pub/msapi/nfvolcm.py b/lcm/lcm/pub/msapi/nfvolcm.py
index 6ea8df1c..f6849da0 100644
--- a/lcm/lcm/pub/msapi/nfvolcm.py
+++ b/lcm/lcm/pub/msapi/nfvolcm.py
@@ -21,7 +21,7 @@ logger = logging.getLogger(__name__)
def get_packageinfo_by_vnfdid(vnfdid):
- ret = req_by_msb("openoapi/nslcm/v1/vnfs/%s" % vnfdid, "GET")
+ ret = req_by_msb("openoapi/gvnfmdriver/v1/%s" % vnfdid, "GET") # TODO
if ret[0] != 0:
logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
raise NFLCMException("Failed to query package_info of vnfdid(%s) from nslcm." % vnfdid)
@@ -29,15 +29,15 @@ def get_packageinfo_by_vnfdid(vnfdid):
def apply_grant_to_nfvo(data):
- ret = req_by_msb("openoapi/nslcm/v1/grantvnf", "POST", data)
+ ret = req_by_msb("openoapi/gvnfmdriver/v1/resource/grant", "PUT", data)
if ret[0] != 0:
logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
raise NFLCMException("Nf instancing apply grant exception")
return json.JSONDecoder().decode(ret[1])
-def notify_lcm_to_nfvo(data, nf_inst_id):
- ret = req_by_msb("openoapi/nslcm/v1/vnfs/%s/Notify" % nf_inst_id, "POST", data)
+def notify_lcm_to_nfvo(data):
+ ret = req_by_msb("openoapi/gvnfmdriver/v1/vnfs/lifecyclechangesnotification", "POST", data)
if ret[0] != 0:
logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
raise NFLCMException("Nf lcm notify exception")