From 8fc0a0bea90005c598bd5d60db2c9fc03362072b Mon Sep 17 00:00:00 2001 From: Bin Yang Date: Tue, 14 Aug 2018 07:59:14 +0000 Subject: API upgrade for registry Change-Id: I25fd280332cfc772fa100b7b768e3a5056457f87 Issue-ID: MULTICLOUD-297 Signed-off-by: Bin Yang --- .../registration/views/registration.py | 20 ++++++++++++++++++++ windriver/titanium_cloud/urls.py | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'windriver/titanium_cloud') diff --git a/windriver/titanium_cloud/registration/views/registration.py b/windriver/titanium_cloud/registration/views/registration.py index 3f1e5790..56f77ba7 100644 --- a/windriver/titanium_cloud/registration/views/registration.py +++ b/windriver/titanium_cloud/registration/views/registration.py @@ -363,3 +363,23 @@ class Registry(newton_registration.Registry): '{{\"value\":\"{0}\"}}'.format("v17.02") }) return instruction_capability + + +class RegistryV1(Registry): + def __init__(self): + self.proxy_prefix = settings.MULTICLOUD_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/windriver/titanium_cloud/urls.py b/windriver/titanium_cloud/urls.py index f1ee90a5..cecfcbd0 100644 --- a/windriver/titanium_cloud/urls.py +++ b/windriver/titanium_cloud/urls.py @@ -45,8 +45,8 @@ urlpatterns = [ vesagent_ctrl.VesAgentCtrl.as_view()), #API upgrading -# url(r'^api/multicloud-titanium_cloud/v1/(?P[0-9a-zA-Z_-]+)/(?P[0-9a-zA-Z_-]+)/registry/?$', -# registration.Registry.as_view()), + url(r'^api/multicloud-titanium_cloud/v1/(?P[0-9a-zA-Z_-]+)/(?P[0-9a-zA-Z_-]+)/registry/?$', + registration.RegistryV1.as_view()), # url(r'^api/multicloud-titanium_cloud/v1/(?P[0-9a-zA-Z_-]+)/(?P[0-9a-zA-Z_-]+)/?$', # registration.Registry.as_view()), # url(r'^api/multicloud-titanium_cloud/v1/(?P[0-9a-zA-Z_-]+)/(?P[0-9a-zA-Z_-]+)/exten', -- cgit 1.2.3-korg