diff options
author | Huang Haibin <haibin.huang@intel.com> | 2018-10-15 16:42:22 +0800 |
---|---|---|
committer | Huang Haibin <haibin.huang@intel.com> | 2018-10-15 16:42:22 +0800 |
commit | 4ae8aa7ee2389fcbe48046e85860eec659d428bc (patch) | |
tree | f25a9ab2c335f486509628a38bb5b8a2399bdfc1 /ocata | |
parent | 41b280c730d34738c2163c772fd1293d16799f98 (diff) |
Upgrade vesagent v1 for ocata
Change-Id: Icf852237f56fd587b092c0ff9743e8fdb738aba5
Issue-ID: MULTICLOUD-378
Signed-off-by: Huang Haibin <haibin.huang@intel.com>
Diffstat (limited to 'ocata')
-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) + |