summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--res/res/pub/config/config.py4
-rw-r--r--res/res/resources/swagger.json2
-rw-r--r--res/res/resources/tests.py18
-rw-r--r--res/res/resources/urls.py18
5 files changed, 22 insertions, 22 deletions
diff --git a/.gitignore b/.gitignore
index 60be8cd..b804f17 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
-res/.idea
+.idea
res/logs/runtime_res.log
*.pyc
bash.exe.stackdump
diff --git a/res/res/pub/config/config.py b/res/res/pub/config/config.py
index e5c554a..86701be 100644
--- a/res/res/pub/config/config.py
+++ b/res/res/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": "vnfres",
"version": "v1",
- "url": "/openoapi/vnfres/v1",
+ "url": "/api/vnfres/v1",
"protocol": "REST",
"visualRange": "1",
"nodes": [{
diff --git a/res/res/resources/swagger.json b/res/res/resources/swagger.json
index 61d00e4..47dccc8 100644
--- a/res/res/resources/swagger.json
+++ b/res/res/resources/swagger.json
@@ -5,7 +5,7 @@
"title": "ZTE vManager Service rest API"
},
"host": "10.43.104.27:8000",
- "basePath": "/openoapi/vnfres/v1",
+ "basePath": "/api/vnfres/v1",
"tags": [
{
"name": "res Resource"
diff --git a/res/res/resources/tests.py b/res/res/resources/tests.py
index 2ab5a0a..4bddc71 100644
--- a/res/res/resources/tests.py
+++ b/res/res/resources/tests.py
@@ -150,7 +150,7 @@ class ResourceTest(TestCase):
NfInstModel(nfinstid=vnf_inst_id, nf_name='VNF1').save()
StorageInstModel(storageid='s02', vimid='vim01', resouceid='resource01', insttype=1,\
instid=vnf_inst_id, storagetype='desc01', size='ten').save()
- response = self.client.get("/openoapi/vnfres/v1/vnfs/%s" % vnf_inst_id)
+ response = self.client.get("/api/vnfres/v1/vnfs/%s" % vnf_inst_id)
self.failUnlessEqual(status.HTTP_200_OK, response.status_code)
self.assertEqual(self.test_data, response.data)
@@ -159,7 +159,7 @@ class ResourceTest(TestCase):
for i in range(1):
NfInstModel(nfinstid='%s' % i, nf_name='VNF%s' % i).save()
StorageInstModel(storageid='s0%s' % i, vimid='vim0%s' % i, resouceid='resource0%s' % i, insttype=1, instid='%s' % i, storagetype='desc%s' % i, size='ten').save()
- response = self.client.get("/openoapi/vnfres/v1/vnfs")
+ response = self.client.get("/api/vnfres/v1/vnfs")
self.failUnlessEqual(status.HTTP_200_OK, response.status_code)
# self.assertEqual(self.test_data, response.data)
@@ -168,7 +168,7 @@ class ResourceTest(TestCase):
nfInst = NfInstModel.objects.get(pk='01')
for i in range(1):
VmInstModel(vmid='vm%s' % i, vimid='vim%s' % i, resouceid='res%s' % i, instid='%s' % nfInst.nfinstid, insttype=0, vmname='v1', nic_array='nic%s' % i, metadata='meta%s' % i, volume_array='volume%s' % i, server_group='server%s' % i, availability_zone='ava%s' %i, flavor_id='flavor%s' % i, security_groups='sec%s' % i).save()
- response = self.client.get("/openoapi/vnfres/v1/%s/vms" % nfInst.nfinstid)
+ response = self.client.get("/api/vnfres/v1/%s/vms" % nfInst.nfinstid)
self.failUnlessEqual(status.HTTP_200_OK, response.status_code)
self.assertEqual(self.vms_data, response.data)
@@ -177,7 +177,7 @@ class ResourceTest(TestCase):
nfInst = NfInstModel.objects.get(pk='01')
for i in range(1):
FlavourInstModel(flavourid='fla%s' % i, name='fname%s' % i, vcpu='%d' % i, instid='%s' % nfInst.nfinstid, memory='%d' % i, extraspecs='ext%s' % i, vimid='vim%s' % i, resouceid='res%s' % i).save()
- response = self.client.get("/openoapi/vnfres/v1/%s/flavors" % nfInst.nfinstid)
+ response = self.client.get("/api/vnfres/v1/%s/flavors" % nfInst.nfinstid)
self.failUnlessEqual(status.HTTP_200_OK, response.status_code)
self.assertEqual(self.flavors_data, response.data)
@@ -185,31 +185,31 @@ class ResourceTest(TestCase):
for i in range(1):
NetworkInstModel(networkid='net%s' % i, name='net_name%s' % i, vimid='vim%s' % i, instid='%s' % self.nf_inst_id,
resouceid='res%s' % i, insttype='%d' % i).save()
- response = self.client.get("/openoapi/vnfres/v1/%s/networks" % self.nf_inst_id)
+ response = self.client.get("/api/vnfres/v1/%s/networks" % self.nf_inst_id)
self.failUnlessEqual(status.HTTP_200_OK, response.status_code)
self.assertEqual(self.networks_data, response.data)
def test_get_subnets(self):
for i in range(1):
SubNetworkInstModel(subnetworkid="sub%s" % i, vimid='vim%s' % i, resouceid='res%s' % i, networkid='net%s' % i, insttype='%d' % i, instid='%s' % self.nf_inst_id, name='sub_name%s' % i, cidr="cidr%s" % i).save()
- response = self.client.get("/openoapi/vnfres/v1/%s/subnets" % self.nf_inst_id)
+ response = self.client.get("/api/vnfres/v1/%s/subnets" % self.nf_inst_id)
self.failUnlessEqual(status.HTTP_200_OK, response.status_code)
self.assertEqual(self.subnets_data, response.data)
def test_get_cps(self):
for i in range(1):
CPInstModel(cpinstanceid="cp%s" % i, cpdid='cpd%s' % i, cpinstancename='cpinstname%s' % i, vlinstanceid='vlinst%s' % i, ownertype='%d' % i, ownerid='%s' % self.nf_inst_id, relatedtype='%d' % i).save()
- response = self.client.get("/openoapi/vnfres/v1/%s/cps" % self.nf_inst_id)
+ response = self.client.get("/api/vnfres/v1/%s/cps" % self.nf_inst_id)
self.failUnlessEqual(status.HTTP_200_OK, response.status_code)
self.assertEqual(self.cps_data, response.data)
def test_get_volumes(self):
for i in range(1):
StorageInstModel(storageid="st%s" % i, vimid='vim%s' % i, resouceid='res%s' % i, insttype='%d' % i, instid='%s' % self.nf_inst_id, storagetype='stype%s' % i, size='%s' % i).save()
- response = self.client.get("/openoapi/vnfres/v1/%s/volumes" % self.nf_inst_id)
+ response = self.client.get("/api/vnfres/v1/%s/volumes" % self.nf_inst_id)
self.assertEqual(self.volumes_data, response.data)
self.failUnlessEqual(status.HTTP_200_OK, response.status_code)
def test_swagger_ok(self):
- resp = self.client.get("/openoapi/vnfres/v1/swagger.json", format='json')
+ resp = self.client.get("/api/vnfres/v1/swagger.json", format='json')
self.assertEqual(resp.status_code, status.HTTP_200_OK, resp.content) \ No newline at end of file
diff --git a/res/res/resources/urls.py b/res/res/resources/urls.py
index 76a39a1..b855a60 100644
--- a/res/res/resources/urls.py
+++ b/res/res/resources/urls.py
@@ -19,15 +19,15 @@ from res.resources import views
from res.resources.views import SwaggerJsonView
urlpatterns = [
- url(r'^openoapi/vnfres/v1/vnfs/(?P<vnfInstanceId>[0-9a-zA-Z\-\_]+)$', views.get_vnf, name='get_vnf'),
- url(r'^openoapi/vnfres/v1/vnfs$', views.get_vnfs, name='get_vnfs'),
- url(r'^'+'openoapi/vnfres/v1/(?P<vnfInstanceId>[0-9a-zA-Z\-\_]+)/vms$', views.get_vms, name='get_vms'),
- url(r'^'+'openoapi/vnfres/v1/(?P<vnfInstanceId>[0-9a-zA-Z\-\_]+)/flavors$', views.get_flavors, name='get_flavors'),
- url(r'^'+'openoapi/vnfres/v1/(?P<vnfInstanceId>[0-9a-zA-Z\-\_]+)/networks$', views.get_networks, name='get_networks'),
- url(r'^'+'openoapi/vnfres/v1/(?P<vnfInstanceId>[0-9a-zA-Z\-\_]+)/subnets$', views.get_subnets, name='get_subnets'),
- url(r'^'+'openoapi/vnfres/v1/(?P<vnfInstanceId>[0-9a-zA-Z\-\_]+)/cps$', views.get_cps, name='get_cps'),
- url(r'^'+'openoapi/vnfres/v1/(?P<vnfInstanceId>[0-9a-zA-Z\-\_]+)/volumes$', views.get_volumes, name='get_volumes'),
- url(r'^openoapi/vnfres/v1/swagger.json$', SwaggerJsonView.as_view()),
+ url(r'^api/vnfres/v1/vnfs/(?P<vnfInstanceId>[0-9a-zA-Z\-\_]+)$', views.get_vnf, name='get_vnf'),
+ url(r'^api/vnfres/v1/vnfs$', views.get_vnfs, name='get_vnfs'),
+ url(r'^'+'api/vnfres/v1/(?P<vnfInstanceId>[0-9a-zA-Z\-\_]+)/vms$', views.get_vms, name='get_vms'),
+ url(r'^'+'api/vnfres/v1/(?P<vnfInstanceId>[0-9a-zA-Z\-\_]+)/flavors$', views.get_flavors, name='get_flavors'),
+ url(r'^'+'api/vnfres/v1/(?P<vnfInstanceId>[0-9a-zA-Z\-\_]+)/networks$', views.get_networks, name='get_networks'),
+ url(r'^'+'api/vnfres/v1/(?P<vnfInstanceId>[0-9a-zA-Z\-\_]+)/subnets$', views.get_subnets, name='get_subnets'),
+ url(r'^'+'api/vnfres/v1/(?P<vnfInstanceId>[0-9a-zA-Z\-\_]+)/cps$', views.get_cps, name='get_cps'),
+ url(r'^'+'api/vnfres/v1/(?P<vnfInstanceId>[0-9a-zA-Z\-\_]+)/volumes$', views.get_volumes, name='get_volumes'),
+ url(r'^api/vnfres/v1/swagger.json$', SwaggerJsonView.as_view()),
]
urlpatterns = format_suffix_patterns(urlpatterns)