diff options
author | Huang Haibin <haibin.huang@intel.com> | 2018-10-15 11:01:07 +0800 |
---|---|---|
committer | Huang Haibin <haibin.huang@intel.com> | 2018-10-15 11:17:13 +0800 |
commit | 1f95424c0e2c808505d63358244c29ae279045dc (patch) | |
tree | b211ecae0825e98095422a599cc52f00ea5a1f2d | |
parent | 20cdd33c0c65f5862a21130f48bd9333c7f79165 (diff) |
Upgrade registration v1 for pike
Change-Id: I3360a07f32dd89dc4080ad90bb124cb4e9b4c83c
Issue-ID: MULTICLOUD-377
Signed-off-by: Huang Haibin <haibin.huang@intel.com>
-rw-r--r-- | pike/pike/registration/views/registration.py | 19 | ||||
-rw-r--r-- | pike/pike/urls.py | 7 |
2 files changed, 26 insertions, 0 deletions
diff --git a/pike/pike/registration/views/registration.py b/pike/pike/registration/views/registration.py index dfb1d91f..121a39d0 100644 --- a/pike/pike/registration/views/registration.py +++ b/pike/pike/registration/views/registration.py @@ -34,3 +34,22 @@ class Registry(newton_registration.Registry): self.proxy_prefix = settings.MULTICLOUD_PREFIX self.aai_base_url = settings.AAI_BASE_URL self._logger = logger + +class RegistryV1(Registry): + def __init__(self): + self.proxy_prefix = settings.MULTICLOUD_API_V1_PREFIX + self.aai_base_url = settings.AAI_BASE_URL + self._logger = logger + + def post(self, request, cloud_owner="", cloud_region_id=""): + self._logger.info("registration with : %s, %s" % (cloud_owner, cloud_region_id)) + self._logger.debug("with data: %s" % request.data) + + vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) + return super(RegistryV1, self).post(request, vimid) + + def delete(self, request, cloud_owner="", cloud_region_id=""): + self._logger.debug("unregister cloud region: %s, %s" % (cloud_owner, cloud_region_id)) + + vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) + return super(RegistryV1, self).delete(request, vimid) diff --git a/pike/pike/urls.py b/pike/pike/urls.py index 03593565..8e1ad9f6 100644 --- a/pike/pike/urls.py +++ b/pike/pike/urls.py @@ -34,6 +34,13 @@ urlpatterns = [ '(?P<tenantid>[0-9a-zA-Z_-]{20,})/', include('pike.requests.urls')), url(r'^api/multicloud-pike/v0/(?P<vimid>[0-9a-zA-Z_-]+)/capacity_check/?$', capacity.CapacityCheck.as_view()), + + # API upgrading + url(r'^api/multicloud-pike/v1/(?P<vimid>[0-9a-zA-Z_-]+)/registry$', + registration.RegistryV1.as_view()), + url(r'^api/multicloud-pike/v1/(?P<vimid>[0-9a-zA-Z_-]+)$', + registration.RegistryV1.as_view()), + url(r'^api/multicloud-pike/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-pike/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/infra_workload/(?P<requri>[0-9a-zA-Z_-]*)/?$', |