Modify the request by msb with https 09/101809/2
authoryangyan <yangyanyj@chinamobile.com>
Mon, 17 Feb 2020 07:34:41 +0000 (15:34 +0800)
committeryangyan <yangyanyj@chinamobile.com>
Mon, 17 Feb 2020 07:58:03 +0000 (15:58 +0800)
Change-Id: I4109664b6b6058d2d4b945c58a7d0c51facb1309
Issue-ID: VFC-1602
Signed-off-by: yangyan <yangyanyj@chinamobile.com>
catalog/pub/config/config.py
catalog/pub/utils/restcall.py
catalog/settings.py
docker/docker-entrypoint.sh
docker/instance_config.sh

index 1c6afb6..077ce0d 100644 (file)
 # 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"
index 1499f8f..f4493ea 100644 (file)
@@ -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')
index 4eebb46..1790714 100644 (file)
@@ -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 = {
index 48211ca..9f0c993 100755 (executable)
@@ -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
 
index 509cc8d..32c6395 100755 (executable)
@@ -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