summaryrefslogtreecommitdiffstats
path: root/windriver
diff options
context:
space:
mode:
authorYun Huang <yun.huang@windriver.com>2018-03-07 09:16:38 +0800
committerYun Huang <yun.huang@windriver.com>2018-03-07 09:23:18 +0800
commit9b38263158909c0d20c0f36438071b3c532ec284 (patch)
tree05cebf5569f401ddeb095ea6282e2203e6c3eec0 /windriver
parent8ff2e0716d126a9d47dc98f933bb0bc046faa05d (diff)
Change the code base from newton to share
And adopt settings,depreciate config Change-Id: Ib467a6e914ae89ab8799d38191dfed8b3cd7b726 Issue-ID: MULTICLOUD-138 Signed-off-by: Yun Huang <yun.huang@windriver.com>
Diffstat (limited to 'windriver')
-rw-r--r--windriver/assembly.xml12
-rw-r--r--windriver/run.sh18
-rw-r--r--windriver/titanium_cloud/extensions/tests/test_epacaps.py2
-rw-r--r--windriver/titanium_cloud/extensions/views/epacaps.py6
-rw-r--r--windriver/titanium_cloud/extensions/views/extensions.py11
-rw-r--r--windriver/titanium_cloud/extensions/views/fcaps.py10
-rw-r--r--windriver/titanium_cloud/proxy/tests/test_identity_proxy.py2
-rw-r--r--windriver/titanium_cloud/proxy/tests/test_service_proxy.py2
-rw-r--r--windriver/titanium_cloud/proxy/urls.py2
-rw-r--r--windriver/titanium_cloud/proxy/views/identityV3.py8
-rw-r--r--windriver/titanium_cloud/proxy/views/services.py4
-rw-r--r--windriver/titanium_cloud/pub/config/config.py24
-rw-r--r--windriver/titanium_cloud/registration/tests/test_registration.py4
-rw-r--r--windriver/titanium_cloud/registration/views/registration.py6
-rw-r--r--windriver/titanium_cloud/requests/urls.py18
-rw-r--r--windriver/titanium_cloud/settings.py25
-rw-r--r--windriver/titanium_cloud/swagger/views.py4
-rw-r--r--windriver/titanium_cloud/urls.py2
-rw-r--r--windriver/tox.ini2
19 files changed, 77 insertions, 85 deletions
diff --git a/windriver/assembly.xml b/windriver/assembly.xml
index 3fe1c127..4d7813c9 100644
--- a/windriver/assembly.xml
+++ b/windriver/assembly.xml
@@ -34,6 +34,18 @@
</includes>
</fileSet>
<fileSet>
+ <directory>../share</directory>
+ <outputDirectory>/lib/share</outputDirectory>
+ <includes>
+ <include>**/*.py</include>
+ <include>**/*.json</include>
+ <include>**/*.xml</include>
+ <include>**/*.wsdl</include>
+ <include>**/*.xsd</include>
+ <include>**/*.bpel</include>
+ </includes>
+ </fileSet>
+ <fileSet>
<directory>logs</directory>
<outputDirectory>/logs</outputDirectory>
<includes>
diff --git a/windriver/run.sh b/windriver/run.sh
index ebca8e38..95b7b71c 100644
--- a/windriver/run.sh
+++ b/windriver/run.sh
@@ -13,24 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-sed -i "s/MSB_SERVICE_ADDR =.*/MSB_SERVICE_ADDR = \"${MSB_ADDR}\"/g" titanium_cloud/pub/config/config.py
-sed -i "s/MSB_SERVICE_PORT =.*/MSB_SERVICE_PORT = \"${MSB_PORT}\"/g" titanium_cloud/pub/config/config.py
-sed -i "s/AAI_ADDR =.*/AAI_ADDR = \"${AAI_ADDR}\"/g" titanium_cloud/pub/config/config.py
-sed -i "s/AAI_PORT =.*/AAI_PORT = \"${AAI_PORT}\"/g" titanium_cloud/pub/config/config.py
-sed -i "s/AAI_SCHEMA_VERSION =.*/AAI_SCHEMA_VERSION = \"${AAI_SCHEMA_VERSION}\"/g" titanium_cloud/pub/config/config.py
-sed -i "s/AAI_USERNAME =.*/AAI_USERNAME = \"${AAI_USERNAME}\"/g" titanium_cloud/pub/config/config.py
-sed -i "s/AAI_PASSWORD =.*/AAI_PASSWORD = \"${AAI_PASSWORD}\"/g" titanium_cloud/pub/config/config.py
-
-sed -i "s/MSB_SERVICE_ADDR =.*/MSB_SERVICE_ADDR = \"${MSB_ADDR}\"/g" lib/newton/newton/pub/config/config.py
-sed -i "s/MSB_SERVICE_PORT =.*/MSB_SERVICE_PORT = \"${MSB_PORT}\"/g" lib/newton/newton/pub/config/config.py
-sed -i "s/AAI_ADDR =.*/AAI_ADDR = \"${AAI_ADDR}\"/g" lib/newton/newton/pub/config/config.py
-sed -i "s/AAI_PORT =.*/AAI_PORT = \"${AAI_PORT}\"/g" lib/newton/newton/pub/config/config.py
-sed -i "s/AAI_SCHEMA_VERSION =.*/AAI_SCHEMA_VERSION = \"${AAI_SCHEMA_VERSION}\"/g" lib/newton/newton/pub/config/config.py
-sed -i "s/AAI_USERNAME =.*/AAI_USERNAME = \"${AAI_USERNAME}\"/g" lib/newton/newton/pub/config/config.py
-sed -i "s/AAI_PASSWORD =.*/AAI_PASSWORD = \"${AAI_PASSWORD}\"/g" lib/newton/newton/pub/config/config.py
-
memcached -d -m 2048 -u root -c 1024 -p 11211 -P /tmp/memcached1.pid
-export PYTHONPATH=lib/newton
+export PYTHONPATH=lib/newton:lib/share
nohup python manage.py runserver 0.0.0.0:9005 2>&1 &
while [ ! -f logs/runtime_titanium_cloud.log ]; do
diff --git a/windriver/titanium_cloud/extensions/tests/test_epacaps.py b/windriver/titanium_cloud/extensions/tests/test_epacaps.py
index 89fe1b42..6b938da1 100644
--- a/windriver/titanium_cloud/extensions/tests/test_epacaps.py
+++ b/windriver/titanium_cloud/extensions/tests/test_epacaps.py
@@ -19,7 +19,7 @@ from django.test import Client
from rest_framework import status
import unittest
-from newton.requests.views.util import VimDriverUtils
+from newton_base.util import VimDriverUtils
MOCK_VIM_INFO = {
"createTime": "2017-04-01 02:22:27",
diff --git a/windriver/titanium_cloud/extensions/views/epacaps.py b/windriver/titanium_cloud/extensions/views/epacaps.py
index 69b24c9f..77542b31 100644
--- a/windriver/titanium_cloud/extensions/views/epacaps.py
+++ b/windriver/titanium_cloud/extensions/views/epacaps.py
@@ -16,10 +16,10 @@ import logging
import json
import traceback
-from titanium_cloud.pub.config import config
+from django.conf import settings
-from newton.extensions.views import epacaps as newton_epacaps
+from newton_base.extensions import epacaps as newton_epacaps
logger = logging.getLogger(__name__)
@@ -29,5 +29,5 @@ DEBUG=True
class EpaCaps(newton_epacaps.EpaCaps):
def __init__(self):
- self.proxy_prefix = config.MULTICLOUD_PREFIX
+ self.proxy_prefix = settings.MULTICLOUD_PREFIX
self._logger = logger
diff --git a/windriver/titanium_cloud/extensions/views/extensions.py b/windriver/titanium_cloud/extensions/views/extensions.py
index d6988830..680e2ca6 100644
--- a/windriver/titanium_cloud/extensions/views/extensions.py
+++ b/windriver/titanium_cloud/extensions/views/extensions.py
@@ -20,11 +20,10 @@ from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
-from titanium_cloud.pub.config import config
-from newton.pub.exceptions import VimDriverNewtonException
-from newton.requests.views.util import VimDriverUtils
-from newton.extensions.views import extensions as newton_extensions
-from newton.pub.msapi import extsys
+from django.conf import settings
+from common.exceptions import VimDriverNewtonException
+from common.msapi import extsys
+from newton_base.extensions import extensions as newton_extensions
logger = logging.getLogger(__name__)
@@ -34,7 +33,7 @@ class Extensions(newton_extensions.Extensions):
def __init__(self):
self._logger = logger
- self.proxy_prefix = config.MULTICLOUD_PREFIX
+ self.proxy_prefix = settings.MULTICLOUD_PREFIX
def get(self, request, vimid=""):
diff --git a/windriver/titanium_cloud/extensions/views/fcaps.py b/windriver/titanium_cloud/extensions/views/fcaps.py
index 894db367..d5be095f 100644
--- a/windriver/titanium_cloud/extensions/views/fcaps.py
+++ b/windriver/titanium_cloud/extensions/views/fcaps.py
@@ -24,10 +24,10 @@ from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
-from titanium_cloud.pub.config import config
-from newton.pub.exceptions import VimDriverNewtonException
-from newton.requests.views.util import VimDriverUtils
-from newton.pub.msapi import extsys
+from django.conf import settings
+from common.exceptions import VimDriverNewtonException
+from newton_base.util import VimDriverUtils
+from common.msapi import extsys
@@ -126,7 +126,7 @@ class GuestMonitorWorker (threading.Thread):
class GuestMonitor(APIView):
def __init__(self):
- self.proxy_prefix = config.MULTICLOUD_PREFIX
+ self.proxy_prefix = settings.MULTICLOUD_PREFIX
self._logger = logger
def post(self, request, vimid="", vserverid=""):
diff --git a/windriver/titanium_cloud/proxy/tests/test_identity_proxy.py b/windriver/titanium_cloud/proxy/tests/test_identity_proxy.py
index fd80c182..5dc061fa 100644
--- a/windriver/titanium_cloud/proxy/tests/test_identity_proxy.py
+++ b/windriver/titanium_cloud/proxy/tests/test_identity_proxy.py
@@ -23,7 +23,7 @@ from rest_framework import status
from keystoneauth1 import session
from keystoneauth1.exceptions import HttpError
-from newton.requests.views.util import VimDriverUtils
+from newton_base.util import VimDriverUtils
from titanium_cloud.proxy.views.identityV3 import Tokens
mock_viminfo = {
diff --git a/windriver/titanium_cloud/proxy/tests/test_service_proxy.py b/windriver/titanium_cloud/proxy/tests/test_service_proxy.py
index e373168b..f9a9af40 100644
--- a/windriver/titanium_cloud/proxy/tests/test_service_proxy.py
+++ b/windriver/titanium_cloud/proxy/tests/test_service_proxy.py
@@ -21,7 +21,7 @@ from rest_framework import status
import unittest
-from newton.requests.views.util import VimDriverUtils
+from newton_base.util import VimDriverUtils
MOCK_VIM_INFO = {
"createTime": "2017-04-01 02:22:27",
diff --git a/windriver/titanium_cloud/proxy/urls.py b/windriver/titanium_cloud/proxy/urls.py
index f1709e3f..22f714d1 100644
--- a/windriver/titanium_cloud/proxy/urls.py
+++ b/windriver/titanium_cloud/proxy/urls.py
@@ -17,7 +17,7 @@ from rest_framework.urlpatterns import format_suffix_patterns
from titanium_cloud.proxy.views import identityV3
from titanium_cloud.proxy.views import services
-from newton.proxy.views import dnsaasdelegate
+from newton_base.proxy import dnsaasdelegate
urlpatterns = [
# url(r'^identity/v2)$',
diff --git a/windriver/titanium_cloud/proxy/views/identityV3.py b/windriver/titanium_cloud/proxy/views/identityV3.py
index 29b37d76..dd280314 100644
--- a/windriver/titanium_cloud/proxy/views/identityV3.py
+++ b/windriver/titanium_cloud/proxy/views/identityV3.py
@@ -14,8 +14,8 @@
import logging
-from titanium_cloud.pub.config import config
-from newton.proxy.views import identityV3 as newton_identityV3
+from django.conf import settings
+from newton_base.proxy import identityV3 as newton_identityV3
logger = logging.getLogger(__name__)
@@ -24,11 +24,11 @@ DEBUG=True
class Tokens(newton_identityV3.Tokens):
def __init__(self):
- self.proxy_prefix = config.MULTICLOUD_PREFIX
+ self.proxy_prefix = settings.MULTICLOUD_PREFIX
self._logger = logger
class TokensV2(newton_identityV3.TokensV2):
def __init__(self):
- self.proxy_prefix = config.MULTICLOUD_PREFIX
+ self.proxy_prefix = settings.MULTICLOUD_PREFIX
self._logger = logger
diff --git a/windriver/titanium_cloud/proxy/views/services.py b/windriver/titanium_cloud/proxy/views/services.py
index 47210205..4bfecdbc 100644
--- a/windriver/titanium_cloud/proxy/views/services.py
+++ b/windriver/titanium_cloud/proxy/views/services.py
@@ -16,8 +16,8 @@ import logging
from rest_framework import status
-from titanium_cloud.pub.config import config
-from newton.proxy.views import services as newton_services
+from django.conf import settings
+from newton_base.proxy import services as newton_services
logger = logging.getLogger(__name__)
diff --git a/windriver/titanium_cloud/pub/config/config.py b/windriver/titanium_cloud/pub/config/config.py
index 7536bd94..ae1ce9db 100644
--- a/windriver/titanium_cloud/pub/config/config.py
+++ b/windriver/titanium_cloud/pub/config/config.py
@@ -11,27 +11,3 @@
# 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 os
-
-# [MSB]
-MSB_SERVICE_ADDR = '127.0.0.1'
-MSB_SERVICE_PORT = '80'
-
-#[Multicloud]
-MULTICLOUD_PREFIX = "http://%s:%s/api/multicloud-titanium_cloud/v0" %(MSB_SERVICE_ADDR, MSB_SERVICE_PORT)
-
-# [A&AI]
-AAI_ADDR = "aai.api.simpledemo.openecomp.org"
-AAI_PORT = "8443"
-AAI_SERVICE_URL = 'https://%s:%s/aai' % (AAI_ADDR, AAI_PORT)
-AAI_SCHEMA_VERSION = "v11"
-AAI_USERNAME = 'AAI'
-AAI_PASSWORD = 'AAI'
-
-AAI_BASE_URL = "%s/%s" % (AAI_SERVICE_URL, AAI_SCHEMA_VERSION)
-
-MULTICLOUD_APP_ID = 'MultiCloud-Titanium_Cloud'
-
-# [IMAGE LOCAL PATH]
-ROOT_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
diff --git a/windriver/titanium_cloud/registration/tests/test_registration.py b/windriver/titanium_cloud/registration/tests/test_registration.py
index d96e2359..01a40217 100644
--- a/windriver/titanium_cloud/registration/tests/test_registration.py
+++ b/windriver/titanium_cloud/registration/tests/test_registration.py
@@ -16,10 +16,10 @@ import mock
from rest_framework import status
-from newton.pub.utils import restcall
+from common.utils import restcall
from newton.requests.tests import mock_info
from newton.requests.tests import test_base
-from newton.requests.views.util import VimDriverUtils
+from newton_base.util import VimDriverUtils
MOCK_GET_TENANT_RESPONSE = {
"projects":[
diff --git a/windriver/titanium_cloud/registration/views/registration.py b/windriver/titanium_cloud/registration/views/registration.py
index ee9be716..da83efaa 100644
--- a/windriver/titanium_cloud/registration/views/registration.py
+++ b/windriver/titanium_cloud/registration/views/registration.py
@@ -14,9 +14,9 @@
import logging
-from titanium_cloud.pub.config import config
+from django.conf import settings
-from newton.registration.views import registration as newton_registration
+from newton_base.registration import registration as newton_registration
logger = logging.getLogger(__name__)
@@ -25,5 +25,5 @@ DEBUG=True
class Registry(newton_registration.Registry):
def __init__(self):
- self.proxy_prefix = config.MULTICLOUD_PREFIX
+ self.proxy_prefix = settings.MULTICLOUD_PREFIX
self._logger = logger
diff --git a/windriver/titanium_cloud/requests/urls.py b/windriver/titanium_cloud/requests/urls.py
index 87749aab..435ff239 100644
--- a/windriver/titanium_cloud/requests/urls.py
+++ b/windriver/titanium_cloud/requests/urls.py
@@ -15,15 +15,15 @@
from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns
-from newton.requests.views import network
-from newton.requests.views import subnet
-from newton.requests.views import image
-from newton.requests.views import volume
-from newton.requests.views import server
-from newton.requests.views import vport
-from newton.requests.views import limits
-from newton.requests.views import hosts
-from newton.requests.views import flavor
+from newton_base.openoapi import network
+from newton_base.openoapi import subnet
+from newton_base.openoapi import image
+from newton_base.openoapi import volume
+from newton_base.openoapi import server
+from newton_base.openoapi import vport
+from newton_base.openoapi import limits
+from newton_base.openoapi import hosts
+from newton_base.openoapi import flavor
urlpatterns = [
url(r'^networks(/(?P<networkid>[0-9a-zA-Z_-]+))?',
diff --git a/windriver/titanium_cloud/settings.py b/windriver/titanium_cloud/settings.py
index fe950f06..446a68d0 100644
--- a/windriver/titanium_cloud/settings.py
+++ b/windriver/titanium_cloud/settings.py
@@ -119,11 +119,32 @@ CACHES = {
}
}
-OPENSTACK_VERSION = "newton"
+# [MSB]
+MSB_SERVICE_ADDR = '127.0.0.1'
+MSB_SERVICE_PORT = '80'
+
+#[Multicloud]
+MULTICLOUD_PREFIX = "http://%s:%s/api/multicloud-titanium_cloud/v0" %(MSB_SERVICE_ADDR, MSB_SERVICE_PORT)
+
+# [A&AI]
+AAI_ADDR = "aai.api.simpledemo.openecomp.org"
+AAI_PORT = "8443"
+AAI_SERVICE_URL = 'https://%s:%s/aai' % (AAI_ADDR, AAI_PORT)
+AAI_SCHEMA_VERSION = "v11"
+AAI_USERNAME = 'AAI'
+AAI_PASSWORD = 'AAI'
+
+AAI_BASE_URL = "%s/%s" % (AAI_SERVICE_URL, AAI_SCHEMA_VERSION)
+
+MULTICLOUD_APP_ID = 'MultiCloud-Titanium_Cloud'
+
+# [IMAGE LOCAL PATH]
+ROOT_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
+OPENSTACK_VERSION = "titanium_cloud"
MULTIVIM_VERSION = "multicloud-" + OPENSTACK_VERSION
if 'test' in sys.argv:
- from titanium_cloud.pub.config import config
REST_FRAMEWORK = {}
import platform
diff --git a/windriver/titanium_cloud/swagger/views.py b/windriver/titanium_cloud/swagger/views.py
index 2939bfcb..e912b751 100644
--- a/windriver/titanium_cloud/swagger/views.py
+++ b/windriver/titanium_cloud/swagger/views.py
@@ -21,8 +21,8 @@ from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
-from newton.pub.exceptions import VimDriverNewtonException
-from newton.swagger import views as newton_json_view
+from common.exceptions import VimDriverNewtonException
+from newton_base.swagger import views as newton_json_view
logger = logging.getLogger(__name__)
diff --git a/windriver/titanium_cloud/urls.py b/windriver/titanium_cloud/urls.py
index 9757467e..10e24268 100644
--- a/windriver/titanium_cloud/urls.py
+++ b/windriver/titanium_cloud/urls.py
@@ -15,7 +15,7 @@
from django.conf.urls import include, url
from titanium_cloud.registration.views import registration
-from newton.requests.views import tenants
+from newton_base.openoapi import tenants
urlpatterns = [
url(r'^', include('titanium_cloud.swagger.urls')),
diff --git a/windriver/tox.ini b/windriver/tox.ini
index 418f6a14..29baba1a 100644
--- a/windriver/tox.ini
+++ b/windriver/tox.ini
@@ -7,7 +7,7 @@ downloadcache = ~/cache/pip
[testenv]
setenv =
- PYTHONPATH = {toxinidir}/../newton
+ PYTHONPATH = {toxinidir}/../newton:{toxinidir}/../share
deps = -r{toxinidir}/requirements.txt
commands =
coverage run --branch manage.py test titanium_cloud