summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-rw-r--r--share/common/config.py35
-rw-r--r--share/common/utils/restcall.py10
-rw-r--r--share/common/utils/share_lock.py6
3 files changed, 9 insertions, 42 deletions
diff --git a/share/common/config.py b/share/common/config.py
deleted file mode 100644
index e3d3db4e..00000000
--- a/share/common/config.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# 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.
-
-import os
-
-# [MSB]
-MSB_SERVICE_ADDR = '127.0.0.1'
-MSB_SERVICE_PORT = '80'
-
-
-#[Multicloud]
-MULTICLOUD_PREFIX = "http://%s:%s/api/multicloud-newton/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-Newton'
-
-# [IMAGE LOCAL PATH]
-ROOT_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
diff --git a/share/common/utils/restcall.py b/share/common/utils/restcall.py
index 38bcf39c..f19ea838 100644
--- a/share/common/utils/restcall.py
+++ b/share/common/utils/restcall.py
@@ -23,7 +23,7 @@ import httplib2
import uuid
from rest_framework import status
-from common import config
+from django.conf import settings
rest_no_auth, rest_oneway_auth, rest_bothway_auth = 0, 1, 2
HTTP_200_OK, HTTP_201_CREATED = '200', '201'
@@ -104,7 +104,7 @@ def _call_req(base_url, user, passwd, auth_type,
def req_by_msb(resource, method, content=''):
- base_url = "http://%s:%s/" % (config.MSB_SERVICE_ADDR, config.MSB_SERVICE_PORT)
+ base_url = "http://%s:%s/" % (settings.MSB_SERVICE_ADDR, settings.MSB_SERVICE_PORT)
return _call_req(base_url, "", "", rest_no_auth,
resource, method, "", content)
@@ -114,7 +114,7 @@ def req_to_vim(base_url, resource, method, extra_headers='', content=''):
resource, method, extra_headers, content)
-def req_to_aai(resource, method, content='', appid=config.MULTICLOUD_APP_ID):
+def req_to_aai(resource, method, content='', appid=settings.MULTICLOUD_APP_ID):
tmp_trasaction_id = '9003' #str(uuid.uuid1())
headers = {
'X-FromAppId': appid,
@@ -124,8 +124,8 @@ def req_to_aai(resource, method, content='', appid=config.MULTICLOUD_APP_ID):
}
logger.debug("req_to_aai--%s::> %s, %s" %
- (tmp_trasaction_id, method, _combine_url(config.AAI_BASE_URL,resource)))
- return _call_req(config.AAI_BASE_URL, config.AAI_USERNAME, config.AAI_PASSWORD, rest_no_auth,
+ (tmp_trasaction_id, method, _combine_url(settings.AAI_BASE_URL,resource)))
+ return _call_req(settings.AAI_BASE_URL, settings.AAI_USERNAME, settings.AAI_PASSWORD, rest_no_auth,
resource, method, content=json.dumps(content), extra_headers=headers)
diff --git a/share/common/utils/share_lock.py b/share/common/utils/share_lock.py
index 7ffc7b47..45a2b50e 100644
--- a/share/common/utils/share_lock.py
+++ b/share/common/utils/share_lock.py
@@ -15,11 +15,13 @@ import time
import redis
-from common.config.config import REDIS_HOST, REDIS_PORT, REDIS_PASSWD
+from django.conf import settings
class SharedLock:
- def __init__(self, lock_key, host=REDIS_HOST, port=REDIS_PORT, password=REDIS_PASSWD, db=9, lock_timeout=5 * 60):
+ def __init__(self, lock_key, host=settings.REDIS_HOST,
+ port=settings.REDIS_PORT,
+ password=settings.REDIS_PASSWD, db=9, lock_timeout=5 * 60):
self.lock_key = lock_key
self.lock_timeout = lock_timeout
self.redis = redis.Redis(host=host, port=port, db=db, password=password)