summaryrefslogtreecommitdiffstats
path: root/vio
diff options
context:
space:
mode:
authorEthan Lynn <ethanlynnl@vmware.com>2018-08-30 14:34:01 +0800
committerEthan Lynn <ethanlynnl@vmware.com>2018-08-30 15:14:13 +0800
commit0fcb64cbc5b279802a087a5477d3fad2b88f6649 (patch)
tree80ae7ea8cbf6bb4312e6f1e24d21eb206d24b782 /vio
parent38997b4ff2a8d566297914c6fb86b43cb38f5e58 (diff)
Update network API to V1
This patch updates network related API to V1. Change-Id: Ide84407151736ef8477e4653047bf9b0cf150060 Issue-ID: MULTICLOUD-349 Signed-off-by: Ethan Lynn <ethanlynnl@vmware.com>
Diffstat (limited to 'vio')
-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 26f5e50..024e18e 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)