diff options
author | fujinhua <fu.jinhua@zte.com.cn> | 2019-03-20 17:04:23 +0800 |
---|---|---|
committer | fujinhua <fu.jinhua@zte.com.cn> | 2019-03-20 17:12:06 +0800 |
commit | d5f2d43c566ac4f14c173a5417ab3bec20af452b (patch) | |
tree | 3cb632f1381b8bddbdbf9bccdd429bc203dc5a80 /zte/vmanager | |
parent | 57e9f3a2db08802b8c62c012e2d1513943d4e83c (diff) |
Update api adaptor for terminate vnf
Change-Id: I75704c9c1fea9666ce4aef0970484525214c6157
Issue-ID: VFC-1307
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
Diffstat (limited to 'zte/vmanager')
-rw-r--r-- | zte/vmanager/driver/interfaces/tests.py | 2 | ||||
-rw-r--r-- | zte/vmanager/driver/interfaces/views.py | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/zte/vmanager/driver/interfaces/tests.py b/zte/vmanager/driver/interfaces/tests.py index c0c062c8..5e975f04 100644 --- a/zte/vmanager/driver/interfaces/tests.py +++ b/zte/vmanager/driver/interfaces/tests.py @@ -181,7 +181,7 @@ class InterfacesTest(TestCase): "gracefulTerminationTimeout": 120 } response = self.client.post( - "/api/ztevnfmdriver/v1/ztevnfmid/vnfs/vbras_innstance_id/terminate", data=req_data) + "/api/ztevnfmdriver/v1/ztevnfmid/vnfs/1/terminate", data=req_data) self.assertEqual(status.HTTP_200_OK, response.status_code) expect_resp_data = {"jobId": "1", "vnfInstanceId": "1"} diff --git a/zte/vmanager/driver/interfaces/views.py b/zte/vmanager/driver/interfaces/views.py index 11dd6a09..fd99a92d 100644 --- a/zte/vmanager/driver/interfaces/views.py +++ b/zte/vmanager/driver/interfaces/views.py @@ -193,6 +193,7 @@ class TerminateVnf(APIView): def post(self, request, vnfmid, vnfInstanceId): try: logger.debug("[%s] request.data=%s", fun_name(), request.data) + logger.debug("vnfmid=%s, vnfInstanceId=%s", vnfmid, vnfInstanceId) terminate_vnf_request_serializer = TerminateVnfRequestSerializer(data=request.data) if not terminate_vnf_request_serializer.is_valid(): raise Exception(terminate_vnf_request_serializer.errors) @@ -208,15 +209,15 @@ class TerminateVnf(APIView): user=ignorcase_get(vnfm_info, "userName"), passwd=ignorcase_get(vnfm_info, "password"), auth_type=restcall.rest_no_auth, - resource="v1/vnfs/%s" % vnfInstanceId, + resource="v1/vnfs/%s?NFVOID=1&VNFMID=%s" % (vnfInstanceId, vnfmid), method='delete', - content=json.JSONEncoder().encode(terminate_vnf_request_serializer.data)) + content='{}') if ret[0] != 0: raise Exception(ret[1]) resp = json.JSONDecoder().decode(ret[1]) resp_data = { - "vnfInstanceId": ignorcase_get(resp, "VNFInstanceID"), + "vnfInstanceId": vnfInstanceId, "jobId": ignorcase_get(resp, "JobId") } logger.debug("[%s]resp_data=%s", fun_name(), resp_data) |