summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBin Yang <bin.yang@windriver.com>2020-02-01 11:20:43 +0800
committerBin Yang <bin.yang@windriver.com>2020-02-01 12:03:46 +0800
commit0a542045a647da97f24b22ef41e422edac30ed9f (patch)
treee34cb8186439365aeda91e59dcfa1387b649e8bc
parentf1f52b3ccf0ab78007a98947211b4fcdfd54b5e6 (diff)
Enable the usage of msb https endpints
The default enpoint is still http Issue-ID: MULTICLOUD-978 Signed-off-by: Bin Yang <bin.yang@windriver.com> Change-Id: I2bb8e64bfe5a26a183b3f8bb86ebd9c3ab9481b0
-rw-r--r--multivimbroker/docker/Dockerfile1
-rw-r--r--multivimbroker/multivimbroker/pub/config/config.py1
-rw-r--r--multivimbroker/multivimbroker/pub/utils/restcall.py7
-rwxr-xr-xmultivimbroker/run.sh1
4 files changed, 8 insertions, 2 deletions
diff --git a/multivimbroker/docker/Dockerfile b/multivimbroker/docker/Dockerfile
index 2bfeac8..f12a875 100644
--- a/multivimbroker/docker/Dockerfile
+++ b/multivimbroker/docker/Dockerfile
@@ -1,5 +1,6 @@
FROM python:3.7-alpine
+ENV MSB_PROTO "http"
ENV MSB_ADDR "127.0.0.1"
ENV MSB_PORT "80"
ENV AAI_ADDR "aai.api.simpledemo.openecomp.org"
diff --git a/multivimbroker/multivimbroker/pub/config/config.py b/multivimbroker/multivimbroker/pub/config/config.py
index e0385e2..350bc92 100644
--- a/multivimbroker/multivimbroker/pub/config/config.py
+++ b/multivimbroker/multivimbroker/pub/config/config.py
@@ -13,6 +13,7 @@
import os
# [MSB]
+MSB_SERVICE_PROTOCOL = 'http'
MSB_SERVICE_IP = 'msb.onap.org'
MSB_SERVICE_PORT = '10080'
diff --git a/multivimbroker/multivimbroker/pub/utils/restcall.py b/multivimbroker/multivimbroker/pub/utils/restcall.py
index 7070824..c7386dc 100644
--- a/multivimbroker/multivimbroker/pub/utils/restcall.py
+++ b/multivimbroker/multivimbroker/pub/utils/restcall.py
@@ -26,6 +26,7 @@ from multivimbroker.pub.config.config import AAI_SCHEMA_VERSION
from multivimbroker.pub.config.config import AAI_SERVICE_URL
from multivimbroker.pub.config.config import AAI_USERNAME
from multivimbroker.pub.config.config import AAI_PASSWORD
+from multivimbroker.pub.config.config import MSB_SERVICE_PROTOCOL
from multivimbroker.pub.config.config import MSB_SERVICE_IP, MSB_SERVICE_PORT
rest_no_auth, rest_oneway_auth, rest_bothway_auth = 0, 1, 2
@@ -130,13 +131,15 @@ def call_req(base_url, user, passwd, auth_type, resource, method,
def req_by_msb(resource, method, content='', headers=None):
- base_url = "http://%s:%s/" % (MSB_SERVICE_IP, MSB_SERVICE_PORT)
+ base_url = "%s://%s:%s/" % (
+ MSB_SERVICE_PROTOCOL, MSB_SERVICE_IP, MSB_SERVICE_PORT)
return call_req(base_url, "", "",
rest_no_auth, resource, method, content, headers)
def req_by_msb_multipart(resource, method, content, headers=None):
- base_url = "http://%s:%s/" % (MSB_SERVICE_IP, MSB_SERVICE_PORT)
+ base_url = "%s://%s:%s/" % (
+ MSB_SERVICE_PROTOCOL, MSB_SERVICE_IP, MSB_SERVICE_PORT)
return call_multipart_req(base_url, "", "",
rest_no_auth, resource, method, content, headers)
diff --git a/multivimbroker/run.sh b/multivimbroker/run.sh
index f75f7c4..1079cf1 100755
--- a/multivimbroker/run.sh
+++ b/multivimbroker/run.sh
@@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+sed -i "s/MSB_SERVICE_PROTOCOL =.*/MSB_SERVICE_PROTOCOL = \"${MSB_PROTO}\"/g" multivimbroker/pub/config/config.py
sed -i "s/MSB_SERVICE_IP =.*/MSB_SERVICE_IP = \"${MSB_ADDR}\"/g" multivimbroker/pub/config/config.py
sed -i "s/MSB_SERVICE_PORT =.*/MSB_SERVICE_PORT = \"${MSB_PORT}\"/g" multivimbroker/pub/config/config.py
sed -i "s/AAI_ADDR =.*/AAI_ADDR = \"${AAI_ADDR}\"/g" multivimbroker/pub/config/config.py