summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Ke <lokyse@163.com>2018-08-31 07:32:20 +0000
committerGerrit Code Review <gerrit@onap.org>2018-08-31 07:32:20 +0000
commitb0901e69858a9dddde73dabda4f7ae3caeb84206 (patch)
treea3f410e98eaf2dfcd055269eb8c58b915e408044
parentc61027a55ac33d5641833af2a46ab8fbbea262fb (diff)
parent0fcb64cbc5b279802a087a5477d3fad2b88f6649 (diff)
Merge "Update network API to V1"
-rw-r--r--vio/vio/swagger/urls.py39
-rw-r--r--vio/vio/swagger/views/network/views.py20
-rw-r--r--vio/vio/swagger/views/port/views.py20
-rw-r--r--vio/vio/swagger/views/service/views.py6
-rw-r--r--vio/vio/swagger/views/subnet/views.py20
-rw-r--r--vio/vio/swagger/views/tenant/views.py6
6 files changed, 110 insertions, 1 deletions
diff --git a/vio/vio/swagger/urls.py b/vio/vio/swagger/urls.py
index fd6d0ea..c909067 100644
--- a/vio/vio/swagger/urls.py
+++ b/vio/vio/swagger/urls.py
@@ -42,6 +42,13 @@ from vio.swagger.views.server.views import ListServersViewV1, GetServerViewV1
from vio.swagger.views.flavor.views import FlavorsViewV1, FlavorViewV1
from vio.swagger.views.limits.views import LimitsViewV1
from vio.swagger.views.hypervisor.views import HostViewV1
+from vio.swagger.views.service.views import HostsViewV1
+from vio.swagger.views.network.views import CreateNetworkViewV1
+from vio.swagger.views.network.views import DeleteNetworkViewV1
+from vio.swagger.views.subnet.views import CreateSubnetViewV1
+from vio.swagger.views.subnet.views import DeleteSubnetViewV1
+from vio.swagger.views.port.views import CreatePortViewV1, DeletePortViewV1
+from vio.swagger.views.tenant.views import ListTenantsViewV1
# proxy
from vio.swagger.views.proxyplugin.identity.views import TokenView
@@ -175,6 +182,9 @@ urlpatterns = [
# V1 urls
url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
+ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/tenants$',
+ ListTenantsViewV1.as_view()),
+ url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z_-]+)/'
r'images$',
CreateListImagesViewV1.as_view()),
@@ -214,14 +224,41 @@ urlpatterns = [
r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z]+)/'
r'flavors/(?P<flavorid>[0-9a-zA-Z_-]+)$',
FlavorViewV1.as_view()),
- url(r'^api/multicloud-vio/v0/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
+ url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z]+)/'
r'limits$',
LimitsViewV1.as_view()),
url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
+ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z]+)/hosts$',
+ HostsViewV1.as_view()),
+ url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z]+)/'
r'hosts/(?P<hostname>[0-9a-zA-Z_-]+)$',
HostViewV1.as_view()),
+ url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z\-\_]+)/'
+ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z\-\_]+)/'
+ r'networks$',
+ CreateNetworkViewV1.as_view()),
+ url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z\-\_]+)/'
+ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z\-\_]+)/'
+ r'networks/(?P<networkid>[0-9a-zA-Z\-\_]+)$',
+ DeleteNetworkViewV1.as_view()),
+ url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z\-\_]+)/'
+ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z\-\_]+)/'
+ r'subnets$',
+ CreateSubnetViewV1.as_view()),
+ url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z\-\_]+)/'
+ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z\-\_]+)/'
+ r'subnets/(?P<subnetid>[0-9a-zA-Z\-\_]+)$',
+ DeleteSubnetViewV1.as_view()),
+ url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z\-\_]+)/'
+ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z\-\_]+)/'
+ r'ports$',
+ CreatePortViewV1.as_view()),
+ url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z\-\_]+)/'
+ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z\-\_]+)/'
+ r'ports/(?P<portid>[0-9a-zA-Z\-\_]+)$',
+ DeletePortViewV1.as_view()),
# fake urls
url(r'^api/multicloud-vio/v0/vmware_fake/identity/v3',
diff --git a/vio/vio/swagger/views/network/views.py b/vio/vio/swagger/views/network/views.py
index 27d0f3a..6d182e2 100644
--- a/vio/vio/swagger/views/network/views.py
+++ b/vio/vio/swagger/views/network/views.py
@@ -74,6 +74,16 @@ class CreateNetworkView(APIView):
status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+class CreateNetworkViewV1(CreateNetworkView):
+ def post(self, request, cloud_owner, cloud_region, tenantid):
+ return super(CreateNetworkViewV1, self).post(
+ request, cloud_owner + "_" + cloud_region, tenantid)
+
+ def get(self, request, cloud_owner, cloud_region, tenantid):
+ return super(CreateNetworkViewV1, self).get(
+ request, cloud_owner + "_" + cloud_region, tenantid)
+
+
class DeleteNetworkView(APIView):
def get(self, request, vimid, tenantid, networkid):
@@ -119,3 +129,13 @@ class DeleteNetworkView(APIView):
else:
return Response(data={'error': str(e)},
status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+
+
+class DeleteNetworkViewV1(DeleteNetworkView):
+ def get(self, request, cloud_owner, cloud_region, tenantid, networkid):
+ return super(DeleteNetworkViewV1, self).get(
+ request, cloud_owner + "_" + cloud_region, tenantid, networkid)
+
+ def delete(self, request, cloud_owner, cloud_region, tenantid, networkid):
+ return super(DeleteNetworkViewV1, self).delete(
+ request, cloud_owner + "_" + cloud_region, tenantid, networkid)
diff --git a/vio/vio/swagger/views/port/views.py b/vio/vio/swagger/views/port/views.py
index 249e7c3..33d633d 100644
--- a/vio/vio/swagger/views/port/views.py
+++ b/vio/vio/swagger/views/port/views.py
@@ -75,6 +75,16 @@ class CreatePortView(APIView):
status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+class CreatePortViewV1(CreatePortView):
+ def post(self, request, cloud_owner, cloud_region, tenantid):
+ return super(CreatePortViewV1, self).post(
+ request, cloud_owner + "_" + cloud_region, tenantid)
+
+ def get(self, request, cloud_owner, cloud_region, tenantid):
+ return super(CreatePortViewV1, self).get(
+ request, cloud_owner + "_" + cloud_region, tenantid)
+
+
class DeletePortView(APIView):
def get(self, request, vimid, tenantid, portid):
@@ -104,3 +114,13 @@ class DeletePortView(APIView):
else:
return Response(data={'error': str(e)},
status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+
+
+class DeletePortViewV1(DeletePortView):
+ def get(self, request, cloud_owner, cloud_region, tenantid, portid):
+ return super(DeletePortViewV1, self).get(
+ request, cloud_owner + "_" + cloud_region, tenantid, portid)
+
+ def delete(self, request, cloud_owner, cloud_region, tenantid, portid):
+ return super(DeletePortViewV1, self).delete(
+ request, cloud_owner + "_" + cloud_region, tenantid, portid)
diff --git a/vio/vio/swagger/views/service/views.py b/vio/vio/swagger/views/service/views.py
index b632370..239e795 100644
--- a/vio/vio/swagger/views/service/views.py
+++ b/vio/vio/swagger/views/service/views.py
@@ -53,3 +53,9 @@ class HostsView(APIView):
'hosts': hosts}
return Response(data=rsp, status=status.HTTP_200_OK)
+
+
+class HostsViewV1(HostsView):
+ def get(self, request, cloud_owner, cloud_region, tenantid):
+ return super(HostsViewV1, self).get(
+ request, cloud_owner + "_" + cloud_region, tenantid)
diff --git a/vio/vio/swagger/views/subnet/views.py b/vio/vio/swagger/views/subnet/views.py
index 4da8842..c8c412c 100644
--- a/vio/vio/swagger/views/subnet/views.py
+++ b/vio/vio/swagger/views/subnet/views.py
@@ -75,6 +75,16 @@ class CreateSubnetView(APIView):
status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+class CreateSubnetViewV1(CreateSubnetView):
+ def post(self, request, cloud_owner, cloud_region, tenantid):
+ return super(CreateSubnetViewV1, self).post(
+ request, cloud_owner + "_" + cloud_region, tenantid)
+
+ def get(self, request, cloud_owner, cloud_region, tenantid):
+ return super(CreateSubnetViewV1, self).get(
+ request, cloud_owner + "_" + cloud_region, tenantid)
+
+
class DeleteSubnetView(APIView):
def get(self, request, vimid, tenantid, subnetid):
@@ -104,3 +114,13 @@ class DeleteSubnetView(APIView):
else:
return Response(data={'error': str(e)},
status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+
+
+class DeleteSubnetViewV1(DeleteSubnetView):
+ def get(self, request, cloud_owner, cloud_region, tenantid, subnetid):
+ return super(DeleteSubnetViewV1, self).get(
+ request, cloud_owner + "_" + cloud_region, tenantid, subnetid)
+
+ def delete(self, request, cloud_owner, cloud_region, tenantid, subnetid):
+ return super(DeleteSubnetViewV1, self).delete(
+ request, cloud_owner + "_" + cloud_region, tenantid, subnetid)
diff --git a/vio/vio/swagger/views/tenant/views.py b/vio/vio/swagger/views/tenant/views.py
index 004fbbf..0ee58df 100644
--- a/vio/vio/swagger/views/tenant/views.py
+++ b/vio/vio/swagger/views/tenant/views.py
@@ -60,3 +60,9 @@ class ListTenantsView(APIView):
tenant['name'] = project.name
rsp['tenants'].append(tenant)
return Response(data=rsp, status=status.HTTP_200_OK)
+
+
+class ListTenantsViewV1(ListTenantsView):
+ def get(self, request, cloud_owner, cloud_region):
+ return super(ListTenantsViewV1, self).get(
+ request, cloud_owner + "_" + cloud_region)