summaryrefslogtreecommitdiffstats
path: root/multivimbroker
diff options
context:
space:
mode:
Diffstat (limited to 'multivimbroker')
-rw-r--r--multivimbroker/multivimbroker/forwarder/urls.py8
-rw-r--r--multivimbroker/multivimbroker/forwarder/views.py18
-rw-r--r--multivimbroker/multivimbroker/swagger/multivim.server.swagger.json82
3 files changed, 107 insertions, 1 deletions
diff --git a/multivimbroker/multivimbroker/forwarder/urls.py b/multivimbroker/multivimbroker/forwarder/urls.py
index 5e1320e..b14333f 100644
--- a/multivimbroker/multivimbroker/forwarder/urls.py
+++ b/multivimbroker/multivimbroker/forwarder/urls.py
@@ -16,6 +16,7 @@
from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns
+# API v0
from multivimbroker.forwarder.views import CheckCapacity
from multivimbroker.forwarder.views import Extension
from multivimbroker.forwarder.views import Forward
@@ -34,8 +35,10 @@ from multivimbroker.forwarder.views import APIv1Registry
from multivimbroker.forwarder.views import APIv1UnRegistry
from multivimbroker.forwarder.views import APIv1VIMTypes
from multivimbroker.forwarder.views import APIv1MultiPartView
+from multivimbroker.forwarder.views import APIv1InfraWorkload
urlpatterns = [
+ # API v0
url(r'^api/multicloud/v0/vim_types$',
VIMTypes.as_view()),
url(r'^api/multicloud/v0/check_vim_capacity$',
@@ -69,7 +72,7 @@ urlpatterns = [
url(r'^api/multicloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)'
r'/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/registry$',
APIv1Registry.as_view()),
- url(r'^api/multicloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)i'
+ url(r'^api/multicloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)'
r'/(?P<cloud_region_id>[0-9a-zA-Z_-]+)$',
APIv1UnRegistry.as_view()),
url(r'^api/multicloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)'
@@ -81,6 +84,9 @@ urlpatterns = [
url(r'^api/multicloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)'
r'/(?P<cloud_region_id>[0-9a-zA-Z_-]+)',
APIv1Forward.as_view()),
+ url(r'^api/multicloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)'
+ r'/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/infra_workload',
+ APIv1InfraWorkload.as_view()),
]
urlpatterns = format_suffix_patterns(urlpatterns)
diff --git a/multivimbroker/multivimbroker/forwarder/views.py b/multivimbroker/multivimbroker/forwarder/views.py
index ef7ab95..264692e 100644
--- a/multivimbroker/multivimbroker/forwarder/views.py
+++ b/multivimbroker/multivimbroker/forwarder/views.py
@@ -307,3 +307,21 @@ class APIv1MultiPartView(MultiPartView):
vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id)
return super(APIv1MultiPartView, self).post(request, vimid)
+
+
+class APIv1InfraWorkload(BaseServer):
+
+ def post(self, request, cloud_owner, cloud_region_id):
+ vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id)
+ return self.send(vimid, request.get_full_path(), request.body, "POST",
+ headers=originHeaders(request))
+
+ def get(self, request, cloud_owner, cloud_region_id):
+ vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id)
+ return self.send(vimid, request.get_full_path(), request.body, "GET",
+ headers=originHeaders(request))
+
+ def delete(self, request, cloud_owner, cloud_region_id):
+ vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id)
+ return self.send(vimid, request.get_full_path(), request.body,
+ "DELETE", headers=originHeaders(request))
diff --git a/multivimbroker/multivimbroker/swagger/multivim.server.swagger.json b/multivimbroker/multivimbroker/swagger/multivim.server.swagger.json
index f54b481..7f949aa 100644
--- a/multivimbroker/multivimbroker/swagger/multivim.server.swagger.json
+++ b/multivimbroker/multivimbroker/swagger/multivim.server.swagger.json
@@ -231,6 +231,65 @@
}
}
}
+ },
+ "/{vimid}/{tenantid}/servers/{serverid}/action": {
+ "post": {
+ "tags": [
+ "vim servers action"
+ ],
+ "summary": "operate a server",
+ "description": "operate a server",
+ "operationId": "operate_vim_server",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "parameters": [
+ {
+ "name": "vimid",
+ "in": "path",
+ "description": "vim instance id",
+ "required": true,
+ "type": "string"
+ },
+ {
+ "name": "tenantid",
+ "in": "path",
+ "description": "tenant UUID",
+ "required": true,
+ "type": "string"
+ },
+ {
+ "name": "serverid",
+ "in": "path",
+ "description": "vim server id",
+ "required": true,
+ "type": "string"
+ },
+ {
+ "in": "body",
+ "name": "body",
+ "description": "operate vim server request param",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/OperateVimServer"
+ }
+ }
+ ],
+ "responses": {
+ "202": {
+ "description": "successful operation"
+ },
+ "404": {
+ "description": "the vim id, tenant UUID or server id is wrong"
+ },
+ "500": {
+ "description": "the vim server is not accessable"
+ }
+ }
+ }
}
},
"definitions": {
@@ -483,6 +542,29 @@
"description": "0: Already exist 1: Newly created"
}
}
+ },
+ "OperateVimServer": {
+ "type": "object",
+ "properties": {
+ "os-start": {
+ "type": "null",
+ "description": "the action to start a stopped server"
+ },
+ "os-stop": {
+ "type": "null",
+ "description": "the action to stop a running server"
+ },
+ "reboot": {
+ "type": "object",
+ "description": "The action to reboot a server",
+ "properties": {
+ "type": {
+ "type": "string",
+ "description": "the type of the reboot action: the valid values are HARD and SOFT"
+ }
+ }
+ }
+ }
}
}
}