From 1fd5182d39dd63c30775b2dbf4910cd827cd6231 Mon Sep 17 00:00:00 2001 From: c00149107 Date: Wed, 7 Feb 2018 11:46:46 +0800 Subject: Get Msb Ip from env parameter Get Msb Ip from env parameter instead of config file. Change-Id: I86e1664ffb4f817d70631f870c49a773bf04cc04 Issue-ID: SO-410 Signed-off-by: c00149107 --- .../mso/adapters/vfc/util/RestfulUtil.java | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java index 7690d80609..afee1bbfaa 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java @@ -63,20 +63,27 @@ public class RestfulUtil { private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger(); private static final int DEFAULT_TIME_OUT = 60000; + + private static final String ONAP_IP = "ONAP_IP"; + + private static final String DEFAULT_MSB_IP = "127.0.0.1"; + + private static final String DEFAULT_MSB_PORT = "80"; private static final MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory(); public static String getMsbHost() { - String msbIp = "10.229.32.131"; - String msbPort = "8090"; + String msbPort = DEFAULT_MSB_PORT; + // MSB_IP will be set as ONAP_IP environment parameter in install flow. + String msbIp = System.getenv().get(ONAP_IP); try { - msbIp = msoPropertiesFactory.getMsoJavaProperties("MSO_PROP_TOPOLOGY").getProperty("msb-ip", - "10.229.32.131"); - msbPort = msoPropertiesFactory.getMsoJavaProperties("MSO_PROP_TOPOLOGY").getProperty("msb-port", "8099"); - + // if ONAP IP is not set. get it from config file. + if(null == msbIp || msbIp.isEmpty()) { + msbIp = msoPropertiesFactory.getMsoJavaProperties("MSO_PROP_TOPOLOGY").getProperty("msb-ip", DEFAULT_MSB_IP); + msbPort = msoPropertiesFactory.getMsoJavaProperties("MSO_PROP_TOPOLOGY").getProperty("msb-port", DEFAULT_MSB_PORT); + } } catch(MsoPropertiesException e) { - LOGGER.error(MessageEnum.RA_NS_EXC, "VFC Adapter", "", MsoLogger.ErrorCode.AvailabilityError, - "Get msb properties failed"); + LOGGER.error(MessageEnum.RA_NS_EXC, "VFC Adapter", "", MsoLogger.ErrorCode.AvailabilityError, "Get msb properties failed"); e.printStackTrace(); } return "http://" + msbIp + ":" + msbPort; -- cgit 1.2.3-korg