diff options
author | Ethan Lynn <ethanlynnl@vmware.com> | 2018-10-16 16:32:26 +0800 |
---|---|---|
committer | Ethan Lynn <ethanlynnl@vmware.com> | 2018-10-16 16:39:19 +0800 |
commit | f495e51cd523a3c7244e51d4dcb7562a3dbd1141 (patch) | |
tree | 3d2fc671eff8575fe63a03f0b16107d1e6b9d7ab | |
parent | 62698670a39ef102f6b955417c511d8a691d985f (diff) |
Add infra_workload simulation API in vio plugin
Add a simulated infra_workload API for testing.
Change-Id: I2e87b249a1b2b670cec97af6c32cba353939df44
Issue-ID: MULTICLOUD-381
Signed-off-by: Ethan Lynn <ethanlynnl@vmware.com>
-rw-r--r-- | vio/vio/swagger/urls.py | 7 | ||||
-rw-r--r-- | vio/vio/swagger/views/fakeplugin/heat/views.py | 31 |
2 files changed, 38 insertions, 0 deletions
diff --git a/vio/vio/swagger/urls.py b/vio/vio/swagger/urls.py index c509a42..568b018 100644 --- a/vio/vio/swagger/urls.py +++ b/vio/vio/swagger/urls.py @@ -119,6 +119,8 @@ from vio.swagger.views.fakeplugin.neutron.views import FakeNeutronNetwork from vio.swagger.views.fakeplugin.heat.views import FakeHeatResources from vio.swagger.views.fakeplugin.heat.views import FakeHeatService from vio.swagger.views.fakeplugin.heat.views import FakeHeatServicePreview +from vio.swagger.views.fakeplugin.heat.views import FakeInfraWorkloadAPIGet +from vio.swagger.views.fakeplugin.heat.views import FakeInfraWorkloadAPIPost urlpatterns = [ @@ -215,6 +217,11 @@ urlpatterns = [ r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)' r'/stacks/(?P<stackName>[0-9a-z-A-Z\-\_]+)' r'/(?P<stackID>[0-9a-z-A-Z\-\_]+)$', FakeHeatService.as_view()), + url(r'api/multicloud-vio/v[01]/vmware[_/]fake/infra_workload$', + FakeInfraWorkloadAPIPost.as_view()), + url(r'api/multicloud-vio/v[01]/vmware[_/]fake/infra_workload$' + r'/(?P<workload_id>[0-9a-z-A-Z\-\_]+)$', + FakeInfraWorkloadAPIGet.as_view()), # vio url(r'^api/multicloud-vio/v0/(?P<vimid>[0-9a-zA-Z_-]+)/' diff --git a/vio/vio/swagger/views/fakeplugin/heat/views.py b/vio/vio/swagger/views/fakeplugin/heat/views.py index b662378..9fe00be 100644 --- a/vio/vio/swagger/views/fakeplugin/heat/views.py +++ b/vio/vio/swagger/views/fakeplugin/heat/views.py @@ -101,3 +101,34 @@ class FakeHeatService(APIView): status=data['error']['code']) return Response(data=data, status=status.HTTP_204_NO_CONTENT) + + +class FakeInfraWorkloadAPIGet(APIView): + + def get(self, request, workload_id): + if workload_id != "fdae10c6-664c-48e2-9e86-7bc2d7e42c26": + return Response(status=status.HTTP_404_NOT_FOUND) + + data = { + "template_type": "heat", + "workload_id": "fdae10c6-664c-48e2-9e86-7bc2d7e42c26", + } + + return Response(data=data, status=status.HTTP_200_OK) + + def delete(self, request, workload_id): + if workload_id != "fdae10c6-664c-48e2-9e86-7bc2d7e42c26": + return Response(status=status.HTTP_404_NOT_FOUND) + + return Response(status=status.HTTP_204_NO_CONTENT) + + +class FakeInfraWorkloadAPIPost(APIView): + + def post(self, request): + data = { + "template_type": "heat", + "workload_id": "fdae10c6-664c-48e2-9e86-7bc2d7e42c26", + } + + return Response(data=data, status=status.HTTP_200_OK) |