summaryrefslogtreecommitdiffstats
path: root/ocata
diff options
context:
space:
mode:
authorHuang Haibin <haibin.huang@intel.com>2018-02-28 17:54:28 +0800
committerHuang Haibin <haibin.huang@intel.com>2018-03-01 03:50:22 +0800
commitc412b24619912b059bd748c0ed91c0a40ef71d2b (patch)
tree4866dbae3df9b7c7ef2eac48071d1ab0642a5cc0 /ocata
parentb14e1359642e17daf769ca39fa01e644135191f0 (diff)
settings.py replace config.py
the patch refer to https://gerrit.onap.org/r/#/c/23529 Change-Id: Ia42c9be995ef73ea12a4733cb967ffed1ce15101 Issue-ID: MULTICLOUD-138 Signed-off-by: Huang Haibin <haibin.huang@intel.com>
Diffstat (limited to 'ocata')
-rw-r--r--ocata/ocata/extensions/views/epacaps.py4
-rw-r--r--ocata/ocata/extensions/views/extensions.py4
-rw-r--r--ocata/ocata/proxy/views/identityV3.py6
-rw-r--r--ocata/ocata/proxy/views/services.py2
-rw-r--r--ocata/ocata/pub/__init__.py10
-rw-r--r--ocata/ocata/pub/config/__init__.py10
-rw-r--r--ocata/ocata/pub/config/config.py34
-rw-r--r--ocata/ocata/registration/views/registration.py6
-rw-r--r--ocata/ocata/settings.py24
-rw-r--r--ocata/run.sh16
10 files changed, 34 insertions, 82 deletions
diff --git a/ocata/ocata/extensions/views/epacaps.py b/ocata/ocata/extensions/views/epacaps.py
index d7567ea1..2c69ed9b 100644
--- a/ocata/ocata/extensions/views/epacaps.py
+++ b/ocata/ocata/extensions/views/epacaps.py
@@ -15,7 +15,7 @@ import logging
import json
import traceback
-from ocata.pub.config import config
+from django.conf import settings
from newton_base.extensions import epacaps as newton_epacaps
@@ -28,5 +28,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/ocata/ocata/extensions/views/extensions.py b/ocata/ocata/extensions/views/extensions.py
index c5da0730..f778d9f3 100644
--- a/ocata/ocata/extensions/views/extensions.py
+++ b/ocata/ocata/extensions/views/extensions.py
@@ -13,7 +13,7 @@
# limitations under the License.
import logging
-from ocata.pub.config import config
+from django.conf import settings
from newton_base.extensions import extensions as newton_extensions
logger = logging.getLogger(__name__)
@@ -24,5 +24,5 @@ class Extensions(newton_extensions.Extensions):
def __init__(self):
self._logger = logger
- self.proxy_prefix = config.MULTICLOUD_PREFIX
+ self.proxy_prefix = settings.MULTICLOUD_PREFIX
diff --git a/ocata/ocata/proxy/views/identityV3.py b/ocata/ocata/proxy/views/identityV3.py
index 549f12b0..5f11d847 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 ocata.pub.config import config
+from django.conf import settings
from newton_base.proxy import identityV3 as newton_identityV3
logger = logging.getLogger(__name__)
@@ -23,11 +23,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/ocata/ocata/proxy/views/services.py b/ocata/ocata/proxy/views/services.py
index d65da20a..7863393d 100644
--- a/ocata/ocata/proxy/views/services.py
+++ b/ocata/ocata/proxy/views/services.py
@@ -15,7 +15,7 @@ import logging
from rest_framework import status
-from ocata.pub.config import config
+from django.conf import settings
from newton_base.proxy import services as newton_services
logger = logging.getLogger(__name__)
diff --git a/ocata/ocata/pub/__init__.py b/ocata/ocata/pub/__init__.py
deleted file mode 100644
index 802f3fba..00000000
--- a/ocata/ocata/pub/__init__.py
+++ /dev/null
@@ -1,10 +0,0 @@
-# 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/pub/config/__init__.py b/ocata/ocata/pub/config/__init__.py
deleted file mode 100644
index 802f3fba..00000000
--- a/ocata/ocata/pub/config/__init__.py
+++ /dev/null
@@ -1,10 +0,0 @@
-# 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/pub/config/config.py b/ocata/ocata/pub/config/config.py
deleted file mode 100644
index 876e609e..00000000
--- a/ocata/ocata/pub/config/config.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# 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.
-
-import os
-
-# [MSB]
-MSB_SERVICE_ADDR = '127.0.0.1'
-MSB_SERVICE_PORT = '80'
-
-#[Multicloud]
-MULTICLOUD_PREFIX = "http://%s:%s/api/multicloud-ocata/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-Ocata'
-
-# [IMAGE LOCAL PATH]
-ROOT_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
diff --git a/ocata/ocata/registration/views/registration.py b/ocata/ocata/registration/views/registration.py
index be9b9d94..1003e128 100644
--- a/ocata/ocata/registration/views/registration.py
+++ b/ocata/ocata/registration/views/registration.py
@@ -13,7 +13,7 @@
# limitations under the License.
import logging
-from ocata.pub.config import config
+from django.conf import settings
from newton_base.registration import registration as newton_registration
@@ -24,6 +24,6 @@ DEBUG=True
class Registry(newton_registration.Registry):
def __init__(self):
- self.proxy_prefix = config.MULTICLOUD_PREFIX
- self.aai_base_url = config.AAI_BASE_URL
+ self.proxy_prefix = settings.MULTICLOUD_PREFIX
+ self.aai_base_url = settings.AAI_BASE_URL
self._logger = logger
diff --git a/ocata/ocata/settings.py b/ocata/ocata/settings.py
index 5567a06a..a1b279bc 100644
--- a/ocata/ocata/settings.py
+++ b/ocata/ocata/settings.py
@@ -116,11 +116,33 @@ CACHES = {
}
}
+# [MSB]
+MSB_SERVICE_ADDR = os.environ.get('MSB_ADDR', "127.0.0.1")
+MSB_SERVICE_PORT = os.environ.get('MSB_PORT', "80")
+
+#[Multicloud]
+MULTICLOUD_PREFIX = "http://%s:%s/api/multicloud-ocata/v0" % (
+ MSB_SERVICE_ADDR, MSB_SERVICE_PORT)
+
+# [A&AI]
+AAI_ADDR = os.environ.get('AAI_ADDR', "")
+AAI_PORT = os.environ.get('AAI_PORT', "")
+AAI_SERVICE_URL = 'https://%s:%s/aai' % (AAI_ADDR, AAI_PORT)
+AAI_SCHEMA_VERSION = os.environ.get('AAI_SCHEMA_VERSION', "")
+AAI_USERNAME = os.environ.get('AAI_USERNAME', "")
+AAI_PASSWORD = os.environ.get('AAI_PASSWORD', "")
+
+AAI_BASE_URL = "%s/%s" % (AAI_SERVICE_URL, AAI_SCHEMA_VERSION)
+
+MULTICLOUD_APP_ID = 'MultiCloud-Ocata'
+
+# [IMAGE LOCAL PATH]
+ROOT_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
OPENSTACK_VERSION = "ocata"
MULTIVIM_VERSION = "multicloud-" + OPENSTACK_VERSION
if 'test' in sys.argv:
- from ocata.pub.config import config
REST_FRAMEWORK = {}
import platform
diff --git a/ocata/run.sh b/ocata/run.sh
index 680290a2..ba235461 100644
--- a/ocata/run.sh
+++ b/ocata/run.sh
@@ -12,22 +12,6 @@
#!/bin/bash
-sed -i "s/MSB_SERVICE_ADDR =.*/MSB_SERVICE_ADDR = \"${MSB_ADDR}\"/g" ocata/pub/config/config.py
-sed -i "s/MSB_SERVICE_PORT =.*/MSB_SERVICE_PORT = \"${MSB_PORT}\"/g" ocata/pub/config/config.py
-sed -i "s/AAI_ADDR =.*/AAI_ADDR = \"${AAI_ADDR}\"/g" ocata/pub/config/config.py
-sed -i "s/AAI_PORT =.*/AAI_PORT = \"${AAI_PORT}\"/g" ocata/pub/config/config.py
-sed -i "s/AAI_SCHEMA_VERSION =.*/AAI_SCHEMA_VERSION = \"${AAI_SCHEMA_VERSION}\"/g" ocata/pub/config/config.py
-sed -i "s/AAI_USERNAME =.*/AAI_USERNAME = \"${AAI_USERNAME}\"/g" ocata/pub/config/config.py
-sed -i "s/AAI_PASSWORD =.*/AAI_PASSWORD = \"${AAI_PASSWORD}\"/g" ocata/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:lib/share
nohup python manage.py runserver 0.0.0.0:9006 2>&1 &