diff options
-rw-r--r-- | ocata/ocata/urls.py | 2 | ||||
-rw-r--r-- | ocata/ocata/vesagent/vesagent_ctrl.py | 50 |
2 files changed, 52 insertions, 0 deletions
diff --git a/ocata/ocata/urls.py b/ocata/ocata/urls.py index 34569968..d1601d6c 100644 --- a/ocata/ocata/urls.py +++ b/ocata/ocata/urls.py @@ -60,6 +60,8 @@ urlpatterns = [ '(?P<tenantid>[0-9a-zA-Z_-]{20,})/', include('ocata.requests.urlsV1')), url(r'^api/multicloud-ocata/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/capacity_check/?$', capacity.APIv1CapacityCheck.as_view()), + url(r'^api/multicloud-ocata/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/vesagent/?$', + vesagent_ctrl.APIv1VesAgentCtrl.as_view()), url(r'^api/multicloud-ocata/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/infra_workload/?$', infra_workload.APIv1InfraWorkload.as_view()), url(r'^api/multicloud-ocata/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/infra_workload/(?P<requri>[0-9a-zA-Z_-]*)/?$', diff --git a/ocata/ocata/vesagent/vesagent_ctrl.py b/ocata/ocata/vesagent/vesagent_ctrl.py index 99d55b62..3293f829 100644 --- a/ocata/ocata/vesagent/vesagent_ctrl.py +++ b/ocata/ocata/vesagent/vesagent_ctrl.py @@ -404,3 +404,53 @@ class VesAgentCtrl(APIView): self._logger.debug("return without backlog") return None + + +class APIv1VesAgentCtrl(VesAgentCtrl): + + def __init__(self): + super(APIv1VesAgentCtrl, self).__init__() + # self._logger = logger + self.proxy_prefix = settings.MULTICLOUD_API_V1_PREFIX + + + def get(self, request, cloud_owner="", cloud_region_id=""): + ''' + :param request: + :param cloud_owner: + :param cloud_region_id: + :return: + ''' + self._logger.info("cloud_owner,cloud_region_id: %s,%s" % (cloud_owner,cloud_region_id)) + + vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) + return super(APIv1VesAgentCtrl,self).get(request, vimid) + + + def post(self, request, cloud_owner="", cloud_region_id=""): + ''' + wrapper for inherited API with VIM ID + :param request: + :param cloud_owner: + :param cloud_region_id: + :return: + ''' + self._logger.info("cloud_owner,cloud_region_id: %s,%s" % (cloud_owner,cloud_region_id)) + + vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) + return super(APIv1VesAgentCtrl,self).post(request, vimid) + + + def delete(self, request, cloud_owner="", cloud_region_id=""): + ''' + wrapper of inherited API with VIM ID + :param request: + :param cloud_owner: + :param cloud_region_id: + :return: + ''' + self._logger.info("cloud_owner,cloud_region_id: %s,%s" % (cloud_owner,cloud_region_id)) + + vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) + return super(APIv1VesAgentCtrl,self).delete(request, vimid) + |