summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxinhuili <lxinhui@vmware.com>2018-10-17 02:57:19 +0000
committerGerrit Code Review <gerrit@onap.org>2018-10-17 02:57:19 +0000
commita92a67fb4ec941ec4c684aa488b3004467daf680 (patch)
tree29b8e352a36d161ceb22f8d51b217db234353b6a
parent190a3406e6578272c5b2135d3f81cabab5dd6f42 (diff)
parentf495e51cd523a3c7244e51d4dcb7562a3dbd1141 (diff)
Merge "Add infra_workload simulation API in vio plugin"
-rw-r--r--vio/vio/swagger/urls.py7
-rw-r--r--vio/vio/swagger/views/fakeplugin/heat/views.py31
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)