diff options
author | Ethan Lynn <ethanlynnl@vmware.com> | 2017-09-11 13:56:37 -0600 |
---|---|---|
committer | Ethan Lynn <ethanlynnl@vmware.com> | 2017-09-11 14:30:31 -0600 |
commit | 7bb0e9134203a954dd9d1c8f2573294a5ae2b59a (patch) | |
tree | 43889595ad8052968a0cd9c62ec0bc06b4f92a3e | |
parent | ad602833567ee36a937897a43cbc65c6470c63ae (diff) |
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 <ethanlynnl@vmware.com>
-rw-r--r-- | multivimbroker/multivimbroker/forwarder/urls.py | 3 | ||||
-rw-r--r-- | multivimbroker/multivimbroker/forwarder/views.py | 36 |
2 files changed, 39 insertions, 0 deletions
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<vimid>[0-9a-zA-Z_-]+)/identity/v3$', Identity.as_view()), url(r'^api/multicloud/v0/(?P<vimid>[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): |