summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEthan Lynn <ethanlynnl@vmware.com>2018-08-30 06:48:58 +0000
committerGerrit Code Review <gerrit@onap.org>2018-08-30 06:48:58 +0000
commit38997b4ff2a8d566297914c6fb86b43cb38f5e58 (patch)
treec5f5057270be84b7e4fab95d8a2560498773ce97
parent5d109dddc6d1e00df385cb92458ba2d2d4e6ce3a (diff)
parent7752a80f98a6c3353fb28647dfb9aa04a7fbd77a (diff)
Merge "Update server API to v1"
-rw-r--r--vio/vio/swagger/urls.py28
-rw-r--r--vio/vio/swagger/views/flavor/views.py20
-rw-r--r--vio/vio/swagger/views/hypervisor/views.py6
-rw-r--r--vio/vio/swagger/views/limits/views.py6
-rw-r--r--vio/vio/swagger/views/server/views.py20
5 files changed, 80 insertions, 0 deletions
diff --git a/vio/vio/swagger/urls.py b/vio/vio/swagger/urls.py
index a4ed9a0..26f5e50 100644
--- a/vio/vio/swagger/urls.py
+++ b/vio/vio/swagger/urls.py
@@ -38,6 +38,10 @@ from vio.swagger.views.image.views import CreateImageFileViewV1
from vio.swagger.views.image.views import GetImageFileViewV1
from vio.swagger.views.volume.views import CreateListVolumeViewV1
from vio.swagger.views.volume.views import GetDeleteVolumeViewV1
+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
# proxy
from vio.swagger.views.proxyplugin.identity.views import TokenView
@@ -194,6 +198,30 @@ urlpatterns = [
r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z_-]+)/'
r'volumes/(?P<volumeid>[0-9a-zA-Z_-]+)$',
GetDeleteVolumeViewV1.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'servers$',
+ ListServersViewV1.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'servers/(?P<serverid>[0-9a-zA-Z_-]+)$',
+ GetServerViewV1.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'flavors$',
+ FlavorsViewV1.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'flavors/(?P<flavorid>[0-9a-zA-Z_-]+)$',
+ FlavorViewV1.as_view()),
+ url(r'^api/multicloud-vio/v0/(?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]+)/'
+ r'hosts/(?P<hostname>[0-9a-zA-Z_-]+)$',
+ HostViewV1.as_view()),
# fake urls
url(r'^api/multicloud-vio/v0/vmware_fake/identity/v3',
diff --git a/vio/vio/swagger/views/flavor/views.py b/vio/vio/swagger/views/flavor/views.py
index 3666301..4e871b7 100644
--- a/vio/vio/swagger/views/flavor/views.py
+++ b/vio/vio/swagger/views/flavor/views.py
@@ -99,6 +99,16 @@ class FlavorsView(APIView):
return Response(data=rsp, status=status.HTTP_200_OK)
+class FlavorsViewV1(FlavorsView):
+ def post(self, request, cloud_owner, cloud_region, tenantid):
+ return super(FlavorsViewV1, self).post(
+ request, cloud_owner + "_" + cloud_region, tenantid)
+
+ def get(self, request, cloud_owner, cloud_region, tenantid):
+ return super(FlavorsViewV1, self).get(
+ request, cloud_owner + "_" + cloud_region, tenantid)
+
+
class FlavorView(APIView):
def get(self, request, vimid, tenantid, flavorid):
@@ -152,3 +162,13 @@ class FlavorView(APIView):
return Response(data={'error': str(e)},
status=status.HTTP_500_INTERNAL_SERVER_ERROR)
return Response(status=status.HTTP_204_NO_CONTENT)
+
+
+class FlavorViewV1(FlavorView):
+ def get(self, request, cloud_owner, cloud_region, tenantid, flavorid):
+ return super(FlavorViewV1, self).get(
+ request, cloud_owner + "_" + cloud_region, tenantid, flavorid)
+
+ def delete(self, request, cloud_owner, cloud_region, tenantid, flavorid):
+ return super(FlavorViewV1, self).delete(
+ request, cloud_owner + "_" + cloud_region, tenantid, flavorid)
diff --git a/vio/vio/swagger/views/hypervisor/views.py b/vio/vio/swagger/views/hypervisor/views.py
index 0f7e1f9..8648784 100644
--- a/vio/vio/swagger/views/hypervisor/views.py
+++ b/vio/vio/swagger/views/hypervisor/views.py
@@ -69,3 +69,9 @@ class HostView(APIView):
'host': nova_utils.hypervisor_formatter(hv)}
return Response(data=rsp, status=status.HTTP_200_OK)
+
+
+class HostViewV1(HostView):
+ def get(self, request, cloud_owner, cloud_region, tenantid, hostname):
+ return super(HostViewV1, self).get(
+ request, cloud_owner + "_" + cloud_region, tenantid, hostname)
diff --git a/vio/vio/swagger/views/limits/views.py b/vio/vio/swagger/views/limits/views.py
index 9682a11..da037c7 100644
--- a/vio/vio/swagger/views/limits/views.py
+++ b/vio/vio/swagger/views/limits/views.py
@@ -51,3 +51,9 @@ class LimitsView(APIView):
rsp.update(nova_utils.server_limits_formatter(server_limits))
return Response(data=rsp, status=status.HTTP_200_OK)
+
+
+class LimitsViewV1(LimitsView):
+ def get(self, request, cloud_owner, cloud_region, tenantid):
+ return super(LimitsViewV1, self).get(
+ request, cloud_owner + "_" + cloud_region, tenantid)
diff --git a/vio/vio/swagger/views/server/views.py b/vio/vio/swagger/views/server/views.py
index 9756303..fca9cb9 100644
--- a/vio/vio/swagger/views/server/views.py
+++ b/vio/vio/swagger/views/server/views.py
@@ -109,6 +109,16 @@ class ListServersView(APIView):
return Response(data=rsp, status=status.HTTP_200_OK)
+class ListServersViewV1(ListServersView):
+ def post(self, request, cloud_owner, cloud_region, tenantid):
+ return super(ListServersViewV1, self).post(
+ request, cloud_owner + "_" + cloud_region, tenantid)
+
+ def get(self, request, cloud_owner, cloud_region, tenantid):
+ return super(ListServersViewV1, self).get(
+ request, cloud_owner + "_" + cloud_region, tenantid)
+
+
class GetServerView(APIView):
def get(self, request, vimid, tenantid, serverid):
@@ -163,3 +173,13 @@ class GetServerView(APIView):
return Response(data={'error': str(e)},
status=status.HTTP_500_INTERNAL_SERVER_ERROR)
return Response(status=status.HTTP_204_NO_CONTENT)
+
+
+class GetServerViewV1(GetServerView):
+ def get(self, request, cloud_owner, cloud_region, tenantid, serverid):
+ return super(GetServerViewV1, self).get(
+ request, cloud_owner + "_" + cloud_region, tenantid, serverid)
+
+ def delete(self, request, cloud_owner, cloud_region, tenantid, serverid):
+ return super(GetServerViewV1, self).delete(
+ request, cloud_owner + "_" + cloud_region, tenantid, serverid)