summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryangyan <yangyanyj@chinamobile.com>2020-02-17 16:38:44 +0800
committerYan Yang <yangyanyj@chinamobile.com>2020-02-17 09:37:20 +0000
commit725277ea69b1522afbe10a7e1421f8a3b9a5b5cf (patch)
treec554465c197f1a6e6dd094d0ab2e141c6546c664
parent2038120490e2675e215c72a36b41d718232f1175 (diff)
Modify the request by msb with https
Change-Id: I0d3fb55441ebc0f4858c9693c05a154abd6123d5 Issue-ID: VFC-1602 Signed-off-by: yangyan <yangyanyj@chinamobile.com>
-rwxr-xr-xzte/vmanager/docker/docker-entrypoint.sh6
-rwxr-xr-xzte/vmanager/docker/instance_config.sh5
-rw-r--r--zte/vmanager/driver/pub/config/config.py4
-rw-r--r--zte/vmanager/driver/pub/utils/restcall.py5
4 files changed, 16 insertions, 4 deletions
diff --git a/zte/vmanager/docker/docker-entrypoint.sh b/zte/vmanager/docker/docker-entrypoint.sh
index 38eb4666..0081696d 100755
--- a/zte/vmanager/docker/docker-entrypoint.sh
+++ b/zte/vmanager/docker/docker-entrypoint.sh
@@ -17,7 +17,11 @@ echo "MSB_ADDR=$MSB_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/zte/vmanager/docker/instance_config.sh b/zte/vmanager/docker/instance_config.sh
index 4995e5ec..fdddff02 100755
--- a/zte/vmanager/docker/instance_config.sh
+++ b/zte/vmanager/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/nfvo/driver/vnfm/svnfm/zte/vmanager/driver/pub/config/config.py
+fi
+
if [ $MSB_IP ]; then
sed -i "s|MSB_SERVICE_IP.*|MSB_SERVICE_IP = '$MSB_IP'|" vfc/nfvo/driver/vnfm/svnfm/zte/vmanager/driver/pub/config/config.py
fi
diff --git a/zte/vmanager/driver/pub/config/config.py b/zte/vmanager/driver/pub/config/config.py
index a8988801..2eeff668 100644
--- a/zte/vmanager/driver/pub/config/config.py
+++ b/zte/vmanager/driver/pub/config/config.py
@@ -16,8 +16,10 @@
VNF_FTP = "ftp://VMVNFM:Vnfm_1g3T@127.0.0.1:21/"
# [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)
# [MDC]
SERVICE_NAME = "ztevnfmdriver"
diff --git a/zte/vmanager/driver/pub/utils/restcall.py b/zte/vmanager/driver/pub/utils/restcall.py
index 74724e16..eff7c4c7 100644
--- a/zte/vmanager/driver/pub/utils/restcall.py
+++ b/zte/vmanager/driver/pub/utils/restcall.py
@@ -21,7 +21,8 @@ import uuid
import httplib2
-from driver.pub.config.config import MSB_SERVICE_IP, MSB_SERVICE_PORT
+
+from driver.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'
@@ -82,7 +83,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)