From 9a78671abf115206392a5d40132dd0e437cc6c9d Mon Sep 17 00:00:00 2001 From: "ying.yunlong" Date: Wed, 9 Aug 2017 09:28:02 +0800 Subject: [PATCH] Remove vfc-gvnfm-vnfmgr openo labels As the seed code comes from openo, there are many openo labels in vfc-gvnfm-vnfmgr, for example, in the Rest URL, now remove the openo labels. Change-Id: I7859ad948a10dc9f3e928d35a65733a2579322df Issue-ID: VFC-85 Signed-off-by: ying.yunlong --- mgr/mgr/pub/config/config.py | 4 ++-- mgr/mgr/swagger/swagger.json | 2 +- mgr/mgr/swagger/tests.py | 2 +- mgr/mgr/swagger/urls.py | 2 +- mgr/mgr/vnfreg/tests.py | 30 +++++++++++++++--------------- mgr/mgr/vnfreg/urls.py | 6 +++--- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/mgr/mgr/pub/config/config.py b/mgr/mgr/pub/config/config.py index eff591f..3e10230 100644 --- a/mgr/mgr/pub/config/config.py +++ b/mgr/mgr/pub/config/config.py @@ -31,11 +31,11 @@ DB_PASSWD = "gvnfm" # [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": "vnfmgr", "version": "v1", - "url": "/openoapi/vnfmgr/v1", + "url": "/api/vnfmgr/v1", "protocol": "REST", "visualRange": "1", "nodes": [{ diff --git a/mgr/mgr/swagger/swagger.json b/mgr/mgr/swagger/swagger.json index 552d26f..743612b 100644 --- a/mgr/mgr/swagger/swagger.json +++ b/mgr/mgr/swagger/swagger.json @@ -4,7 +4,7 @@ "version": "1.0.0", "title": "VNF Mgr Service rest API" }, - "basePath": "/openoapi/vnfmgr/v1", + "basePath": "/api/vnfmgr/v1", "tags": [ { "name": "vnfmgr" diff --git a/mgr/mgr/swagger/tests.py b/mgr/mgr/swagger/tests.py index adf4a78..3aed49b 100644 --- a/mgr/mgr/swagger/tests.py +++ b/mgr/mgr/swagger/tests.py @@ -26,6 +26,6 @@ class SwaggerViewTest(unittest.TestCase): pass def test_sample(self): - response = self.client.get("/openoapi/vnfmgr/v1/swagger.json") + response = self.client.get("/api/vnfmgr/v1/swagger.json") self.assertEqual(status.HTTP_200_OK, response.status_code, response.content) diff --git a/mgr/mgr/swagger/urls.py b/mgr/mgr/swagger/urls.py index 21f7b8e..587dd14 100644 --- a/mgr/mgr/swagger/urls.py +++ b/mgr/mgr/swagger/urls.py @@ -16,5 +16,5 @@ from django.conf.urls import url from mgr.swagger import views urlpatterns = [ - url(r'^openoapi/vnfmgr/v1/swagger.json$', views.SwaggerView.as_view()), + url(r'^api/vnfmgr/v1/swagger.json$', views.SwaggerView.as_view()), ] diff --git a/mgr/mgr/vnfreg/tests.py b/mgr/mgr/vnfreg/tests.py index 11bfd6c..c831489 100644 --- a/mgr/mgr/vnfreg/tests.py +++ b/mgr/mgr/vnfreg/tests.py @@ -105,7 +105,7 @@ class VnfRegTest(unittest.TestCase): pass def test_add_vnf_normal(self): - response = self.client.post("/openoapi/vnfmgr/v1/vnfs", self.vnfInst1, format='json') + response = self.client.post("/api/vnfmgr/v1/vnfs", self.vnfInst1, format='json') self.assertEqual(status.HTTP_201_CREATED, response.status_code, response.content) vnfs = VnfRegModel.objects.filter() self.assertEqual(1, len(vnfs)) @@ -119,14 +119,14 @@ class VnfRegTest(unittest.TestCase): self.assertEqual(self.vnfInst1, vnfInstActual) def test_add_vnf_when_duplicate(self): - self.client.post("/openoapi/vnfmgr/v1/vnfs", self.vnfInst1, format='json') - response = self.client.post("/openoapi/vnfmgr/v1/vnfs", self.vnfInst1, format='json') + self.client.post("/api/vnfmgr/v1/vnfs", self.vnfInst1, format='json') + response = self.client.post("/api/vnfmgr/v1/vnfs", self.vnfInst1, format='json') self.assertEqual(status.HTTP_500_INTERNAL_SERVER_ERROR, response.status_code, response.content) self.assertEqual({'error': "Vnf(1) already exists."}, json.loads(response.content)) def test_set_vnf_normal(self): - self.client.post("/openoapi/vnfmgr/v1/vnfs", self.vnfInst1, format='json') - response = self.client.put("/openoapi/vnfmgr/v1/vnfs/1", + self.client.post("/api/vnfmgr/v1/vnfs", self.vnfInst1, format='json') + response = self.client.put("/api/vnfmgr/v1/vnfs/1", json.dumps(self.vnfInst1_new), content_type='application/json') self.assertEqual(status.HTTP_202_ACCEPTED, response.status_code, response.content) vnfs = VnfRegModel.objects.filter() @@ -141,40 +141,40 @@ class VnfRegTest(unittest.TestCase): self.assertEqual(self.vnfInst1_new, vnfInstActual) def test_set_vnf_when_not_exist(self): - response = self.client.put("/openoapi/vnfmgr/v1/vnfs/1", + response = self.client.put("/api/vnfmgr/v1/vnfs/1", json.dumps(self.vnfInst1_new), content_type='application/json') self.assertEqual(status.HTTP_404_NOT_FOUND, response.status_code, response.content) self.assertEqual({'error': "Vnf(1) does not exist."}, json.loads(response.content)) def test_get_vnf_normal(self): - self.client.post("/openoapi/vnfmgr/v1/vnfs", self.vnfInst1, format='json') - response = self.client.get("/openoapi/vnfmgr/v1/vnfs/1") + self.client.post("/api/vnfmgr/v1/vnfs", self.vnfInst1, format='json') + response = self.client.get("/api/vnfmgr/v1/vnfs/1") self.assertEqual(status.HTTP_200_OK, response.status_code, response.content) self.assertEqual(self.vnfInst1, json.loads(response.content)) def test_get_vnf_when_not_exist(self): - response = self.client.get("/openoapi/vnfmgr/v1/vnfs/1") + response = self.client.get("/api/vnfmgr/v1/vnfs/1") self.assertEqual(status.HTTP_404_NOT_FOUND, response.status_code, response.content) self.assertEqual({'error': "Vnf(1) does not exist."}, json.loads(response.content)) def test_del_vnf_normal(self): - self.client.post("/openoapi/vnfmgr/v1/vnfs", self.vnfInst1, format='json') - response = self.client.delete("/openoapi/vnfmgr/v1/vnfs/1") + self.client.post("/api/vnfmgr/v1/vnfs", self.vnfInst1, format='json') + response = self.client.delete("/api/vnfmgr/v1/vnfs/1") self.assertEqual(status.HTTP_204_NO_CONTENT, response.status_code, response.content) def test_del_vnf_when_not_exist(self): - response = self.client.delete("/openoapi/vnfmgr/v1/vnfs/1") + response = self.client.delete("/api/vnfmgr/v1/vnfs/1") self.assertEqual(status.HTTP_404_NOT_FOUND, response.status_code, response.content) self.assertEqual({'error': "Vnf(1) does not exist."}, json.loads(response.content)) @mock.patch.object(restcall, 'call_req') def test_vnf_config_normal(self, mock_call_req): mock_call_req.return_value = [0, "", '204'] - self.client.post("/openoapi/vnfmgr/v1/vnfs", self.vnfInst1, format='json') - response = self.client.post("/openoapi/vnfmgr/v1/configuration", self.vnfconfig, format='json') + self.client.post("/api/vnfmgr/v1/vnfs", self.vnfInst1, format='json') + response = self.client.post("/api/vnfmgr/v1/configuration", self.vnfconfig, format='json') self.assertEqual(status.HTTP_202_ACCEPTED, response.status_code, response.content) def test_vnf_config_when_not_exist(self): - response = self.client.post("/openoapi/vnfmgr/v1/configuration", self.vnfconfig, format='json') + response = self.client.post("/api/vnfmgr/v1/configuration", self.vnfconfig, format='json') self.assertEqual(status.HTTP_500_INTERNAL_SERVER_ERROR, response.status_code, response.content) self.assertEqual({'error': "Vnf(1) does not exist."}, json.loads(response.content)) diff --git a/mgr/mgr/vnfreg/urls.py b/mgr/mgr/vnfreg/urls.py index c2d3e0c..84b4ad1 100644 --- a/mgr/mgr/vnfreg/urls.py +++ b/mgr/mgr/vnfreg/urls.py @@ -17,9 +17,9 @@ from rest_framework.urlpatterns import format_suffix_patterns from mgr.vnfreg import views urlpatterns = [ - url(r'^openoapi/vnfmgr/v1/vnfs$', views.add_vnf, name='add_vnf'), - url(r'^openoapi/vnfmgr/v1/vnfs/(?P[0-9a-zA-Z\-\_]+)$', views.access_vnf, name='access_vnf'), - url(r'^openoapi/vnfmgr/v1/configuration$', views.vnf_config, name='vnf_config'), + url(r'^api/vnfmgr/v1/vnfs$', views.add_vnf, name='add_vnf'), + url(r'^api/vnfmgr/v1/vnfs/(?P[0-9a-zA-Z\-\_]+)$', views.access_vnf, name='access_vnf'), + url(r'^api/vnfmgr/v1/configuration$', views.vnf_config, name='vnf_config'), ] urlpatterns = format_suffix_patterns(urlpatterns) -- 2.16.6