Modify the request by msb with https 61/101861/2
authoryangyan <yangyanyj@chinamobile.com>
Tue, 18 Feb 2020 00:53:02 +0000 (08:53 +0800)
committerYan Yang <yangyanyj@chinamobile.com>
Tue, 18 Feb 2020 00:55:24 +0000 (00:55 +0000)
Change-Id: I1039e8a4a03a15c5548a91ba1f018d1e7d4d57b5
Issue-ID: VFC-1602
Signed-off-by: yangyan <yangyanyj@chinamobile.com>
mgr/docker/docker-entrypoint.sh
mgr/docker/instance_config.sh
mgr/mgr/pub/config/config.py
mgr/mgr/pub/utils/restcall.py

index ecdd938..55e6890 100755 (executable)
@@ -20,7 +20,11 @@ echo "MYSQL_ADDR=$MYSQL_ADDR"
 # Wait for MSB initialization
 echo "Wait for MSB initialization"
 for i in {1..5}; do
-    curl -sS -m 1 $MSB_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 02024d4..3259f48 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/gvnfm/vnfmgr/mgr/mgr/pub/config/config.py
 fi
 
+if [ $MSB_PROTO ]; then
+    sed -i "s|MSB_SERVICE_PROTOCOL = .*|MSB_SERVICE_PROTOCOL = '$MSB_PROTO'|" vfc/gvnfm/vnfmgr/mgr/mgr/pub/config/config.py
+fi
+
 if [ $MSB_PORT ]; then
     sed -i "s|MSB_SERVICE_PORT.*|MSB_SERVICE_PORT = '$MSB_PORT'|" vfc/gvnfm/vnfmgr/mgr/mgr/pub/config/config.py
 fi
index 3eb285e..c67effd 100644 (file)
 # limitations under the License.
 
 # [MSB]
+MSB_SERVICE_PROTOCOL = 'http'
 MSB_SERVICE_IP = '127.0.0.1'
-MSB_SERVICE_PORT = '80'
+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'
index 567361b..e37156d 100644 (file)
@@ -20,7 +20,7 @@ import urllib
 import uuid
 import httplib2
 
-from mgr.pub.config.config import MSB_SERVICE_IP, MSB_SERVICE_PORT
+from mgr.pub.config.config import MSB_BASE_URL
 
 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'
@@ -77,7 +77,7 @@ def call_req(base_url, user, passwd, auth_type, resource, method, content=''):
 
 
 def req_by_msb(resource, method, content=''):
-    base_url = "http://%s:%s/" % (MSB_SERVICE_IP, MSB_SERVICE_PORT)
+    base_url = MSB_BASE_URL
     return call_req(base_url, "", "", rest_no_auth, resource, method, content)