diff options
author | 2017-09-20 10:44:04 +0800 | |
---|---|---|
committer | 2017-09-20 10:55:51 +0800 | |
commit | 981e6a8d0fc885acea9c6571ceaa5d58278cf536 (patch) | |
tree | d44503e0ecdc6e450b970bb54e3eff7b0cfecbdd /vnfmarket-be/vnf-sdk-marketplace/src/main/java | |
parent | 43148fa4eba15d92623455379e06beba46d9c4e1 (diff) |
solve msb ip hardcoding
critical: L20
Change-Id: I4ace8f3b9867fb2ea1f06f1e369b9bbf97ae7832
Signed-off-by: Harry Huang <huangxiangyu5@huawei.com>
Issue-Id: VNFSDK-85
Diffstat (limited to 'vnfmarket-be/vnf-sdk-marketplace/src/main/java')
2 files changed, 24 insertions, 14 deletions
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/CommonConstant.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/CommonConstant.java index efeef061..1ba18cd6 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/CommonConstant.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/CommonConstant.java @@ -16,8 +16,6 @@ package org.onap.vnfsdk.marketplace.common; public class CommonConstant { - // Address - public static final String DEFAULT_MSB_ADDRESS = "http://127.0.0.1:8080"; // Package Status public static final String PACKAGE_STATUS_DELETING = "deleting"; @@ -87,15 +85,6 @@ public class CommonConstant { } } - public static class LifeCycleTest - { - public static final String LIFECYCLE_TEST_URL = "/openoapi/nslcm/v1/vnfpackage"; - public static final String LIFECYCLE_TEST_OPERTYPE_ID = "lifecycletest"; - public static final String LIFECYCLE_TEST_EXEC = "lifecycleTestexec"; - private LifeCycleTest() { - } - } - public static class HttpContext { public static final String CONTENT_TYPE = "Content-Type"; @@ -110,6 +99,15 @@ public class CommonConstant { } } + public static class LifeCycleTest + { + public static final String LIFECYCLE_TEST_URL = "/openoapi/nslcm/v1/vnfpackage"; + public static final String LIFECYCLE_TEST_OPERTYPE_ID = "lifecycletest"; + public static final String LIFECYCLE_TEST_EXEC = "lifecycleTestexec"; + private LifeCycleTest() { + } + } + public static class MethodType { public static final String POST = "post"; diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/HttpServerPathConfig.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/HttpServerPathConfig.java index f7a499b5..af6f428f 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/HttpServerPathConfig.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/HttpServerPathConfig.java @@ -14,8 +14,14 @@ * limitations under the License. */ package org.onap.vnfsdk.marketplace.common; +import java.net.InetAddress; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class HttpServerPathConfig { + public static final Logger logger = LoggerFactory.getLogger(FileUtil.class); + protected static String httpServerPath; private HttpServerPathConfig() { @@ -23,9 +29,15 @@ public class HttpServerPathConfig { static { - MsbAddrConfig.setMsbAddress(CommonConstant.DEFAULT_MSB_ADDRESS); - HttpServerAddrConfig.setHttpServerAddress(CommonConstant.DEFAULT_MSB_ADDRESS); - HttpServerPathConfig.setHttpServerPath("../tomcat/webapps/ROOT/"); + try { + InetAddress address = InetAddress.getByName("localhost"); + String msbAddress = "http://" + address.getHostAddress() + ":8080"; + MsbAddrConfig.setMsbAddress(msbAddress); + HttpServerAddrConfig.setHttpServerAddress(msbAddress); + HttpServerPathConfig.setHttpServerPath("../tomcat/webapps/ROOT/"); + } catch (Exception e) { + logger.info("error while config htttp server", e); + } } public static String getHttpServerPath() { |