From c414590146754e0f6d60ed1edba385c902b65186 Mon Sep 17 00:00:00 2001 From: yangyan Date: Mon, 17 Feb 2020 16:07:18 +0800 Subject: Modify the request by msb with https Change-Id: I5a456d9da38fdb1f2818d52df1e2c4ce963bc29b Issue-ID: VFC-1602 Signed-off-by: yangyan --- gvnfmadapter/docker/docker-entrypoint.sh | 6 +++++- gvnfmadapter/docker/instance_config.sh | 5 +++++ gvnfmadapter/driver/pub/config/config.py | 2 ++ gvnfmadapter/driver/pub/utils/restcall.py | 4 ++-- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/gvnfmadapter/docker/docker-entrypoint.sh b/gvnfmadapter/docker/docker-entrypoint.sh index 6b54149..753f737 100755 --- a/gvnfmadapter/docker/docker-entrypoint.sh +++ b/gvnfmadapter/docker/docker-entrypoint.sh @@ -14,7 +14,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/gvnfmadapter/docker/instance_config.sh b/gvnfmadapter/docker/instance_config.sh index e69f6d0..a18ae7e 100755 --- a/gvnfmadapter/docker/instance_config.sh +++ b/gvnfmadapter/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/driver/vnfm/gvnfm/gvnfmadapter/driver/pub/config/config.py fi +if [ $MSB_PROTO ]; then + sed -i "s|MSB_SERVICE_PROTOCOL = .*|MSB_SERVICE_PROTOCOL = '$MSB_PROTO'|" vfc/nfvo/driver/vnfm/gvnfm/gvnfmadapter/driver/pub/config/config.py +fi + if [ $MSB_PORT ]; then sed -i "s|MSB_SERVICE_PORT.*|MSB_SERVICE_PORT = '$MSB_PORT'|" vfc/nfvo/driver/vnfm/gvnfm/gvnfmadapter/driver/pub/config/config.py fi diff --git a/gvnfmadapter/driver/pub/config/config.py b/gvnfmadapter/driver/pub/config/config.py index ab1d024..4c01ded 100644 --- a/gvnfmadapter/driver/pub/config/config.py +++ b/gvnfmadapter/driver/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 = '443' +MSB_BASE_URL = "%s://%s:%s" % (MSB_SERVICE_PROTOCOL, MSB_SERVICE_IP, MSB_SERVICE_PORT) # [MDC] SERVICE_NAME = "gvnfmdriver" diff --git a/gvnfmadapter/driver/pub/utils/restcall.py b/gvnfmadapter/driver/pub/utils/restcall.py index 1239545..7517fbd 100644 --- a/gvnfmadapter/driver/pub/utils/restcall.py +++ b/gvnfmadapter/driver/pub/utils/restcall.py @@ -20,7 +20,7 @@ import urllib.error 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' @@ -81,7 +81,7 @@ def call_req(base_url, user, passwd, auth_type, resource, method, content=''): 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) -- cgit 1.2.3-korg