From 7bb0e9134203a954dd9d1c8f2573294a5ae2b59a Mon Sep 17 00:00:00 2001 From: Ethan Lynn Date: Mon, 11 Sep 2017 13:56:37 -0600 Subject: Add vim_types API to MultiCloud Framework It will be consumed by ESR. Change-Id: I6e6388f220aae32950b6a9491557a12db5b9a1f2 issue-id: MULTICLOUD-88 Signed-off-by: Ethan Lynn --- multivimbroker/multivimbroker/forwarder/urls.py | 3 ++ multivimbroker/multivimbroker/forwarder/views.py | 36 ++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/multivimbroker/multivimbroker/forwarder/urls.py b/multivimbroker/multivimbroker/forwarder/urls.py index ee4098b..5b3fc41 100644 --- a/multivimbroker/multivimbroker/forwarder/urls.py +++ b/multivimbroker/multivimbroker/forwarder/urls.py @@ -19,9 +19,12 @@ from multivimbroker.forwarder.views import Extension from multivimbroker.forwarder.views import Forward from multivimbroker.forwarder.views import Identity from multivimbroker.forwarder.views import Registry +from multivimbroker.forwarder.views import VIMTypes urlpatterns = [ + url(r'^api/multicloud/v0/vim_types$', + VIMTypes.as_view()), url(r'^api/multicloud/v0/(?P[0-9a-zA-Z_-]+)/identity/v3$', Identity.as_view()), url(r'^api/multicloud/v0/(?P[0-9a-zA-Z_-]+)/identity/v3' diff --git a/multivimbroker/multivimbroker/forwarder/views.py b/multivimbroker/multivimbroker/forwarder/views.py index edb9be1..623aaa8 100644 --- a/multivimbroker/multivimbroker/forwarder/views.py +++ b/multivimbroker/multivimbroker/forwarder/views.py @@ -13,6 +13,8 @@ # limitations under the License. from rest_framework.views import APIView +from rest_framework.views import Response +from rest_framework.views import status from multivimbroker.forwarder.base import BaseHandler # @@ -70,6 +72,40 @@ class Extension(BaseServer): return self.send(vimid, request.get_full_path(), request.body, "GET") +class VIMTypes(BaseServer): + + def get(self, request): + # Fix here unless we have plugin registry + data = { + "vim_types": [ + { + "vim_type": "openstack", + "versions": [ + { + "version": "mitaka", + "extra_info_hint": "" + }, + { + "version": "ocata", + "extra_info_hint": "" + } + ] + }, + { + "vim_type": "vmware", + "versions": [ + { + "version": "4.0", + "extra_info_hint": "" + } + ] + } + ] + } + + return Response(data=data, status=status.HTTP_200_OK) + + # forward handler class Forward(BaseServer): -- cgit 1.2.3-korg