diff options
Diffstat (limited to 'windriver')
-rw-r--r-- | windriver/titanium_cloud/extensions/urlsV1.py | 24 | ||||
-rw-r--r-- | windriver/titanium_cloud/extensions/views/extensions.py | 15 | ||||
-rw-r--r-- | windriver/titanium_cloud/proxy/views/identityV3.py | 4 | ||||
-rw-r--r-- | windriver/titanium_cloud/registration/views/registration.py | 2 | ||||
-rw-r--r-- | windriver/titanium_cloud/settings.py | 3 | ||||
-rw-r--r-- | windriver/titanium_cloud/urls.py | 4 |
6 files changed, 47 insertions, 5 deletions
diff --git a/windriver/titanium_cloud/extensions/urlsV1.py b/windriver/titanium_cloud/extensions/urlsV1.py new file mode 100644 index 00000000..f6398ef6 --- /dev/null +++ b/windriver/titanium_cloud/extensions/urlsV1.py @@ -0,0 +1,24 @@ +# Copyright (c) 2017-2018 Wind River Systems, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from django.conf.urls import url +from rest_framework.urlpatterns import format_suffix_patterns + +from titanium_cloud.extensions.views import extensions + +urlpatterns = [ + url(r'^sions/?$', extensions.APIv1Extensions.as_view()), +] + +urlpatterns = format_suffix_patterns(urlpatterns) diff --git a/windriver/titanium_cloud/extensions/views/extensions.py b/windriver/titanium_cloud/extensions/views/extensions.py index cfdc2517..5b857303 100644 --- a/windriver/titanium_cloud/extensions/views/extensions.py +++ b/windriver/titanium_cloud/extensions/views/extensions.py @@ -70,3 +70,18 @@ class Extensions(newton_extensions.Extensions): logger.error(traceback.format_exc()) return Response(data={'error': str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) + + + +class APIv1Extensions(Extensions): + + def __init__(self): + self._logger = logger + self.proxy_prefix = settings.MULTICLOUD_API_V1_PREFIX + + + def get(self, request, cloud_owner="", cloud_region_id=""): + 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(APIv1Extensions,self).get(request, vimid) diff --git a/windriver/titanium_cloud/proxy/views/identityV3.py b/windriver/titanium_cloud/proxy/views/identityV3.py index cae0e834..e6dc16a7 100644 --- a/windriver/titanium_cloud/proxy/views/identityV3.py +++ b/windriver/titanium_cloud/proxy/views/identityV3.py @@ -37,7 +37,7 @@ class TokensV2(newton_identityV3.TokensV2): class APIv1Tokens(Tokens): def __init__(self): - self.proxy_prefix = settings.MULTICLOUD_PREFIX + self.proxy_prefix = settings.MULTICLOUD_API_V1_PREFIX self._logger = logger @@ -61,7 +61,7 @@ class APIv1Tokens(Tokens): class APIv1TokensV2(TokensV2): def __init__(self): - self.proxy_prefix = settings.MULTICLOUD_PREFIX + self.proxy_prefix = settings.MULTICLOUD_API_V1_PREFIX self._logger = logger diff --git a/windriver/titanium_cloud/registration/views/registration.py b/windriver/titanium_cloud/registration/views/registration.py index 56f77ba7..b54772e3 100644 --- a/windriver/titanium_cloud/registration/views/registration.py +++ b/windriver/titanium_cloud/registration/views/registration.py @@ -367,7 +367,7 @@ class Registry(newton_registration.Registry): class RegistryV1(Registry): def __init__(self): - self.proxy_prefix = settings.MULTICLOUD_PREFIX + self.proxy_prefix = settings.MULTICLOUD_API_V1_PREFIX self.aai_base_url = settings.AAI_BASE_URL self._logger = logger diff --git a/windriver/titanium_cloud/settings.py b/windriver/titanium_cloud/settings.py index 296d8e75..adfa4930 100644 --- a/windriver/titanium_cloud/settings.py +++ b/windriver/titanium_cloud/settings.py @@ -100,6 +100,9 @@ MSB_SERVICE_PORT = os.environ.get('MSB_PORT', "80") MULTICLOUD_PREFIX = "http://%s:%s/api/multicloud-titanium_cloud/v0" % ( MSB_SERVICE_ADDR, MSB_SERVICE_PORT) +MULTICLOUD_API_V1_PREFIX = "http://%s:%s/api/multicloud-titanium_cloud/v1" % ( + MSB_SERVICE_ADDR, MSB_SERVICE_PORT) + # [A&AI] AAI_ADDR = os.environ.get('AAI_ADDR', "aai.api.simpledemo.openecomp.org") AAI_PORT = os.environ.get('AAI_PORT', "8443") diff --git a/windriver/titanium_cloud/urls.py b/windriver/titanium_cloud/urls.py index e8ec9f02..5a4e64b0 100644 --- a/windriver/titanium_cloud/urls.py +++ b/windriver/titanium_cloud/urls.py @@ -49,8 +49,8 @@ urlpatterns = [ registration.RegistryV1.as_view()), url(r'^api/multicloud-titanium_cloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/?$', registration.RegistryV1.as_view()), -# url(r'^api/multicloud-titanium_cloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/exten', -# include('titanium_cloud.extensions.urls')), + url(r'^api/multicloud-titanium_cloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/exten', + include('titanium_cloud.extensions.urlsV1')), url(r'^api/multicloud-titanium_cloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/', include('titanium_cloud.proxy.urlsV1')), # url(r'^api/multicloud-titanium_cloud/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/(?P<cloud_region_id>[0-9a-zA-Z_-]+)/tenants/?$', |