aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryangyan <yangyanyj@chinamobile.com>2020-02-17 15:34:41 +0800
committeryangyan <yangyanyj@chinamobile.com>2020-02-17 15:58:03 +0800
commite18077f2ace1f788c640909ae63c0b2961ce3356 (patch)
tree29b69662297a722a276e7375e89794b07e5e1c64
parent99331f278095ca155313ab37a05c7787f5bf482c (diff)
Modify the request by msb with https
Change-Id: I4109664b6b6058d2d4b945c58a7d0c51facb1309 Issue-ID: VFC-1602 Signed-off-by: yangyan <yangyanyj@chinamobile.com>
-rw-r--r--catalog/pub/config/config.py9
-rw-r--r--catalog/pub/utils/restcall.py6
-rw-r--r--catalog/settings.py3
-rwxr-xr-xdocker/docker-entrypoint.sh6
-rwxr-xr-xdocker/instance_config.sh5
5 files changed, 24 insertions, 5 deletions
diff --git a/catalog/pub/config/config.py b/catalog/pub/config/config.py
index 1c6afb62..077ce0d1 100644
--- a/catalog/pub/config/config.py
+++ b/catalog/pub/config/config.py
@@ -13,8 +13,11 @@
# limitations under the License.
# [MSB]
+
+MSB_SERVICE_PROTOCOL = 'http'
MSB_SERVICE_IP = '127.0.0.1'
MSB_SERVICE_PORT = '443'
+MSB_BASE_URL = "%s://%s:%s" % (MSB_SERVICE_PROTOCOL, MSB_SERVICE_IP, MSB_SERVICE_PORT)
# [REDIS]
REDIS_HOST = '127.0.0.1'
@@ -83,4 +86,10 @@ SDC_BASE_URL = "http://msb-iag/api"
SDC_USER = "aai"
SDC_PASSWD = "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"
+# [aai config]
+AAI_BASE_URL = "http://10.0.14.1:80/aai/v11"
+AAI_USER = "AAI"
+AAI_PASSWD = "AAI"
+REPORT_TO_AAI = True
+
VNFD_SCHEMA_VERSION_DEFAULT = "base"
diff --git a/catalog/pub/utils/restcall.py b/catalog/pub/utils/restcall.py
index 1499f8f0..f4493eaa 100644
--- a/catalog/pub/utils/restcall.py
+++ b/catalog/pub/utils/restcall.py
@@ -20,7 +20,7 @@ import uuid
import httplib2
import base64
-from catalog.pub.config.config import MSB_SERVICE_IP, MSB_SERVICE_PORT
+from catalog.pub.config.config import MSB_SERVICE_IP, MSB_SERVICE_PORT, MSB_BASE_URL, MSB_SERVICE_PROTOCOL
rest_no_auth, rest_oneway_auth, rest_bothway_auth = 0, 1, 2
HTTP_200_OK, HTTP_201_CREATED, HTTP_204_NO_CONTENT, HTTP_202_ACCEPTED = '200', '201', '204', '202'
@@ -84,13 +84,13 @@ def call_req(base_url, user, passwd, auth_type, resource, method, content='', ad
def req_by_msb(resource, method, content=''):
- base_url = "https://%s:%s/" % (MSB_SERVICE_IP, MSB_SERVICE_PORT)
+ base_url = MSB_BASE_URL
return call_req(base_url, "", "", rest_no_auth, resource, method, content)
def upload_by_msb(resource, method, file_data={}):
headers = {'Content-Type': 'application/octet-stream'}
- full_url = "https://%s:%s/%s" % (MSB_SERVICE_IP, MSB_SERVICE_PORT, resource)
+ full_url = "%s://%s:%s/%s" % (MSB_SERVICE_PROTOCOL, MSB_SERVICE_IP, MSB_SERVICE_PORT, resource)
http = httplib2.Http()
resp, resp_content = http.request(full_url, method=method.upper(), body=file_data, headers=headers)
resp_status, resp_body = resp['status'], resp_content.decode('UTF-8')
diff --git a/catalog/settings.py b/catalog/settings.py
index 4eebb46f..17907147 100644
--- a/catalog/settings.py
+++ b/catalog/settings.py
@@ -132,7 +132,8 @@ STATICFILES_DIRS = [
pub_config.CATALOG_ROOT_PATH = os.path.join(STATICFILES_DIRS[0], "catalog")
pub_config.CATALOG_URL_PATH = "static/catalog"
-pub_config.SDC_BASE_URL = "https://%s:%s/api" % (pub_config.MSB_SERVICE_IP, pub_config.MSB_SERVICE_PORT)
+pub_config.SDC_BASE_URL = "%s://%s:%s/api" % (pub_config.MSB_SERVICE_PROTOCOL, pub_config.MSB_SERVICE_IP,
+ pub_config.MSB_SERVICE_PORT)
if platform.system() == 'Windows' or 'test' in sys.argv:
LOGGING = {
diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh
index 48211cad..9f0c9937 100755
--- a/docker/docker-entrypoint.sh
+++ b/docker/docker-entrypoint.sh
@@ -30,7 +30,11 @@ done
# Wait for DB initialization
echo "Wait for DB initialization"
for i in {1..5}; do
- curl -sS -m 1 $MYSQL_ADDR > /dev/null && break
+ curl -sS -m 1 $MSB_PROTO:$MSB_ADDR/msb -k > /dev/null
+ res=$i?
+ if [ $res -ne 0 ]; then
+ break
+ fi
sleep $i
done
diff --git a/docker/instance_config.sh b/docker/instance_config.sh
index 509cc8dc..32c6395d 100755
--- a/docker/instance_config.sh
+++ b/docker/instance_config.sh
@@ -1,5 +1,6 @@
#!/bin/bash
+MSB_PROTO=`echo $MSB_PROTO`
MSB_IP=`echo $MSB_ADDR | cut -d: -f 1`
MSB_PORT=`echo $MSB_ADDR | cut -d: -f 2`
@@ -7,6 +8,10 @@ if [ $MSB_IP ]; then
sed -i "s|MSB_SERVICE_IP.*|MSB_SERVICE_IP = '$MSB_IP'|" vfc/nfvo/catalog/catalog/pub/config/config.py
fi
+if [ $MSB_PROTO ]; then
+ sed -i "s|MSB_SERVICE_PROTOCOL = .*|MSB_SERVICE_PROTOCOL = '$MSB_PROTO'|" vfc/nfvo/catalog/catalog/pub/config/config.py
+fi
+
if [ $MSB_PORT ]; then
sed -i "s|MSB_SERVICE_PORT.*|MSB_SERVICE_PORT = '$MSB_PORT'|" vfc/nfvo/catalog/catalog/pub/config/config.py
fi