diff options
author | Yulian Han <elaine.hanyulian@huawei.com> | 2018-11-29 19:32:31 +0800 |
---|---|---|
committer | Yulian Han <elaine.hanyulian@huawei.com> | 2018-11-29 19:32:31 +0800 |
commit | eea9276879c723444c7eaf95ada94ce057d7f6ab (patch) | |
tree | f351e65c83d8276cbd1689b1efcfe80f78ef297f /adapters/mso-vfc-adapter/src | |
parent | 0a9ca68c09d8250cb62e94a45aacc7e52133ff00 (diff) |
vfc adapter authentication bug fix
update OperationStatus Based On ResourceStatus
add Authorization header to get csar from db
Change-Id: Idaa55084f5ecb0dd3636c232cebc14fa5f064414
Issue-ID: SO-1256
Signed-off-by: Yulian Han <elaine.hanyulian@huawei.com>
Diffstat (limited to 'adapters/mso-vfc-adapter/src')
-rw-r--r-- | adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java index 1db9d9546d..bb7fa70bda 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java @@ -43,7 +43,6 @@ import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; import org.onap.so.adapters.vfc.model.RestfulResponse; import org.onap.so.logger.MessageEnum; - import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; @@ -66,8 +65,6 @@ public class RestfulUtil { */ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, RestfulUtil.class); - - private static final int DEFAULT_TIME_OUT = 60000; private static final String ONAP_IP = "ONAP_IP"; @@ -82,15 +79,18 @@ public class RestfulUtil { private Environment env; public String getMsbHost() { - // MSB_IP will be set as ONAP_IP environment parameter in install flow. - String msbIp = System.getenv().get(ONAP_IP); - // if ONAP IP is not set. get it from config file. - if(null == msbIp || msbIp.isEmpty()) { - msbIp = env.getProperty("mso.msb-ip", DEFAULT_MSB_IP); - } + // MSB_IP will be set as ONAP_IP environment parameter in install flow. + String msbIp = System.getenv().get(ONAP_IP); + // if ONAP IP is not set. get it from config file. + if (null == msbIp || msbIp.isEmpty()) { + msbIp = env.getProperty("mso.msb-ip", DEFAULT_MSB_IP); + } Integer msbPort = env.getProperty("mso.msb-port", Integer.class, DEFAULT_MSB_PORT); - return UriBuilder.fromPath("").host(msbIp).port(msbPort).scheme("http").build().toString(); + String msbEndpoint = UriBuilder.fromPath("").host(msbIp).port(msbPort).scheme("http").build().toString(); + LOGGER.debug("msbEndpoint in vfc adapter: " + msbEndpoint); + + return msbEndpoint; } private RestfulUtil() { @@ -99,7 +99,7 @@ public class RestfulUtil { public RestfulResponse send(String url, String methodType, String content) { String msbUrl = getMsbHost() + url; - LOGGER.info(MessageEnum.RA_NS_EXC, "Begin to sent message " + methodType +": " + msbUrl, "org.onap.so.adapters.vfc.util.RestfulUtil",VFC_ADAPTER); + LOGGER.debug("Begin to sent message " + methodType +": " + msbUrl); HttpRequestBase method = null; HttpResponse httpResponse = null; @@ -201,12 +201,10 @@ public class RestfulUtil { private static void logError(String errMsg, Throwable t) { LOGGER.error(MessageEnum.RA_NS_EXC, VFC_ADAPTER, "", MsoLogger.ErrorCode.AvailabilityError, errMsg, t); - } private static void logError(String errMsg) { LOGGER.error(MessageEnum.RA_NS_EXC, VFC_ADAPTER, "", MsoLogger.ErrorCode.AvailabilityError, errMsg); - } private static RestfulResponse createResponse(int statusCode, String content) { |