summaryrefslogtreecommitdiffstats
path: root/ocata
diff options
context:
space:
mode:
authorBin Yang <bin.yang@windriver.com>2017-09-13 17:57:00 +0800
committerBin Yang <bin.yang@windriver.com>2017-09-13 17:57:00 +0800
commit51f18c6e84a88eaea53237b3a21d32ad4ab0e8a5 (patch)
treeaed163e17ddfde30bb46e9aafa857550b07d1f05 /ocata
parent530818aab2a02921e0445b6062260aad9e4b2810 (diff)
Refactor newton and ocato proxy
refactor code and fix bugs to update proxy prefix Change-Id: I4a02b0570759f087581e875cc683d4475bd2121b Issue-Id: MULTICLOUD-89 Signed-off-by: Bin Yang <bin.yang@windriver.com>
Diffstat (limited to 'ocata')
-rw-r--r--ocata/docker/Dockerfile1
-rw-r--r--ocata/ocata/extensions/urls.py4
-rw-r--r--ocata/ocata/extensions/views/__init__.py10
-rw-r--r--ocata/ocata/extensions/views/epacaps.py32
-rw-r--r--ocata/ocata/extensions/views/extensions.py28
-rw-r--r--ocata/ocata/proxy/urls.py2
-rw-r--r--ocata/ocata/proxy/views/identityV3.py8
-rw-r--r--ocata/ocata/proxy/views/services.py12
-rw-r--r--ocata/ocata/pub/config/config.py4
-rw-r--r--ocata/ocata/registration/__init__.py10
-rw-r--r--ocata/ocata/registration/views/__init__.py10
-rw-r--r--ocata/ocata/registration/views/registration.py28
-rw-r--r--ocata/ocata/urls.py2
13 files changed, 136 insertions, 15 deletions
diff --git a/ocata/docker/Dockerfile b/ocata/docker/Dockerfile
index 6283cd25..573cd29e 100644
--- a/ocata/docker/Dockerfile
+++ b/ocata/docker/Dockerfile
@@ -23,6 +23,7 @@ RUN apt-get update && \
cd /opt/ && \
wget -O multicloud-openstack-ocata.zip "https://nexus.onap.org/service/local/artifact/maven/redirect?r=snapshots&g=org.onap.multicloud.openstack&a=multicloud-openstack-ocata&e=zip&v=LATEST" && \
unzip -q -o -B multicloud-openstack-ocata.zip && \
+ chmod +x /opt/ocata/*.sh && \
rm -f multicloud-openstack-ocata.zip && \
pip install -r /opt/ocata/requirements.txt
diff --git a/ocata/ocata/extensions/urls.py b/ocata/ocata/extensions/urls.py
index e87a02eb..4dc46983 100644
--- a/ocata/ocata/extensions/urls.py
+++ b/ocata/ocata/extensions/urls.py
@@ -15,8 +15,8 @@
from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns
-from newton.extensions.views import extensions
-from newton.extensions.views import epacaps
+from ocata.extensions.views import extensions
+from ocata.extensions.views import epacaps
urlpatterns = [
url(r'^sions$', extensions.Extensions.as_view()),
diff --git a/ocata/ocata/extensions/views/__init__.py b/ocata/ocata/extensions/views/__init__.py
new file mode 100644
index 00000000..802f3fba
--- /dev/null
+++ b/ocata/ocata/extensions/views/__init__.py
@@ -0,0 +1,10 @@
+# Copyright (c) 2017 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.
diff --git a/ocata/ocata/extensions/views/epacaps.py b/ocata/ocata/extensions/views/epacaps.py
new file mode 100644
index 00000000..72942064
--- /dev/null
+++ b/ocata/ocata/extensions/views/epacaps.py
@@ -0,0 +1,32 @@
+# Copyright (c) 2017 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.
+import logging
+import json
+import traceback
+
+from ocata.pub.config import config
+
+
+from newton.extensions.views import epacaps as newton_epacaps
+
+logger = logging.getLogger(__name__)
+
+DEBUG=True
+
+
+class EpaCaps(newton_epacaps.EpaCaps):
+
+ def __init__(self):
+ self.proxy_prefix = config.MULTICLOUD_PREFIX
+ self._logger = logger
diff --git a/ocata/ocata/extensions/views/extensions.py b/ocata/ocata/extensions/views/extensions.py
new file mode 100644
index 00000000..beb02fde
--- /dev/null
+++ b/ocata/ocata/extensions/views/extensions.py
@@ -0,0 +1,28 @@
+# Copyright (c) 2017 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.
+import logging
+
+from ocata.pub.config import config
+from newton.extensions.views import extensions as newton_extensions
+
+logger = logging.getLogger(__name__)
+
+DEBUG=True
+
+class Extensions(newton_extensions.Extensions):
+
+ def __init__(self):
+ self._logger = logger
+ self.proxy_prefix = config.MULTICLOUD_PREFIX
+
diff --git a/ocata/ocata/proxy/urls.py b/ocata/ocata/proxy/urls.py
index 7d52a4ed..e32702f5 100644
--- a/ocata/ocata/proxy/urls.py
+++ b/ocata/ocata/proxy/urls.py
@@ -23,8 +23,6 @@ urlpatterns = [
# identityV2.Tokens.as_view()),
url(r'^identity/v3/auth/tokens$',
identityV3.Tokens.as_view()),
- url(r'^identity/v3/auth/catalog$',
- identityV3.Catalog.as_view()),
url(r'^identity/(?:v2.0/|)tenants$',
services.GetTenants.as_view()),
url(r'^(?P<servicetype>[0-9a-zA-Z_-]+)/(?P<requri>[0-9a-zA-Z./_-]*)$',
diff --git a/ocata/ocata/proxy/views/identityV3.py b/ocata/ocata/proxy/views/identityV3.py
index 5e018e2a..534ebe8f 100644
--- a/ocata/ocata/proxy/views/identityV3.py
+++ b/ocata/ocata/proxy/views/identityV3.py
@@ -13,7 +13,7 @@
# limitations under the License.
import logging
-from newton.pub.config import config
+from ocata.pub.config import config
from newton.proxy.views import identityV3 as newton_identityV3
logger = logging.getLogger(__name__)
@@ -25,9 +25,3 @@ class Tokens(newton_identityV3.Tokens):
def __init__(self):
self.proxy_prefix = config.MULTICLOUD_PREFIX
self._logger = logger
-
-class Catalog(newton_identityV3.Catalog):
-
- def __init__(self):
- self.proxy_prefix = config.MULTICLOUD_PREFIX
- self._logger = logger
diff --git a/ocata/ocata/proxy/views/services.py b/ocata/ocata/proxy/views/services.py
index 5a022fe4..7eb6bd25 100644
--- a/ocata/ocata/proxy/views/services.py
+++ b/ocata/ocata/proxy/views/services.py
@@ -13,7 +13,9 @@
# limitations under the License.
import logging
-from newton.pub.config import config
+from rest_framework import status
+
+from ocata.pub.config import config
from newton.proxy.views import services as newton_services
logger = logging.getLogger(__name__)
@@ -33,3 +35,11 @@ class GetTenants(newton_services.GetTenants):
def __init__(self):
self._logger = logger
+
+ def get(self, request, vimid="", servicetype="identity", requri='v3/projects'):
+ self._logger.debug("GetTenants--get::META> %s" % request.META)
+ self._logger.debug("GetTenants--get::data> %s" % request.data)
+ self._logger.debug("GetTenants--get::vimid, servicetype, requri> %s,%s,%s"
+ % (vimid, servicetype, requri))
+
+ return super(GetTenants,self).get(request, vimid, servicetype, requri)
diff --git a/ocata/ocata/pub/config/config.py b/ocata/ocata/pub/config/config.py
index 4de698f5..876e609e 100644
--- a/ocata/ocata/pub/config/config.py
+++ b/ocata/ocata/pub/config/config.py
@@ -12,11 +12,11 @@
import os
# [MSB]
-MSB_SERVICE_IP = '127.0.0.1'
+MSB_SERVICE_ADDR = '127.0.0.1'
MSB_SERVICE_PORT = '80'
#[Multicloud]
-MULTICLOUD_PREFIX = "http://%s:%s/api/multicloud-ocata/v0" %(MSB_SERVICE_IP, MSB_SERVICE_PORT)
+MULTICLOUD_PREFIX = "http://%s:%s/api/multicloud-ocata/v0" %(MSB_SERVICE_ADDR, MSB_SERVICE_PORT)
# [A&AI]
AAI_ADDR = "aai.api.simpledemo.openecomp.org"
diff --git a/ocata/ocata/registration/__init__.py b/ocata/ocata/registration/__init__.py
new file mode 100644
index 00000000..802f3fba
--- /dev/null
+++ b/ocata/ocata/registration/__init__.py
@@ -0,0 +1,10 @@
+# Copyright (c) 2017 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.
diff --git a/ocata/ocata/registration/views/__init__.py b/ocata/ocata/registration/views/__init__.py
new file mode 100644
index 00000000..802f3fba
--- /dev/null
+++ b/ocata/ocata/registration/views/__init__.py
@@ -0,0 +1,10 @@
+# Copyright (c) 2017 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.
diff --git a/ocata/ocata/registration/views/registration.py b/ocata/ocata/registration/views/registration.py
new file mode 100644
index 00000000..915728ae
--- /dev/null
+++ b/ocata/ocata/registration/views/registration.py
@@ -0,0 +1,28 @@
+# Copyright (c) 2017 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.
+import logging
+
+from ocata.pub.config import config
+
+from newton.registration.views import registration as newton_registration
+
+logger = logging.getLogger(__name__)
+
+DEBUG=True
+
+class Registry(newton_registration.Registry):
+
+ def __init__(self):
+ self.proxy_prefix = config.MULTICLOUD_PREFIX
+ self._logger = logger
diff --git a/ocata/ocata/urls.py b/ocata/ocata/urls.py
index db488bff..cc553ed6 100644
--- a/ocata/ocata/urls.py
+++ b/ocata/ocata/urls.py
@@ -11,7 +11,7 @@
from django.conf.urls import include, url
-from newton.registration.views import registration
+from ocata.registration.views import registration
from newton.requests.views import tenants
urlpatterns = [