summaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authoryangyan <yangyanyj@chinamobile.com>2020-02-17 17:50:54 +0800
committerYan Yang <yangyanyj@chinamobile.com>2020-02-17 09:52:04 +0000
commit9456cb60f814945aa6fdaf6e241613d0785eaf04 (patch)
tree48cc544ab88bf9985a9c5f8f3c47a3c5ec56f2c6 /res
parent619bbcce12b79d75358e595139b6e25d99be5832 (diff)
Modify the request by msb with https
Change-Id: I3d5ac977c3f3e664078428684aa50387fc71bdeb Issue-ID: VFC-1602 Signed-off-by: yangyan <yangyanyj@chinamobile.com>
Diffstat (limited to 'res')
-rwxr-xr-xres/docker/docker-entrypoint.sh6
-rwxr-xr-xres/docker/instance_config.sh5
-rw-r--r--res/res/pub/config/config.py4
-rw-r--r--res/res/pub/utils/restcall.py5
4 files changed, 16 insertions, 4 deletions
diff --git a/res/docker/docker-entrypoint.sh b/res/docker/docker-entrypoint.sh
index a4caa72..ec53bd9 100755
--- a/res/docker/docker-entrypoint.sh
+++ b/res/docker/docker-entrypoint.sh
@@ -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
diff --git a/res/docker/instance_config.sh b/res/docker/instance_config.sh
index 5ad6b9f..6860429 100755
--- a/res/docker/instance_config.sh
+++ b/res/docker/instance_config.sh
@@ -1,8 +1,13 @@
#!/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`
+if [ $MSB_PROTO ]; then
+ sed -i "s|MSB_SERVICE_PROTOCOL = .*|MSB_SERVICE_PROTOCOL = '$MSB_PROTO'|" vfc/gvnfm/vnfres/res/res/pub/config/config.py
+fi
+
if [ $MSB_IP ]; then
sed -i "s|MSB_SERVICE_IP.*|MSB_SERVICE_IP = '$MSB_IP'|" vfc/gvnfm/vnfres/res/res/pub/config/config.py
fi
diff --git a/res/res/pub/config/config.py b/res/res/pub/config/config.py
index d3ba554..d314ef8 100644
--- a/res/res/pub/config/config.py
+++ b/res/res/pub/config/config.py
@@ -13,8 +13,10 @@
# 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'
diff --git a/res/res/pub/utils/restcall.py b/res/res/pub/utils/restcall.py
index a609a9a..411b94d 100644
--- a/res/res/pub/utils/restcall.py
+++ b/res/res/pub/utils/restcall.py
@@ -19,7 +19,8 @@ import urllib
import uuid
import httplib2
-from res.pub.config.config import MSB_SERVICE_IP, MSB_SERVICE_PORT
+
+from res.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'
@@ -79,7 +80,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)