diff options
author | Bin Sun <bins@vmware.com> | 2018-08-31 17:17:39 +0800 |
---|---|---|
committer | Bin Sun <bins@vmware.com> | 2018-08-31 17:18:09 +0800 |
commit | 74445002041fdf3ff3087dc86f9a1e75e1a74cb0 (patch) | |
tree | ad30d6a20fbd186e03b5a72f0d87d3943b1051ea /vio | |
parent | 8cfd22df9d2a5b80feb3d651481136e0a1bf2720 (diff) |
Update OpenStack proxy API to v1
Change-Id: If0a02835216228a9a245e22cce6f966815463b5c
Issue-ID: MULTICLOUD-341
Signed-off-by: Bin Sun <bins@vmware.com>
Diffstat (limited to 'vio')
-rw-r--r-- | vio/vio/swagger/urls.py | 75 | ||||
-rw-r--r-- | vio/vio/swagger/views/proxyplugin/dns/views.py | 34 | ||||
-rw-r--r-- | vio/vio/swagger/views/proxyplugin/heat/views.py | 25 | ||||
-rw-r--r-- | vio/vio/swagger/views/proxyplugin/identity/views.py | 64 | ||||
-rw-r--r-- | vio/vio/swagger/views/proxyplugin/image/views.py | 34 | ||||
-rw-r--r-- | vio/vio/swagger/views/proxyplugin/neutron/views.py | 34 | ||||
-rw-r--r-- | vio/vio/swagger/views/proxyplugin/nova/views.py | 21 | ||||
-rw-r--r-- | vio/vio/swagger/views/proxyplugin/volumn/views.py | 25 |
8 files changed, 312 insertions, 0 deletions
diff --git a/vio/vio/swagger/urls.py b/vio/vio/swagger/urls.py index b7bdbcf..3b5dac7 100644 --- a/vio/vio/swagger/urls.py +++ b/vio/vio/swagger/urls.py @@ -65,6 +65,21 @@ from vio.swagger.views.proxyplugin.heat.views import HeatServer from vio.swagger.views.proxyplugin.dns.views import DesignateServer from vio.swagger.views.proxyplugin.dns.views import DesignateVersionLink +# proxy V1 +from vio.swagger.views.proxyplugin.identity.views import TokenViewV1 +from vio.swagger.views.proxyplugin.identity.views import TokenV2ViewV1 +from vio.swagger.views.proxyplugin.identity.views import IdentityServerV1 +from vio.swagger.views.proxyplugin.identity.views import IdentityVersionLinkV1 +from vio.swagger.views.proxyplugin.nova.views import ComputeServerV1 +from vio.swagger.views.proxyplugin.image.views import ImageServerV1 +from vio.swagger.views.proxyplugin.image.views import ImageVersionLinkV1 +from vio.swagger.views.proxyplugin.neutron.views import NetWorkServerV1 +from vio.swagger.views.proxyplugin.neutron.views import NetworkVersionLinkV1 +from vio.swagger.views.proxyplugin.volumn.views import VolumeServerV1 +from vio.swagger.views.proxyplugin.heat.views import HeatServerV1 +from vio.swagger.views.proxyplugin.dns.views import DesignateServerV1 +from vio.swagger.views.proxyplugin.dns.views import DesignateVersionLinkV1 + # Registry from vio.swagger.views.registry.views import Registry, RegistryV1 from vio.swagger.views.registry.views import UnRegistry, UnRegistryV1 @@ -420,6 +435,66 @@ urlpatterns = [ r'designate/(?P<other>(.*))$', DesignateServer.as_view()), + # proxy V1 + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/identity/v3', + TokenViewV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/identity/v2.0$', + TokenV2ViewV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/identity/v2.0/tokens$', + TokenV2ViewV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/identity$', + IdentityVersionLinkV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/identity/(?P<other>(.*))$', + IdentityServerV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/glance$', + ImageVersionLinkV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/glance/(?P<other>(.*))$', + ImageServerV1.as_view()), + url( + r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/' + r'cinder/(?P<tenantid>[0-9a-z-A-Z\-\_]+)/(?P<other>(.*))$', + VolumeServerV1.as_view()), + url( + r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/' + r'cinderv2/(?P<tenantid>[0-9a-z-A-Z\-\_]+)/(?P<other>(.*))$', + VolumeServerV1.as_view()), + url( + r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/cinderv3/' + r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)/(?P<other>(.*))$', + VolumeServerV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/neutron$', + NetworkVersionLinkV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/neutron/(?P<other>(.*))$', + NetWorkServerV1.as_view()), + url( + r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/heat/' + r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)/(?P<other>(.*))$', + HeatServerV1.as_view()), + url( + r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/nova/' + r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)/(?P<other>(.*))$', + ComputeServerV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/designate$', + DesignateVersionLinkV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/designate/(?P<other>(.*))$', + DesignateServerV1.as_view()), + # Extensions url(r'^api/multicloud-vio/v0/(?P<vimid>[0-9a-z-A-Z\-\_]+)' r'/extensions$', diff --git a/vio/vio/swagger/views/proxyplugin/dns/views.py b/vio/vio/swagger/views/proxyplugin/dns/views.py index 6b4819d..5878481 100644 --- a/vio/vio/swagger/views/proxyplugin/dns/views.py +++ b/vio/vio/swagger/views/proxyplugin/dns/views.py @@ -55,6 +55,15 @@ class DesignateVersionLink(BaseClient): return Response(data=res, status=status.HTTP_200_OK) +class DesignateVersionLinkV1(DesignateVersionLink): + + serverType = 'designate' + + def get(self, request, cloud_owner, cloud_region): + return super(DesignateVersionLinkV1, self).get( + request, cloud_owner + "_" + cloud_region) + + class DesignateServer(BaseClient): serverType = "designate" @@ -85,3 +94,28 @@ class DesignateServer(BaseClient): return self.send(request=request, method="DELETE", vimid=vimid, other=other) + + +class DesignateServerV1(DesignateServer): + + serverType = 'designate' + + def get(self, request, cloud_owner, cloud_region, other=None): + return super(DesignateServerV1, self).get( + request, cloud_owner + "_" + cloud_region, other) + + def post(self, request, cloud_owner, cloud_region, other): + return super(DesignateServerV1, self).post( + request, cloud_owner + "_" + cloud_region, other) + + def patch(self, request, cloud_owner, cloud_region, other): + return super(DesignateServerV1, self).patch( + request, cloud_owner + "_" + cloud_region, other) + + def put(self, request, cloud_owner, cloud_region, other): + return super(DesignateServerV1, self).put( + request, cloud_owner + "_" + cloud_region, other) + + def delete(self, request, cloud_owner, cloud_region, other): + return super(DesignateServerV1, self).delete( + request, cloud_owner + "_" + cloud_region, other) diff --git a/vio/vio/swagger/views/proxyplugin/heat/views.py b/vio/vio/swagger/views/proxyplugin/heat/views.py index 5e0de68..4c56f18 100644 --- a/vio/vio/swagger/views/proxyplugin/heat/views.py +++ b/vio/vio/swagger/views/proxyplugin/heat/views.py @@ -43,3 +43,28 @@ class HeatServer(BaseClient): return self.send(request=request, method="PATCH", vimid=vimid, tenantid=tenantid, other=other) + + +class HeatServerV1(HeatServer): + + serverType = 'heat' + + def get(self, request, cloud_owner, cloud_region, tenantid, other): + return super(HeatServerV1, self).get( + request, cloud_owner + "_" + cloud_region, tenantid, other) + + def post(self, request, cloud_owner, cloud_region, tenantid, other): + return super(HeatServerV1, self).post( + request, cloud_owner + "_" + cloud_region, tenantid, other) + + def patch(self, request, cloud_owner, cloud_region, tenantid, other): + return super(HeatServerV1, self).patch( + request, cloud_owner + "_" + cloud_region, tenantid, other) + + def put(self, request, cloud_owner, cloud_region, tenantid, other): + return super(HeatServerV1, self).put( + request, cloud_owner + "_" + cloud_region, tenantid, other) + + def delete(self, request, cloud_owner, cloud_region, tenantid, other): + return super(HeatServerV1, self).delete( + request, cloud_owner + "_" + cloud_region, tenantid, other) diff --git a/vio/vio/swagger/views/proxyplugin/identity/views.py b/vio/vio/swagger/views/proxyplugin/identity/views.py index c6db117..6ff8b2a 100644 --- a/vio/vio/swagger/views/proxyplugin/identity/views.py +++ b/vio/vio/swagger/views/proxyplugin/identity/views.py @@ -64,6 +64,15 @@ class IdentityVersionLink(BaseClient): return Response(data=res, status=status.HTTP_200_OK) +class IdentityVersionLinkV1(IdentityVersionLink): + + serverType = 'keystone' + + def get(self, request, cloud_owner, cloud_region): + return super(IdentityVersionLinkV1, self).get( + request, cloud_owner + "_" + cloud_region) + + class IdentityServer(BaseClient): serverType = 'keystone' @@ -96,6 +105,31 @@ class IdentityServer(BaseClient): vimid=vimid, other=other) +class IdentityServerV1(IdentityServer): + + serverType = 'keystone' + + def get(self, request, cloud_owner, cloud_region, other=None): + return super(IdentityServerV1, self).get( + request, cloud_owner + "_" + cloud_region, other) + + def post(self, request, cloud_owner, cloud_region, other): + return super(IdentityServerV1, self).post( + request, cloud_owner + "_" + cloud_region, other) + + def patch(self, request, cloud_owner, cloud_region, other): + return super(IdentityServerV1, self).patch( + request, cloud_owner + "_" + cloud_region, other) + + def put(self, request, cloud_owner, cloud_region, other): + return super(IdentityServerV1, self).put( + request, cloud_owner + "_" + cloud_region, other) + + def head(self, request, cloud_owner, cloud_region, other): + return super(IdentityServerV1, self).head( + request, cloud_owner + "_" + cloud_region, other) + + class TokenView(BaseClient): serverType = 'identity' @@ -238,6 +272,23 @@ class TokenView(BaseClient): return Res +class TokenViewV1(TokenView): + + serverType = 'identity' + + def get(self, request, cloud_owner, cloud_region): + return super(TokenViewV1, self).get( + request, cloud_owner + "_" + cloud_region) + + def post(self, request, cloud_owner, cloud_region): + return super(TokenViewV1, self).post( + request, cloud_owner + "_" + cloud_region) + + def delete(self, request, cloud_owner, cloud_region): + return super(TokenViewV1, self).delete( + request, cloud_owner + "_" + cloud_region) + + class TokenV2View(BaseClient): serverType = "identity" @@ -294,6 +345,19 @@ class TokenV2View(BaseClient): create_req=create_req) +class TokenV2ViewV1(TokenV2View): + + serverType = 'identity' + + def get(self, request, cloud_owner, cloud_region): + return super(TokenV2ViewV1, self).get( + request, cloud_owner + "_" + cloud_region) + + def post(self, request, cloud_owner, cloud_region): + return super(TokenV2ViewV1, self).post( + request, cloud_owner + "_" + cloud_region) + + def _keystoneV2Token(url, vimid=None, create_req=None): try: diff --git a/vio/vio/swagger/views/proxyplugin/image/views.py b/vio/vio/swagger/views/proxyplugin/image/views.py index 0156131..e183152 100644 --- a/vio/vio/swagger/views/proxyplugin/image/views.py +++ b/vio/vio/swagger/views/proxyplugin/image/views.py @@ -53,6 +53,15 @@ class ImageVersionLink(BaseClient): return Response(data=res, status=status.HTTP_300_MULTIPLE_CHOICES) +class ImageVersionLinkV1(ImageVersionLink): + + serverType = 'glance' + + def get(self, request, cloud_owner, cloud_region): + return super(ImageVersionLinkV1, self).get( + request, cloud_owner + "_" + cloud_region) + + class ImageServer(BaseClient): serverType = "glance" @@ -83,3 +92,28 @@ class ImageServer(BaseClient): return self.send(request=request, method="DELETE", vimid=vimid, other=other) + + +class ImageServerV1(ImageServer): + + serverType = 'glance' + + def get(self, request, cloud_owner, cloud_region, other=None): + return super(ImageServerV1, self).get( + request, cloud_owner + "_" + cloud_region, other) + + def post(self, request, cloud_owner, cloud_region, other): + return super(ImageServerV1, self).post( + request, cloud_owner + "_" + cloud_region, other) + + def patch(self, request, cloud_owner, cloud_region, other): + return super(ImageServerV1, self).patch( + request, cloud_owner + "_" + cloud_region, other) + + def put(self, request, cloud_owner, cloud_region, other): + return super(ImageServerV1, self).put( + request, cloud_owner + "_" + cloud_region, other) + + def delete(self, request, cloud_owner, cloud_region, other): + return super(ImageServerV1, self).delete( + request, cloud_owner + "_" + cloud_region, other) diff --git a/vio/vio/swagger/views/proxyplugin/neutron/views.py b/vio/vio/swagger/views/proxyplugin/neutron/views.py index d6b23e6..47590ed 100644 --- a/vio/vio/swagger/views/proxyplugin/neutron/views.py +++ b/vio/vio/swagger/views/proxyplugin/neutron/views.py @@ -53,6 +53,15 @@ class NetworkVersionLink(BaseClient): return Response(data=res, status=status.HTTP_200_OK) +class NetworkVersionLinkV1(NetworkVersionLink): + + serverType = 'neutron' + + def get(self, request, cloud_owner, cloud_region): + return super(NetworkVersionLinkV1, self).get( + request, cloud_owner + "_" + cloud_region) + + class NetWorkServer(BaseClient): serverType = "neutron" @@ -83,3 +92,28 @@ class NetWorkServer(BaseClient): return self.send(request=request, method="DELETE", vimid=vimid, other=other) + + +class NetWorkServerV1(NetWorkServer): + + serverType = 'neutron' + + def get(self, request, cloud_owner, cloud_region, other=None): + return super(NetWorkServerV1, self).get( + request, cloud_owner + "_" + cloud_region, other) + + def post(self, request, cloud_owner, cloud_region, other): + return super(NetWorkServerV1, self).post( + request, cloud_owner + "_" + cloud_region, other) + + def patch(self, request, cloud_owner, cloud_region, other): + return super(NetWorkServerV1, self).patch( + request, cloud_owner + "_" + cloud_region, other) + + def put(self, request, cloud_owner, cloud_region, other): + return super(NetWorkServerV1, self).put( + request, cloud_owner + "_" + cloud_region, other) + + def delete(self, request, cloud_owner, cloud_region, other): + return super(NetWorkServerV1, self).delete( + request, cloud_owner + "_" + cloud_region, other) diff --git a/vio/vio/swagger/views/proxyplugin/nova/views.py b/vio/vio/swagger/views/proxyplugin/nova/views.py index c61ec37..3527b88 100644 --- a/vio/vio/swagger/views/proxyplugin/nova/views.py +++ b/vio/vio/swagger/views/proxyplugin/nova/views.py @@ -38,3 +38,24 @@ class ComputeServer(BaseClient): return self.send(request=request, method="DELETE", vimid=vimid, tenantid=tenantid, other=other) + + +class ComputeServerV1(ComputeServer): + + serverType = 'nova' + + def get(self, request, cloud_owner, cloud_region, tenantid, other): + return super(ComputeServerV1, self).get( + request, cloud_owner + "_" + cloud_region, tenantid, other) + + def post(self, request, cloud_owner, cloud_region, tenantid, other): + return super(ComputeServerV1, self).post( + request, cloud_owner + "_" + cloud_region, tenantid, other) + + def put(self, request, cloud_owner, cloud_region, tenantid, other): + return super(ComputeServerV1, self).put( + request, cloud_owner + "_" + cloud_region, tenantid, other) + + def delete(self, request, cloud_owner, cloud_region, tenantid, other): + return super(ComputeServerV1, self).delete( + request, cloud_owner + "_" + cloud_region, tenantid, other) diff --git a/vio/vio/swagger/views/proxyplugin/volumn/views.py b/vio/vio/swagger/views/proxyplugin/volumn/views.py index 3b3013c..01902e1 100644 --- a/vio/vio/swagger/views/proxyplugin/volumn/views.py +++ b/vio/vio/swagger/views/proxyplugin/volumn/views.py @@ -45,6 +45,31 @@ class VolumeServer(BaseClient): tenantid=tenantid, other=other) +class VolumeServerV1(VolumeServer): + + serverType = 'cinder' + + def get(self, request, cloud_owner, cloud_region, tenantid, other): + return super(VolumeServerV1, self).get( + request, cloud_owner + "_" + cloud_region, tenantid, other) + + def post(self, request, cloud_owner, cloud_region, tenantid, other): + return super(VolumeServerV1, self).post( + request, cloud_owner + "_" + cloud_region, tenantid, other) + + def patch(self, request, cloud_owner, cloud_region, tenantid, other): + return super(VolumeServerV1, self).patch( + request, cloud_owner + "_" + cloud_region, tenantid, other) + + def put(self, request, cloud_owner, cloud_region, tenantid, other): + return super(VolumeServerV1, self).put( + request, cloud_owner + "_" + cloud_region, tenantid, other) + + def delete(self, request, cloud_owner, cloud_region, tenantid, other): + return super(VolumeServerV1, self).delete( + request, cloud_owner + "_" + cloud_region, tenantid, other) + + class VolumeServer2(VolumeServer): serverType = "cinderv2" |