diff options
author | c00149107 <chenchuanyu@huawei.com> | 2018-02-07 11:46:46 +0800 |
---|---|---|
committer | c00149107 <chenchuanyu@huawei.com> | 2018-02-07 14:31:16 +0800 |
commit | 1fd5182d39dd63c30775b2dbf4910cd827cd6231 (patch) | |
tree | 404e3738dd70aba53537d22713b087c27eaaf3ce /adapters/mso-vfc-adapter | |
parent | dbf76d90eb8157cb84f58f4f8297513f885a4d73 (diff) |
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 <chenchuanyu@huawei.com>
Diffstat (limited to 'adapters/mso-vfc-adapter')
-rw-r--r-- | adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java | 23 |
1 files 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; |