diff options
Diffstat (limited to 'gvnfmadapter')
-rw-r--r-- | gvnfmadapter/.gitignore | 4 | ||||
-rw-r--r-- | gvnfmadapter/driver/interfaces/tests.py | 14 | ||||
-rw-r--r-- | gvnfmadapter/driver/interfaces/urls.py | 14 | ||||
-rw-r--r-- | gvnfmadapter/driver/interfaces/views.py | 22 | ||||
-rw-r--r-- | gvnfmadapter/driver/pub/config/config.py | 4 | ||||
-rw-r--r-- | gvnfmadapter/driver/swagger/swagger.json | 2 | ||||
-rw-r--r-- | gvnfmadapter/driver/swagger/tests.py | 2 | ||||
-rw-r--r-- | gvnfmadapter/driver/swagger/urls.py | 2 |
8 files changed, 34 insertions, 30 deletions
diff --git a/gvnfmadapter/.gitignore b/gvnfmadapter/.gitignore new file mode 100644 index 0000000..a1920e6 --- /dev/null +++ b/gvnfmadapter/.gitignore @@ -0,0 +1,4 @@ +.idea +logs/runtime_res.log +*.pyc +bash.exe.stackdump diff --git a/gvnfmadapter/driver/interfaces/tests.py b/gvnfmadapter/driver/interfaces/tests.py index 8b154af..129c1ec 100644 --- a/gvnfmadapter/driver/interfaces/tests.py +++ b/gvnfmadapter/driver/interfaces/tests.py @@ -72,7 +72,7 @@ class InterfacesTest(TestCase): 'inputs':{} } } - response = self.client.post("/openoapi/ztevnfm/v1/1/vnfs", + response = self.client.post("/api/ztevnfm/v1/1/vnfs", data=json.dumps(req_data), content_type="application/json") self.assertEqual(status.HTTP_201_CREATED, response.status_code) print job_info @@ -102,7 +102,7 @@ class InterfacesTest(TestCase): r2 = [0, json.JSONEncoder().encode(job_info), "200"] job_ret = [0, json.JSONEncoder().encode(job_status_info), "200"] mock_call_req.side_effect = [r1, r2, r1, job_ret, r1, r2] - response = self.client.post("/openoapi/ztevnfm/v1/ztevnfmid/vnfs/2/terminate") + response = self.client.post("/api/ztevnfm/v1/ztevnfmid/vnfs/2/terminate") self.assertEqual(status.HTTP_204_NO_CONTENT, response.status_code) self.assertEqual(job_info, response.data) @@ -127,7 +127,7 @@ class InterfacesTest(TestCase): r1 = [0, json.JSONEncoder().encode(vnfm_info), "200"] r2 = [0, json.JSONEncoder().encode(job_info), "200"] mock_call_req.side_effect = [r1, r2] - response = self.client.get("/openoapi/ztevnfm/v1/19ecbb3a-3242-4fa3-9926-8dfb7ddc29ee/vnfs/88") + response = self.client.get("/api/ztevnfm/v1/19ecbb3a-3242-4fa3-9926-8dfb7ddc29ee/vnfs/88") self.assertEqual(status.HTTP_200_OK, response.status_code) expect_resp_data = {"vnfInfo": {"vnfInstanceId": "88", "vnfStatus": "ACTIVE","version":"v1.2.3"}} self.assertEqual(expect_resp_data, response.data) @@ -189,7 +189,7 @@ class InterfacesTest(TestCase): r1 = [0, json.JSONEncoder().encode(vnfm_info), '200'] r2 = [0, json.JSONEncoder().encode(resp_body), '200'] mock_call_req.side_effect = [r1, r2] - response = self.client.get("/openoapi/gvnfmadapter/v1/{vnfmid}/jobs/{jobid}?responseId={responseId}". + response = self.client.get("/api/gvnfmadapter/v1/{vnfmid}/jobs/{jobid}?responseId={responseId}". format(vnfmid=vnfm_info["vnfmId"],jobid=resp_body["ResponseInfo"]["vnfLcOpId"], responseId=resp_body["ResponseInfo"]["responseDescriptor"]["responseId"])) self.assertEqual(status.HTTP_200_OK, response.status_code) @@ -219,7 +219,7 @@ class InterfacesTest(TestCase): ] } mock_call_req.return_value = [0, json.JSONEncoder().encode(vim_info), '201'] - response = self.client.put("/openoapi/gvnfmadapter/v1/resource/grant", + response = self.client.put("/api/gvnfmadapter/v1/resource/grant", data=json.dumps(req_data), content_type='application/json') self.assertEqual(str(status.HTTP_201_CREATED), response.status_code) expect_resp_data = {"vimid": "516cee95-e8ca-4d26-9268-38e343c2e31e", "tenant": "admin"} @@ -279,7 +279,7 @@ class InterfacesTest(TestCase): "vmidlist ": ["vmuuid"]} ] } - response = self.client.post("/openoapi/gvnfmadapter/v1/vnfs/lifecyclechangesnotification", + response = self.client.post("/api/gvnfmadapter/v1/vnfs/lifecyclechangesnotification", data=json.dumps(req_data), content_type='application/json') self.assertEqual(str(status.HTTP_200_OK), response.status_code) expect_resp_data = None @@ -293,7 +293,7 @@ class InterfacesTest(TestCase): "vnfdId": "2" }] }), '200'] - resp = self.client.get("/openoapi/gvnfmadapter/v1/vnfpackages") + resp = self.client.get("/api/gvnfmadapter/v1/vnfpackages") self.assertEqual(status.HTTP_200_OK, resp.status_code) self.assertEqual(1, len(resp.data["csars"])) self.assertEqual("1", resp.data["csars"][0]["csarId"]) diff --git a/gvnfmadapter/driver/interfaces/urls.py b/gvnfmadapter/driver/interfaces/urls.py index 8c1bfc7..054572c 100644 --- a/gvnfmadapter/driver/interfaces/urls.py +++ b/gvnfmadapter/driver/interfaces/urls.py @@ -16,14 +16,14 @@ from django.conf.urls import url from driver.interfaces import views urlpatterns = [ - url(r'^openoapi/(?P<vnfmtype>[0-9a-zA-Z\-\_]+)/v1/(?P<vnfmid>[0-9a-zA-Z\-\_]+)/vnfs$', views.instantiate_vnf, + url(r'^api/(?P<vnfmtype>[0-9a-zA-Z\-\_]+)/v1/(?P<vnfmid>[0-9a-zA-Z\-\_]+)/vnfs$', views.instantiate_vnf, name='instantiate_vnf'), - url(r'^openoapi/(?P<vnfmtype>[0-9a-zA-Z\-\_]+)/v1/(?P<vnfmid>[0-9a-zA-Z\-\_]+)/vnfs/(?P<vnfInstanceId>' + url(r'^api/(?P<vnfmtype>[0-9a-zA-Z\-\_]+)/v1/(?P<vnfmid>[0-9a-zA-Z\-\_]+)/vnfs/(?P<vnfInstanceId>' r'[0-9a-zA-Z\-\_]+)/terminate$',views.terminate_vnf, name='terminate_vnf'), - url(r'^openoapi/(?P<vnfmtype>[0-9a-zA-Z\-\_]+)/v1/(?P<vnfmid>[0-9a-zA-Z\-\_]+)/vnfs/(?P<vnfInstanceId>' + url(r'^api/(?P<vnfmtype>[0-9a-zA-Z\-\_]+)/v1/(?P<vnfmid>[0-9a-zA-Z\-\_]+)/vnfs/(?P<vnfInstanceId>' r'[0-9a-zA-Z\-\_]+)$',views.query_vnf, name='query_vnf'), - url(r'^openoapi/(?P<vnfmtype>[0-9a-zA-Z\-\_]+)/v1/(?P<vnfmid>[0-9a-zA-Z\-\_]+)/jobs/(?P<jobid>[0-9a-zA-Z\-\_]+)$', + url(r'^api/(?P<vnfmtype>[0-9a-zA-Z\-\_]+)/v1/(?P<vnfmid>[0-9a-zA-Z\-\_]+)/jobs/(?P<jobid>[0-9a-zA-Z\-\_]+)$', views.operation_status, name='operation_status'), - url(r'^openoapi/(?P<vnfmtype>[0-9a-zA-Z\-\_]+)/v1/vnfpackages$', views.get_vnfpkgs, name='get_vnfpkgs'), - url(r'^openoapi/(?P<vnfmtype>[0-9a-zA-Z\-\_]+)/v1/resource/grant$', views.grantvnf, name='grantvnf'), - url(r'^openoapi/(?P<vnfmtype>[0-9a-zA-Z\-\_]+)/v1/vnfs/lifecyclechangesnotification$', views.notify, name='notify'),] + url(r'^api/(?P<vnfmtype>[0-9a-zA-Z\-\_]+)/v1/vnfpackages$', views.get_vnfpkgs, name='get_vnfpkgs'), + url(r'^api/(?P<vnfmtype>[0-9a-zA-Z\-\_]+)/v1/resource/grant$', views.grantvnf, name='grantvnf'), + url(r'^api/(?P<vnfmtype>[0-9a-zA-Z\-\_]+)/v1/vnfs/lifecyclechangesnotification$', views.notify, name='notify'),] diff --git a/gvnfmadapter/driver/interfaces/views.py b/gvnfmadapter/driver/interfaces/views.py index c903ab9..efd2631 100644 --- a/gvnfmadapter/driver/interfaces/views.py +++ b/gvnfmadapter/driver/interfaces/views.py @@ -25,15 +25,15 @@ from driver.pub.utils.restcall import req_by_msb from rest_framework import status # ================================================== -vnf_create_url = "openoapi/vnflcm/v1/vnf_instances" -vnf_inst_url = "openoapi/vnflcm/v1/vnf_instances/%s/instantiate" -vnf_delete_url = "openoapi/vnflcm/v1/vnf_instances/%s" -vnf_terminate_url = "openoapi/vnflcm/v1/vnf_instances/%s/terminate" -operation_status_url = "openoapi/vnflcm/v1/vnf_lc_ops/%s?responseId=%s" -vnf_detail_url = "openoapi/vnflcm/v1/vnf_instances/%s" -EXTSYS_GET_VNFM = "openoapi/extsys/v1/vnfms/%s" -vnf_query_url = "openoapi/vnflcm/v1/vnf_instances/%s" -notify_url = 'openoapi/nslcm/v1/vnfs/{vnfInstanceId}/Notify' +vnf_create_url = "api/vnflcm/v1/vnf_instances" +vnf_inst_url = "api/vnflcm/v1/vnf_instances/%s/instantiate" +vnf_delete_url = "api/vnflcm/v1/vnf_instances/%s" +vnf_terminate_url = "api/vnflcm/v1/vnf_instances/%s/terminate" +operation_status_url = "api/vnflcm/v1/vnf_lc_ops/%s?responseId=%s" +vnf_detail_url = "api/vnflcm/v1/vnf_instances/%s" +EXTSYS_GET_VNFM = "api/extsys/v1/vnfms/%s" +vnf_query_url = "api/vnflcm/v1/vnf_instances/%s" +notify_url = 'api/nslcm/v1/vnfs/{vnfInstanceId}/Notify' query_vnf_resp_mapping = { "vnfInstanceId": "", @@ -391,7 +391,7 @@ def operation_status(request, *args, **kwargs): # ================================================== -grant_vnf_url = 'openoapi/nslcm/v1/grantvnf' +grant_vnf_url = 'api/nslcm/v1/grantvnf' @api_view(http_method_names=['PUT']) def grantvnf(request, *args, **kwargs): @@ -434,7 +434,7 @@ def notify(request, *args, **kwargs): @api_view(http_method_names=['GET']) def get_vnfpkgs(request, *args, **kwargs): logger.info("Enter %s", fun_name()) - ret = req_by_msb("openoapi/nslcm/v1/vnfpackage", "GET") + ret = req_by_msb("api/nslcm/v1/vnfpackage", "GET") if ret[0] != 0: return Response(data={'error': ret[1]}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) resp = json.JSONDecoder().decode(ret[1]) diff --git a/gvnfmadapter/driver/pub/config/config.py b/gvnfmadapter/driver/pub/config/config.py index d760979..198ae76 100644 --- a/gvnfmadapter/driver/pub/config/config.py +++ b/gvnfmadapter/driver/pub/config/config.py @@ -18,11 +18,11 @@ MSB_SERVICE_PORT = '80' # [register] REG_TO_MSB_WHEN_START = True -REG_TO_MSB_REG_URL = "/openoapi/microservices/v1/services" +REG_TO_MSB_REG_URL = "/api/microservices/v1/services" REG_TO_MSB_REG_PARAM = { "serviceName": "gvnfmdriver", "version": "v1", - "url": "/openoapi/gvnfmdriver/v1", + "url": "/api/gvnfmdriver/v1", "protocol": "REST", "visualRange": "1", "nodes": [{ diff --git a/gvnfmadapter/driver/swagger/swagger.json b/gvnfmadapter/driver/swagger/swagger.json index 760cc91..eade49b 100644 --- a/gvnfmadapter/driver/swagger/swagger.json +++ b/gvnfmadapter/driver/swagger/swagger.json @@ -4,7 +4,7 @@ "version": "1.0.0", "title": "GVNFM Driver Service rest API" }, - "basePath": "/openoapi/{vnfmtype}/v1", + "basePath": "/api/{vnfmtype}/v1", "tags": [ { "name": "gvnfmdriver" diff --git a/gvnfmadapter/driver/swagger/tests.py b/gvnfmadapter/driver/swagger/tests.py index a2e0b9d..3104b18 100644 --- a/gvnfmadapter/driver/swagger/tests.py +++ b/gvnfmadapter/driver/swagger/tests.py @@ -26,6 +26,6 @@ class SwaggerViewTest(unittest.TestCase): pass def test_sample(self): - response = self.client.get("/openoapi/gvnfmdriver/v1/swagger.json") + response = self.client.get("/api/gvnfmdriver/v1/swagger.json") self.assertEqual(status.HTTP_200_OK, response.status_code, response.content) diff --git a/gvnfmadapter/driver/swagger/urls.py b/gvnfmadapter/driver/swagger/urls.py index d482557..5e8dec7 100644 --- a/gvnfmadapter/driver/swagger/urls.py +++ b/gvnfmadapter/driver/swagger/urls.py @@ -16,5 +16,5 @@ from django.conf.urls import url from driver.swagger import views urlpatterns = [ - url(r'^openoapi/gvnfmdriver/v1/swagger.json$', views.SwaggerView.as_view()), + url(r'^api/gvnfmdriver/v1/swagger.json$', views.SwaggerView.as_view()), ] |