summaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/BpelRestClient.java298
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java1
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java4
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/BpelRestClientTest.java55
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java1
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java20
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java12
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java24
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java31
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java13
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java57
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java24
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java31
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java33
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCAdapterUtils.java10
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java49
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java10
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java33
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java31
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/TypedRequestTunables.java9
-rw-r--r--adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/FileUtil.java9
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NSResourceInputParameter.java11
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java10
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java46
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java11
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java31
26 files changed, 278 insertions, 586 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/BpelRestClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/BpelRestClient.java
deleted file mode 100644
index 6c646f3e63..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/BpelRestClient.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.network;
-
-
-import java.security.GeneralSecurityException;
-import java.util.Set;
-import java.util.TreeSet;
-
-import javax.annotation.PostConstruct;
-import javax.xml.bind.DatatypeConverter;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.client.config.RequestConfig;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.ContentType;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.apache.http.util.EntityUtils;
-import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
-import org.onap.so.utils.CryptoUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.core.env.Environment;
-import org.springframework.stereotype.Component;
-
-/**
- * This is the class that is used to POST replies from the MSO adapters to the BPEL engine.
- * It can be configured via property file, or modified using the member methods.
- * The properties to use are:
- * org.onap.so.adapters.vnf.bpelauth encrypted authorization string to send to BEPL engine
- * org.onap.so.adapters.vnf.sockettimeout socket timeout value
- * org.onap.so.adapters.vnf.connecttimeout connect timeout value
- * org.onap.so.adapters.vnf.retrycount number of times to retry failed connections
- * org.onap.so.adapters.vnf.retryinterval interval (in seconds) between retries
- * org.onap.so.adapters.vnf.retrylist list of response codes that will trigger a retry (the special code
- * 900 means "connection was not established")
- */
-@Component("NetworkBpel")
-@Scope("prototype")
-public class BpelRestClient {
- public static final String MSO_PROP_NETWORK_ADAPTER = "MSO_PROP_NETWORK_ADAPTER";
- private static final String PROPERTY_DOMAIN = "org.onap.so.adapters.network";
- private static final String BPEL_AUTH_PROPERTY = PROPERTY_DOMAIN+".bpelauth";
- private static final String SOCKET_TIMEOUT_PROPERTY = PROPERTY_DOMAIN+".sockettimeout";
- private static final String CONN_TIMEOUT_PROPERTY = PROPERTY_DOMAIN+".connecttimeout";
- private static final String RETRY_COUNT_PROPERTY = PROPERTY_DOMAIN+".retrycount";
- private static final String RETRY_INTERVAL_PROPERTY = PROPERTY_DOMAIN+".retryinterval";
- private static final String RETRY_LIST_PROPERTY = PROPERTY_DOMAIN+".retrylist";
- private static final String ENCRYPTION_KEY_PROP = PROPERTY_DOMAIN + ".encryptionKey";
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, BpelRestClient.class);
-
- @Autowired
- private Environment env;
- /** Default socket timeout (in seconds) */
- public static final int DEFAULT_SOCKET_TIMEOUT = 5;
- /** Default connect timeout (in seconds) */
- public static final int DEFAULT_CONNECT_TIMEOUT = 5;
- /** By default, retry up to five times */
- public static final int DEFAULT_RETRY_COUNT = 5;
- /** Default interval to wait between retries (in seconds), negative means use backoff algorithm */
- public static final int DEFAULT_RETRY_INTERVAL = -15;
- /** Default list of response codes to trigger a retry */
- public static final String DEFAULT_RETRY_LIST = "408,429,500,502,503,504,900"; // 900 is "connection failed"
- /** Default credentials */
- public static final String DEFAULT_CREDENTIALS = "";
-
- // Properties of the BPEL client -- all are configurable
- private int socketTimeout;
- private int connectTimeout;
- private int retryCount;
- private int retryInterval;
- private Set<Integer> retryList;
- private String credentials;
-
- // last response from BPEL engine
- private int lastResponseCode;
- private String lastResponse;
-
- /**
- * Create a client to send results to the BPEL engine, using configuration from the
- * MSO_PROP_NETWORK_ADAPTER properties.
- */
- public BpelRestClient() {
- socketTimeout = DEFAULT_SOCKET_TIMEOUT;
- connectTimeout = DEFAULT_CONNECT_TIMEOUT;
- retryCount = DEFAULT_RETRY_COUNT;
- retryInterval = DEFAULT_RETRY_INTERVAL;
- setRetryList(DEFAULT_RETRY_LIST);
- credentials = DEFAULT_CREDENTIALS;
- lastResponseCode = 0;
- lastResponse = "";
-
- }
-
- @PostConstruct
- protected void init() {
-
- socketTimeout = env.getProperty(SOCKET_TIMEOUT_PROPERTY, Integer.class, DEFAULT_SOCKET_TIMEOUT);
- connectTimeout = env.getProperty(CONN_TIMEOUT_PROPERTY, Integer.class, DEFAULT_CONNECT_TIMEOUT);
- retryCount = env.getProperty(RETRY_COUNT_PROPERTY, Integer.class, DEFAULT_RETRY_COUNT);
- retryInterval = env.getProperty(RETRY_INTERVAL_PROPERTY, Integer.class, DEFAULT_RETRY_INTERVAL);
- setRetryList(env.getProperty(RETRY_LIST_PROPERTY, DEFAULT_RETRY_LIST));
- credentials = getEncryptedProperty(BPEL_AUTH_PROPERTY, DEFAULT_CREDENTIALS, env.getProperty(ENCRYPTION_KEY_PROP));
- }
-
- public int getSocketTimeout() {
- return socketTimeout;
- }
-
- public void setSocketTimeout(int socketTimeout) {
- this.socketTimeout = socketTimeout;
- }
-
- public int getConnectTimeout() {
- return connectTimeout;
- }
-
- public void setConnectTimeout(int connectTimeout) {
- this.connectTimeout = connectTimeout;
- }
-
- public int getRetryCount() {
- return retryCount;
- }
-
- public void setRetryCount(int retryCount) {
- int retCnt = 0;
- if (retryCount < 0)
- retCnt = DEFAULT_RETRY_COUNT;
- this.retryCount = retCnt;
- }
-
- public int getRetryInterval() {
- return retryInterval;
- }
-
- public void setRetryInterval(int retryInterval) {
- this.retryInterval = retryInterval;
- }
-
- public String getCredentials() {
- return credentials;
- }
-
- public void setCredentials(String credentials) {
- this.credentials = credentials;
- }
-
- public String getRetryList() {
- if (retryList.isEmpty())
- return "";
- String t = retryList.toString();
- return t.substring(1, t.length()-1);
- }
-
- public void setRetryList(String retryList) {
- Set<Integer> s = new TreeSet<>();
- for (String t : retryList.split("[, ]")) {
- try {
- s.add(Integer.parseInt(t));
- } catch (NumberFormatException x) {
- LOGGER.debug("Exception while parsing", x);
- }
- }
- this.retryList = s;
- }
-
- public int getLastResponseCode() {
- return lastResponseCode;
- }
-
- public String getLastResponse() {
- return lastResponse;
- }
-
- /**
- * Post a response to the URL of the BPEL engine. As long as the response code is one of those in
- * the retryList, the post will be retried up to "retrycount" times with an interval (in seconds)
- * of "retryInterval". If retryInterval is negative, then each successive retry interval will be
- * double the previous one.
- * @param toBpelStr the content (XML or JSON) to post
- * @param bpelUrl the URL to post to
- * @param isxml true if the content is XML, otherwise assumed to be JSON
- * @return true if the post succeeded, false if all retries failed
- */
- public boolean bpelPost(final String toBpelStr, final String bpelUrl, final boolean isxml) {
- debug("Sending response to BPEL: " + toBpelStr);
- int totalretries = 0;
- int retryint = retryInterval;
- while (true) {
- sendOne(toBpelStr, bpelUrl, isxml);
- // Note: really should handle response code 415 by switching between content types if needed
- if (!retryList.contains(lastResponseCode)) {
- debug("Got response code: " + lastResponseCode + ": returning.");
- return true;
- }
- if (totalretries >= retryCount) {
- debug("Retried " + totalretries + " times, giving up.");
- LOGGER.error(MessageEnum.RA_SEND_VNF_NOTIF_ERR, "Could not deliver response to BPEL after "+totalretries+" tries: "+toBpelStr, "Camunda", "", MsoLogger.ErrorCode.DataError, "Could not deliver response to BPEL");
- return false;
- }
- totalretries++;
- int sleepinterval = retryint;
- if (retryint < 0) {
- // if retry interval is negative double the retry on each pass
- sleepinterval = -retryint;
- retryint *= 2;
- }
- debug("Sleeping for " + sleepinterval + " seconds.");
- try {
- Thread.sleep(sleepinterval * 1000L);
- } catch (InterruptedException e) {
- LOGGER.debug("Exception while Thread sleep", e);
- Thread.currentThread().interrupt();
- }
- }
- }
- private void debug(String m) {
- LOGGER.debug(m);
- }
- private void sendOne(final String toBpelStr, final String bpelUrl, final boolean isxml) {
- LOGGER.debug("Sending to BPEL server: "+bpelUrl);
- LOGGER.debug("Content is: "+toBpelStr);
-
- //POST
- HttpPost post = new HttpPost(bpelUrl);
- if (credentials != null && !credentials.isEmpty())
- post.addHeader("Authorization", "Basic " + DatatypeConverter.printBase64Binary(credentials.getBytes()));
-
- //ContentType
- ContentType ctype = isxml ? ContentType.APPLICATION_XML : ContentType.APPLICATION_JSON;
- post.setEntity(new StringEntity(toBpelStr, ctype));
-
- //Timeouts
- RequestConfig requestConfig = RequestConfig
- .custom()
- .setSocketTimeout(socketTimeout * 1000)
- .setConnectTimeout(connectTimeout * 1000)
- .build();
- post.setConfig(requestConfig);
-
- //Client 4.3+
- //Execute & GetResponse
- try (CloseableHttpClient client = HttpClients.createDefault()) {
- CloseableHttpResponse response = client.execute(post);
- if (response != null) {
- lastResponseCode = response.getStatusLine().getStatusCode();
- HttpEntity entity = response.getEntity();
- lastResponse = (entity != null) ? EntityUtils.toString(entity) : "";
- } else {
- lastResponseCode = 900;
- lastResponse = "";
- }
- } catch (Exception e) {
- String error = "Error sending Bpel notification:" + toBpelStr;
- LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, error, "Camunda", "", MsoLogger.ErrorCode.AvailabilityError, "Exception sending Bpel notification", e);
- lastResponseCode = 900;
- lastResponse = "";
- }
- LOGGER.debug("Response code from BPEL server: "+lastResponseCode);
- LOGGER.debug("Response body is: "+lastResponse);
- }
-
- private String getEncryptedProperty(String key, String defaultValue, String encryptionKey) {
- if (env.getProperty(key) != null) {
- try {
- return CryptoUtils.decrypt(env.getProperty(key), encryptionKey);
- } catch (GeneralSecurityException e) {
- LOGGER.debug("Exception while decrypting property: " + env.getProperty(key), e);
- }
- }
- return defaultValue;
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
index 8d08b3b52c..fd658244ee 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
@@ -59,6 +59,7 @@ import org.onap.so.adapters.nwrest.RollbackNetworkResponse;
import org.onap.so.adapters.nwrest.UpdateNetworkError;
import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
+import org.onap.so.adapters.vnf.BpelRestClient;
import org.onap.so.entity.MsoRequest;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java
index 5fa21c64b1..4b02b73786 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java
@@ -57,7 +57,7 @@ import org.springframework.stereotype.Component;
* org.onap.so.adapters.vnf.retrylist list of response codes that will trigger a retry (the special code
* 900 means "connection was not established")
*/
-@Component("VnfBpel")
+@Component()
@Scope("prototype")
public class BpelRestClient {
public static final String MSO_PROP_VNF_ADAPTER = "MSO_PROP_VNF_ADAPTER";
@@ -249,6 +249,8 @@ public class BpelRestClient {
if (credentials != null && !credentials.isEmpty())
post.addHeader("Authorization", "Basic " + DatatypeConverter.printBase64Binary(credentials.getBytes()));
+ LOGGER.debug("HTTPPost Headers: " + post.getAllHeaders());
+
//ContentType
ContentType ctype = isxml ? ContentType.APPLICATION_XML : ContentType.APPLICATION_JSON;
post.setEntity(new StringEntity(toBpelStr, ctype));
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/BpelRestClientTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/BpelRestClientTest.java
deleted file mode 100644
index 02a5f25b41..0000000000
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/BpelRestClientTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.network;
-
-import static org.junit.Assert.assertEquals;
-
-import javax.inject.Provider;
-
-import org.junit.Test;
-import org.onap.so.adapters.vnf.BaseRestTestUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.boot.web.server.LocalServerPort;
-
-public class BpelRestClientTest extends BaseRestTestUtils {
-
-
- @LocalServerPort
- private int port;
- @Autowired
- @Qualifier("NetworkBpel")
- private Provider<BpelRestClient> clientProvider;
-
- @Test
- public void verifyPropertiesRead() {
- BpelRestClient client = clientProvider.get();
-
- assertEquals(5, client.getRetryCount());
- assertEquals(5, client.getConnectTimeout());
- assertEquals("test:test", client.getCredentials());
- assertEquals(5, client.getSocketTimeout());
- assertEquals("408, 429, 500, 502, 503, 504, 900", client.getRetryList());
- assertEquals(-15, client.getRetryInterval());
-
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java
index 20a3e62ade..4b2fa8138a 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java
@@ -35,7 +35,6 @@ public class BpelRestClientTest extends BaseRestTestUtils{
@LocalServerPort
private int port;
@Autowired
- @Qualifier("VnfBpel")
private Provider<BpelRestClient> clientProvider;
@Test
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java
index e74dd64bb3..5deec41d94 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java
@@ -5,6 +5,7 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,6 +34,8 @@ import javax.xml.ws.WebServiceFeature;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* This class was generated by Apache CXF 2.7.11.redhat-3
@@ -46,7 +49,7 @@ import org.onap.so.logger.MsoLogger;
targetNamespace = "http://org.onap/workflow/sdnc/adapter/wsdl/v1")
public class SDNCAdapterService extends Service {
- private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, SDNCAdapterService.class);
+ private static Logger logger = LoggerFactory.getLogger(SDNCAdapterService.class);
private static final String SDNC_ADAPTER_WSDL="SDNCAdapter.wsdl";
public static final URL WSDL_LOCATION;
@@ -58,16 +61,19 @@ public class SDNCAdapterService extends Service {
try {
wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("main/resources/SDNCAdapter.wsdl");
} catch (Exception e) {
- logger.error(MessageEnum.RA_WSDL_NOT_FOUND, SDNC_ADAPTER_WSDL, "", "", MsoLogger.ErrorCode.DataError, "Exception - WSDL not found", e);
+ logger.error("{} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL,
+ MsoLogger.ErrorCode.DataError.getValue(), "Exception - WSDL not found", e);
}
if(wsdlUrl == null) {
- logger.error(MessageEnum.RA_WSDL_NOT_FOUND, SDNC_ADAPTER_WSDL, "", "", MsoLogger.ErrorCode.DataError, "WSDL not found");
- } else {
+ logger.error("{} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL,
+ MsoLogger.ErrorCode.DataError.getValue(), "WSDL not found");
+ } else {
try {
- logger.info(MessageEnum.RA_PRINT_URL, SDNC_ADAPTER_WSDL, wsdlUrl.toURI().toString(), "");
+ logger.info("{} {} {}", MessageEnum.RA_PRINT_URL.toString(), SDNC_ADAPTER_WSDL, wsdlUrl.toURI().toString());
} catch (Exception e) {
- logger.error(MessageEnum.RA_WSDL_URL_CONVENTION_EXC, SDNC_ADAPTER_WSDL, "", "", MsoLogger.ErrorCode.DataError, "Exception - print URL", e);
- }
+ logger.error("{} {} {} {}", MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(), SDNC_ADAPTER_WSDL,
+ MsoLogger.ErrorCode.DataError.getValue(), "Exception - print URL", e);
+ }
}
WSDL_LOCATION = wsdlUrl;
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java
index 7ec20afffd..3dcd008ba5 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -33,6 +35,9 @@ import javax.xml.bind.annotation.XmlType;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* <p>Java class for anonymous complex type.
*
@@ -67,7 +72,7 @@ public class SDNCAdapterCallbackRequest {
@XmlElement(name = "RequestData")
protected Object requestData;
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, SDNCAdapterCallbackRequest.class);
+ private static Logger logger = LoggerFactory.getLogger(SDNCAdapterCallbackRequest.class);
/**
* Gets the value of the callbackHeader property.
@@ -130,8 +135,9 @@ public class SDNCAdapterCallbackRequest {
}
catch (Exception e)
{
- msoLogger.error(MessageEnum.RA_MARSHING_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception - MARSHING_ERROR", e);
- }
+ logger.error("{} {} {}", MessageEnum.RA_MARSHING_ERROR.toString(), MsoLogger.ErrorCode.DataError.getValue(),
+ "Exception - MARSHING_ERROR", e);
+ }
return "";
}
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java
index e4882090bf..fd288c6a04 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -31,6 +33,8 @@ import javax.xml.ws.WebServiceFeature;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* This class was generated by Apache CXF 2.7.11.redhat-3
@@ -44,7 +48,7 @@ import org.onap.so.logger.MsoLogger;
targetNamespace = "http://org.onap/workflow/sdnc/adapter/callback/wsdl/v1")
public class SDNCCallbackAdapterService extends Service {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, SDNCCallbackAdapterService.class);
+ private static Logger logger = LoggerFactory.getLogger(SDNCCallbackAdapterService.class);
private static final String SDNC_CALLBACK_ADAPTER_WSDL="SDNCCallbackAdapter.wsdl";
public static final URL WSDL_LOCATION;
public static final QName SERVICE = new QName("http://org.onap/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterService");
@@ -54,16 +58,20 @@ public class SDNCCallbackAdapterService extends Service {
try {
wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("main/resources/SDNCCallbackAdapter.wsdl");
} catch (Exception e) {
- msoLogger.error(MessageEnum.RA_WSDL_NOT_FOUND, SDNC_CALLBACK_ADAPTER_WSDL, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - WSDL not found", e);
+ logger.error("{} {} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL, "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), "Exception - WSDL not found", e);
}
if(wsdlUrl == null) {
- msoLogger.error(MessageEnum.RA_WSDL_NOT_FOUND, SDNC_CALLBACK_ADAPTER_WSDL, "SDNC", "", MsoLogger.ErrorCode.DataError, "WSDL not found");
- } else {
+ logger.error("{} {} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL, "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), "WSDL not found");
+ } else {
try {
- msoLogger.info(MessageEnum.RA_PRINT_URL, SDNC_CALLBACK_ADAPTER_WSDL, wsdlUrl.toURI().toString(), "SDNC");
- } catch (Exception e) {
- msoLogger.error(MessageEnum.RA_WSDL_URL_CONVENTION_EXC, SDNC_CALLBACK_ADAPTER_WSDL, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - URL convention problem", e);
- }
+ logger.info("{} {} {} {}", MessageEnum.RA_PRINT_URL.toString(), SDNC_CALLBACK_ADAPTER_WSDL,
+ wsdlUrl.toURI().toString(), "SDNC");
+ } catch (Exception e) {
+ logger.error("{} {} {} {} {}", MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(), SDNC_CALLBACK_ADAPTER_WSDL,
+ "SDNC", MsoLogger.ErrorCode.DataError.getValue(), "Exception - URL convention problem", e);
+ }
}
WSDL_LOCATION = wsdlUrl;
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java
index a5800fc73d..6262f2d86f 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java
@@ -5,6 +5,7 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +25,8 @@ package org.onap.so.adapters.sdnc.impl;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@@ -31,7 +34,7 @@ import org.springframework.stereotype.Component;
@Component
public class MapRequestTunables {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,MapRequestTunables.class);
+ private static Logger logger = LoggerFactory.getLogger(MapRequestTunables.class);
public static final String GENERATED_KEY = "Generated key: ";
@Autowired
@@ -44,14 +47,14 @@ public class MapRequestTunables {
String key;
if ("query".equals(reqTunable.getAction())) { //due to variable format for reqTunable.getOperation() eg services/layer3-service-list/8fe4ba4f-35cf-4d9b-a04a-fd3f5d4c5cc9
key = Constants.REQUEST_TUNABLES + "." + reqTunable.getMsoAction() + ".." + reqTunable.getAction();
- msoLogger.debug(GENERATED_KEY + key);
+ logger.debug(GENERATED_KEY + key);
}
else if ("put".equals(reqTunable.getAction()) || "restdelete".equals(reqTunable.getAction())) { //due to variable format for reqTunable.getOperation() eg services/layer3-service-list/8fe4ba4f-35cf-4d9b-a04a-fd3f5d4c5cc9
key = Constants.REQUEST_TUNABLES + "..." + reqTunable.getAction();
- msoLogger.debug(GENERATED_KEY + key);
+ logger.debug(GENERATED_KEY + key);
} else {
key = Constants.REQUEST_TUNABLES + "." + reqTunable.getMsoAction() + "." + reqTunable.getOperation() +"." + reqTunable.getAction();
- msoLogger.debug(GENERATED_KEY + key);
+ logger.debug(GENERATED_KEY + key);
}
String value;
@@ -61,31 +64,32 @@ public class MapRequestTunables {
String[] parts = value.split("\\|"); //escape pipe
if (parts.length < 3) {
- msoLogger.warn(MessageEnum.RA_SDNC_INVALID_CONFIG, key, value, "SDNC", "", MsoLogger.ErrorCode.DataError, "Invalid config");
+ logger.warn("{} {} {} {} {} {}", MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), key, value, "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), "Invalid config");
}
for (int i = 0; i < parts.length; i++) {
if (i == 0) {
reqTunable.setReqMethod(parts[i]) ;
- msoLogger.debug("Request Method is set to: " + reqTunable.getReqMethod());
+ logger.debug("Request Method is set to: {}", reqTunable.getReqMethod());
} else if (i == 1) {
reqTunable.setTimeout( parts[i]);
- msoLogger.debug("Timeout is set to: " + reqTunable.getTimeout());
+ logger.debug("Timeout is set to: {}", reqTunable.getTimeout());
} else if (i == 2) {
reqTunable.setSdncUrl(env.getProperty(Constants.REQUEST_TUNABLES + "." + parts[i],""));
if (reqTunable.getOperation() != null && reqTunable.getSdncUrl() != null) {
reqTunable.setSdncUrl(reqTunable.getSdncUrl() + reqTunable.getOperation());
}
- msoLogger.debug("SDNC Url is set to: " + reqTunable.getSdncUrl());
+ logger.debug("SDNC Url is set to: {}", reqTunable.getSdncUrl());
} else if (i == 3) {
reqTunable.setHeaderName(parts[i]);
- msoLogger.debug("HeaderName is set to: " + reqTunable.getHeaderName());
+ logger.debug("HeaderName is set to: {}", reqTunable.getHeaderName());
} else if (i == 4) {
reqTunable.setNamespace(parts[i]);
- msoLogger.debug("NameSpace is set to: " + reqTunable.getNamespace());
+ logger.debug("NameSpace is set to: {}", reqTunable.getNamespace());
} else if (i == 5) {
reqTunable.setAsyncInd(parts[i]);
- msoLogger.debug("AsyncInd is set to: " + reqTunable.getAsyncInd());
+ logger.debug("AsyncInd is set to: {}", reqTunable.getAsyncInd());
}
}
@@ -96,9 +100,10 @@ public class MapRequestTunables {
error = "Missing configuration for:" + key;
}
if (error != null) {
- msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, key, "SDNC", "", MsoLogger.ErrorCode.DataError, "Missing config param");
+ logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), key, "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), "Missing config param");
}
- msoLogger.debug ("RequestTunables Key:" + key + " Value:" + value + " Tunables:" + this.toString());
+ logger.debug("RequestTunables Key:{} Value:{} Tunables:{}", key, value, this.toString());
return reqTunable;
}
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
index 4a6ac9f5e2..cf81ae4be0 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -30,6 +32,8 @@ import org.onap.so.adapters.sdnc.SDNCAdapterResponse;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -40,7 +44,7 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCAdapterPortTypeImpl.class);
+ private static Logger logger = LoggerFactory.getLogger(SDNCAdapterPortTypeImpl.class);
@Autowired
@@ -48,7 +52,7 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType {
@PostConstruct
public void init () {
- msoLogger.info(MessageEnum.RA_INIT_SDNC_ADAPTER, "SDNC", "SDNCAdapterPortType", "");
+ logger.info("{} {} {}", MessageEnum.RA_INIT_SDNC_ADAPTER.toString(), "SDNC", "SDNCAdapterPortType");
}
/**
@@ -57,7 +61,7 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType {
@Override
public void healthCheck ()
{
- msoLogger.debug("Health check call in SDNC Adapter");
+ logger.debug("Health check call in SDNC Adapter");
}
@@ -70,7 +74,8 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType {
}
catch (Exception e){
String respMsg = "Error sending request to SDNC. Failed to start SDNC Client thread " + e.getMessage();
- msoLogger.error(MessageEnum.RA_SEND_REQUEST_SDNC_ERR, "SDNC", "", MsoLogger.ErrorCode.DataError, respMsg, e);
+ logger.error("{} {} {} {}", MessageEnum.RA_SEND_REQUEST_SDNC_ERR.toString(), "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), respMsg, e);
SDNCResponse sdncResp = new SDNCResponse(bpelReqId);
sdncResp.setRespCode(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
index 59884f25b8..d7f2c11d0b 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
@@ -55,6 +55,8 @@ import org.onap.so.adapters.sdnc.client.SDNCCallbackAdapterService;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.Async;
@@ -74,7 +76,7 @@ public class SDNCRestClient{
@Autowired
private MapRequestTunables tunablesMapper;
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCRestClient.class);
+ private static Logger logger = LoggerFactory.getLogger(SDNCRestClient.class);
private static final String EXCEPTION_MSG="Exception while evaluate xpath";
private static final String MSO_INTERNAL_ERROR="MsoInternalError";
@@ -83,7 +85,7 @@ public class SDNCRestClient{
public void executeRequest(SDNCAdapterRequest bpelRequest)
{
- msoLogger.debug("BPEL Request:" + bpelRequest.toString());
+ logger.debug("BPEL Request:" + bpelRequest.toString());
// Added delay to allow completion of create request to SDNC
// before executing activate of create request.
@@ -124,11 +126,9 @@ public class SDNCRestClient{
}
long sdncStartTime = System.currentTimeMillis();
SDNCResponse sdncResp = getSdncResp(sdncReqBody, rt);
- msoLogger.recordMetricEvent (sdncStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from SDNC", "SDNC", action + "." + operation, null);
- msoLogger.debug ("Got the SDNC Response: " + sdncResp.getSdncRespXml());
+ logger.debug ("Got the SDNC Response: {}", sdncResp.getSdncRespXml());
long bpelStartTime = System.currentTimeMillis();
sendRespToBpel(callbackUrl, sdncResp);
- msoLogger.recordMetricEvent (bpelStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully send reauest to BPEL", "BPMN", callbackUrl, null);
return;
}
@@ -142,8 +142,8 @@ public class SDNCRestClient{
SDNCResponse sdncResp = new SDNCResponse(rt.getReqId());
StringBuilder response = new StringBuilder();
- msoLogger.info(MessageEnum.RA_SEND_REQUEST_SDNC.name() + ":\n" + rt.toString(), "SDNC", "");
- msoLogger.trace("SDNC Request Body:\n" + sdncReqBody);
+ logger.info("{} :\n {} {}", MessageEnum.RA_SEND_REQUEST_SDNC.name(), rt.toString(), "SDNC");
+ logger.trace("SDNC Request Body:{} \n", sdncReqBody);
try {
@@ -186,12 +186,13 @@ public class SDNCRestClient{
}
sdncResp.setSdncRespXml(response.toString());
- msoLogger.info(MessageEnum.RA_RESPONSE_FROM_SDNC.name() + ":\n" + sdncResp.toString(), "SDNC", "");
+ logger.info("{} :\n {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.name(), sdncResp.toString(), "SDNC");
return(sdncResp);
}
catch (Exception e)
{
- msoLogger.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception processing request to SDNC", e);
+ logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception processing request to SDNC", e);
//default
sdncResp.setRespCode(HttpURLConnection.HTTP_INTERNAL_ERROR);
String respMsg = "Error processing request to SDNC. ";
@@ -231,7 +232,8 @@ public class SDNCRestClient{
eType = xpath.evaluate("error-type", error);
sdncErrMsg = new StringBuilder(". SDNC Returned-[error-type:" + eType);
} catch (Exception e3) {
- msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-type", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, EXCEPTION_MSG, e3);
+ logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-type",
+ error.toString(), "SDNC", MsoLogger.ErrorCode.DataError.getValue(), EXCEPTION_MSG, e3);
}
String eTag = null;
@@ -239,7 +241,8 @@ public class SDNCRestClient{
eTag = xpath.evaluate( "error-tag", error);
sdncErrMsg.append(", error-tag:").append(eTag);
} catch (Exception e3) {
- msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-tag", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, EXCEPTION_MSG, e3);
+ logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-tag",
+ error.toString(), "SDNC", MsoLogger.ErrorCode.DataError.getValue(), EXCEPTION_MSG, e3);
}
String eMsg = null;
@@ -247,15 +250,18 @@ public class SDNCRestClient{
eMsg = xpath.evaluate("error-message", error);
sdncErrMsg.append(", error-message:").append(eMsg).append("]");
} catch (Exception e3) {
- msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-message", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, EXCEPTION_MSG, e3);
+ logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-message", error.toString(),
+ "SDNC", MsoLogger.ErrorCode.DataError.getValue(), EXCEPTION_MSG, e3);
}
}
} catch (Exception e2) {
- msoLogger.error (MessageEnum.RA_ANALYZE_ERROR_EXC, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while analyse error", e2);
+ logger.error("{} {} {} {}", MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), "Exception while analyse error", e2);
}
} //is != null
} catch (Exception e1) {
- msoLogger.error (MessageEnum.RA_ERROR_GET_RESPONSE_SDNC, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception while get SDNC response", e1);
+ logger.error("{} {} {} {}", MessageEnum.RA_ERROR_GET_RESPONSE_SDNC.toString(), "SDNC",
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception while get SDNC response", e1);
}
} //con != null
@@ -266,7 +272,8 @@ public class SDNCRestClient{
sdncResp.setRespMsg(respMsg);
- msoLogger.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with SDNC", e);
+ logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
+ MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communicate with SDNC", e);
return sdncResp;
}
@@ -289,14 +296,15 @@ public class SDNCRestClient{
{
cbReq.setRequestData(sdncResp.getSdncRespXml());
}
- msoLogger.info(MessageEnum.RA_CALLBACK_BPEL.name() + ":\n" + cbReq.toString(), CAMUNDA, "");
+ logger.info("{} :\n {} {}", MessageEnum.RA_CALLBACK_BPEL.name(), cbReq.toString(), CAMUNDA);
URL wsdlUrl = null;
try {
wsdlUrl = new URL (bpelUrl);
} catch (MalformedURLException e1) {
error = "Caught exception initializing Callback wsdl " + e1.getMessage();
- msoLogger.error(MessageEnum.RA_INIT_CALLBACK_WSDL_ERR, CAMUNDA, "", MsoLogger.ErrorCode.DataError, "Exception initializing Callback wsdl", e1);
+ logger.error("{} {} {} {}", MessageEnum.RA_INIT_CALLBACK_WSDL_ERR.toString(), CAMUNDA,
+ MsoLogger.ErrorCode.DataError.getValue(), "Exception initializing Callback wsdl", e1);
}
@@ -310,7 +318,7 @@ public class SDNCRestClient{
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, wsdlUrl.toExternalForm());
}
else {
- msoLogger.debug("wsdlUrl is NULL:");
+ logger.debug("wsdlUrl is NULL:");
}
//authentication
@@ -326,22 +334,23 @@ public class SDNCRestClient{
}
catch (Exception e2) {
error = "Unable to set authorization in callback request " + e2.getMessage();
- msoLogger.error(MessageEnum.RA_SET_CALLBACK_AUTH_EXC, CAMUNDA, "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Unable to set authorization in callback request", e2);
+ logger.error("{} {} {} {}", MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ "Exception - Unable to set authorization in callback request", e2);
}
- msoLogger.debug("Invoking Bpel Callback. BpelCallbackUrl:" + bpelUrl);
+ logger.debug("Invoking Bpel Callback. BpelCallbackUrl:{}", bpelUrl);
cbPort.sdncAdapterCallback(cbReq);
}
catch (Exception e)
{
error = "Error sending BpelCallback request" + e.getMessage();
- msoLogger.error("Error " + MsoLogger.ErrorCode.BusinessProcesssError + " - " + MessageEnum.RA_CALLBACK_BPEL_EXC + " - " + error, e);
-
+ logger.error("Error {} - {} - {}", MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), error, e);
}
- msoLogger.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE.name(), CAMUNDA, "");
+ logger.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE.name(), CAMUNDA);
return;
}
-
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java
index 55af0d7cad..96e7dcf51a 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -33,13 +35,15 @@ import javax.xml.transform.stream.StreamResult;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class Utils {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, Utils.class);
+ private static Logger logger = LoggerFactory.getLogger(Utils.class);
private Utils() {
}
@@ -94,11 +98,12 @@ public class Utils {
}
String s = domToStr(newdoc);
- msoLogger.debug("Formatted SdncReq:\n" + s);
+ logger.debug("Formatted SdncReq:\n", s);
return s;
} catch (Exception e) {
- msoLogger.error(MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in genSdncReq", e);
+ logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in genSdncReq", e);
}
return null;
}
@@ -127,11 +132,12 @@ public class Utils {
}
String s = domToStr(newdoc);
- msoLogger.debug("Formatted SdncPutReq:\n" + s);
+ logger.debug("Formatted SdncPutReq:\n {}", s);
return s;
} catch (Exception e) {
- msoLogger.error(MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception in genSdncPutReq", e);
+ logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), "Exception in genSdncPutReq", e);
}
return null;
}
@@ -161,11 +167,12 @@ public class Utils {
root.appendChild(elem3);
String s = domToStr(newdoc);
- msoLogger.debug("Formatted SdncReq:" + s);
+ logger.debug("Formatted SdncReq: {}", s);
return s;
} catch (Exception e) {
- msoLogger.error(MessageEnum.RA_ERROR_CREATE_SDNC_RESPONSE, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception in genMsoFailResp", e);
+ logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_RESPONSE.toString(), "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), "Exception in genMsoFailResp", e);
}
return null;
}
@@ -191,7 +198,8 @@ public class Utils {
s = s.replaceAll("xmlns=\"\"", "");
return s;
} catch (Exception e) {
- msoLogger.error(MessageEnum.RA_ERROR_CONVERT_XML2STR, "", "", MsoLogger.ErrorCode.DataError, "Exception - domToStr", e);
+ logger.error("{} {} {}", MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(), MsoLogger.ErrorCode.DataError
+ .getValue(), "Exception - domToStr", e);
}
}
return null;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
index e427423763..6a66770d29 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
@@ -6,6 +6,7 @@
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,6 +39,8 @@ import org.onap.so.adapters.sdnc.impl.Constants;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.onap.so.utils.CryptoUtils;
@@ -49,7 +52,7 @@ import org.springframework.core.env.Environment;
*/
@Component
public class BPRestCallback {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,BPRestCallback.class);
+ private static final Logger logger = LoggerFactory.getLogger(BPRestCallback.class);
private static final String CAMUNDA="Camunda";
private static final String MSO_INTERNAL_ERROR="MsoInternalError";
@@ -66,7 +69,7 @@ public class BPRestCallback {
* @return true if the message was consumed successfully by the endpoint
*/
public boolean send(String workflowMessageUrl, String messageType, String correlator, String message) {
- LOGGER.debug(getClass().getSimpleName() + ".send("
+ logger.debug(getClass().getSimpleName() + ".send("
+ "workflowMessageUrl=" + workflowMessageUrl
+ " messageType=" + messageType
+ " correlator=" + correlator
@@ -91,12 +94,13 @@ public class BPRestCallback {
* @return true if the message was consumed successfully by the endpoint
*/
public boolean send(String url, String message) {
- LOGGER.debug(getClass().getSimpleName() + ".send("
+ logger.debug(getClass().getSimpleName() + ".send("
+ "url=" + url
+ " message=" + message
+ ")");
- LOGGER.info(MessageEnum.RA_CALLBACK_BPEL, message == null ? "[no content]" : message, CAMUNDA, "");
+ logger.info("{} {} {}", MessageEnum.RA_CALLBACK_BPEL.toString(), message == null ? "[no content]" : message,
+ CAMUNDA);
HttpPost method = null;
HttpResponse httpResponse = null;
@@ -129,8 +133,8 @@ public class BPRestCallback {
method.setHeader(ONAPLogConstants.Headers.INVOCATION_ID,MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID));
method.setHeader(ONAPLogConstants.Headers.PARTNER_NAME,"SO-SDNCAdapter");
} catch (Exception e) {
- LOGGER.error(MessageEnum.RA_SET_CALLBACK_AUTH_EXC, CAMUNDA, "", MsoLogger.ErrorCode.BusinessProcesssError,
- "Unable to set authorization in callback request", e);
+ logger.error("{} {} {} {}", MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Unable to set authorization in callback request", e);
error = true;
}
@@ -146,14 +150,15 @@ public class BPRestCallback {
if (httpResponse.getStatusLine().getStatusCode() >= 300) {
String msg = "Received error response to callback request: " + httpResponse.getStatusLine();
- LOGGER.error(MessageEnum.RA_CALLBACK_BPEL_EXC, CAMUNDA, "", MsoLogger.ErrorCode.BusinessProcesssError, msg);
+ logger.error("{} {} {} {}", MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA, MsoLogger.ErrorCode
+ .BusinessProcesssError.getValue(), msg);
}
}
return true;
} catch (Exception e) {
- LOGGER.error(MessageEnum.RA_CALLBACK_BPEL_EXC, CAMUNDA, "", MsoLogger.ErrorCode.BusinessProcesssError,
- "Error sending callback request", e);
+ logger.error("{} {} {} {}", MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Error sending callback request", e);
return false;
} finally {
if (httpResponse != null) {
@@ -161,7 +166,7 @@ public class BPRestCallback {
EntityUtils.consume(httpResponse.getEntity());
httpResponse = null;
} catch (Exception e) {
- LOGGER.debug("Exception:", e);
+ logger.debug("Exception:", e);
}
}
@@ -169,10 +174,10 @@ public class BPRestCallback {
try {
method.reset();
} catch (Exception e) {
- LOGGER.debug("Exception:", e);
+ logger.debug("Exception:", e);
}
}
- LOGGER.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE, CAMUNDA, "","");
+ logger.info("{} {}", MessageEnum.RA_CALLBACK_BPEL_COMPLETE.toString(), CAMUNDA);
}
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
index 6f40ba07a9..fd9ce4c719 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
@@ -5,6 +5,7 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +28,8 @@ import org.onap.so.adapters.sdnc.impl.Constants;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@@ -34,9 +37,7 @@ import org.springframework.stereotype.Component;
@Component
public class MapTypedRequestTunablesData {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,MapTypedRequestTunablesData.class);
-
-
+ private static Logger logger = LoggerFactory.getLogger(MapTypedRequestTunablesData.class);
private static final String MISSING_CONFIGURATION_ERROR_MSG= "Missing configuration for: ";
private static final String MISSING_CONFIG_PARAM_ERROR_MSG="Missing config param";
@@ -54,7 +55,8 @@ public class MapTypedRequestTunablesData {
if ("".equals(value)) {
error= MISSING_CONFIGURATION_ERROR_MSG + reqTunable.getKey();
- msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, reqTunable.getKey(), "SDNC", "", MsoLogger.ErrorCode.DataError, MISSING_CONFIG_PARAM_ERROR_MSG);
+ logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), reqTunable.getKey(), "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG);
throw new SDNCAdapterException(error);
}
@@ -63,41 +65,42 @@ public class MapTypedRequestTunablesData {
if (parts.length != 5) {
error="Invalid configuration for: " + reqTunable.getKey();
- msoLogger.error(MessageEnum.RA_SDNC_INVALID_CONFIG, reqTunable.getKey(), value, "SDNC", "", MsoLogger.ErrorCode.DataError, "Invalid config");
-
+ logger.error("{} {} {} {} {} {}", MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), reqTunable.getKey(), value, "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), "Invalid config");
throw new SDNCAdapterException(error);
}
reqTunable.setReqMethod(parts[0]);
- msoLogger.trace("Request Method is set to: " + reqTunable.getReqMethod());
+ logger.trace("Request Method is set to: {}", reqTunable.getReqMethod());
reqTunable.setTimeout(parts[1]);
- msoLogger.trace("Timeout is set to: " + reqTunable.getTimeout());
+ logger.trace("Timeout is set to: {}", reqTunable.getTimeout());
String urlPropKey = Constants.REQUEST_TUNABLES + "." + parts[2];
reqTunable.setSdncUrl(env.getProperty(urlPropKey, ""));
if ("".equals(reqTunable.getSdncUrl())) {
error=MISSING_CONFIGURATION_ERROR_MSG + urlPropKey;
- msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, urlPropKey, "SDNC", "", MsoLogger.ErrorCode.DataError, MISSING_CONFIG_PARAM_ERROR_MSG);
+ logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), urlPropKey, "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG);
throw new SDNCAdapterException(error);
}
- msoLogger.trace("SDNC Url is set to: " + reqTunable.getSdncUrl());
+ logger.trace("SDNC Url is set to: {}", reqTunable.getSdncUrl());
reqTunable.setHeaderName(parts[3]);
- msoLogger.trace("Header Name is set to: " + reqTunable.getHeaderName());
+ logger.trace("Header Name is set to: {}", reqTunable.getHeaderName());
reqTunable.setNamespace(parts[4]);
- msoLogger.trace("Namespace is set to: " + reqTunable.getNamespace());
+ logger.trace("Namespace is set to: {}", reqTunable.getNamespace());
reqTunable.setMyUrl(env.getProperty(Constants.MY_URL_PROP, ""));
if ("".equals(reqTunable.getMyUrl())) {
error=MISSING_CONFIGURATION_ERROR_MSG + Constants.MY_URL_PROP;
- msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.MY_URL_PROP, "SDNC", "",
- MsoLogger.ErrorCode.DataError, MISSING_CONFIG_PARAM_ERROR_MSG);
+ logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), Constants.MY_URL_PROP, "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG);
throw new SDNCAdapterException(error);
}
@@ -108,7 +111,7 @@ public class MapTypedRequestTunablesData {
reqTunable.setMyUrl(reqTunable.getMyUrl().concat(reqTunable.getMyUrlSuffix()));
- msoLogger.debug(reqTunable.toString());
+ logger.debug(reqTunable.toString());
return reqTunable;
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCAdapterUtils.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCAdapterUtils.java
index dcb1fdae8c..8cafbda325 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCAdapterUtils.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCAdapterUtils.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -21,11 +23,11 @@
package org.onap.so.adapters.sdnc.sdncrest;
-import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.web.util.UriUtils;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -35,7 +37,7 @@ import org.w3c.dom.NodeList;
* Utility methods used by SDNCAdapterRest.
*/
public final class SDNCAdapterUtils {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, SDNCAdapterUtils.class);
+ private static final Logger logger = LoggerFactory.getLogger(SDNCAdapterUtils.class);
/**
* Instantiation is not allowed.
*/
@@ -67,4 +69,4 @@ public final class SDNCAdapterUtils {
public static String encodeURLPathSegment(String pathSegment) {
return UriUtils.encodePathSegment(pathSegment, "UTF-8");
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
index 3ecf6337cf..06e7ab23a6 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
@@ -6,6 +6,7 @@
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,6 +55,8 @@ import org.onap.so.adapters.sdncrest.SDNCResponseCommon;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.w3c.dom.Document;
@@ -68,7 +71,7 @@ import org.springframework.core.env.Environment;
*/
@Component
public abstract class SDNCConnector {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCConnector.class);
+ private static final Logger logger = LoggerFactory.getLogger(SDNCConnector.class);
private static final String MSO_INTERNAL_ERROR="MsoInternalError";
private static final String XPATH_EXCEPTION="XPath Exception";
@@ -76,8 +79,8 @@ public abstract class SDNCConnector {
private Environment env;
public SDNCResponseCommon send(String content, TypedRequestTunables rt) {
- LOGGER.debug("SDNC URL: " + rt.getSdncUrl());
- LOGGER.debug("SDNC Request Body:\n" + content);
+ logger.debug("SDNC URL: {}", rt.getSdncUrl());
+ logger.debug("SDNC Request Body:\n {}", content);
HttpRequestBase method = null;
HttpResponse httpResponse = null;
@@ -122,7 +125,7 @@ public abstract class SDNCConnector {
method.setHeader("Accept", "application/yang.data+xml");
}
else {
- LOGGER.debug("method is NULL:");
+ logger.debug("method is NULL:");
}
@@ -137,8 +140,8 @@ public abstract class SDNCConnector {
int statusCode = httpResponse.getStatusLine().getStatusCode();
String statusMessage = httpResponse.getStatusLine().getReasonPhrase();
- LOGGER.debug("SDNC Response: " + statusCode + " " + statusMessage
- + (responseContent == null ? "" : System.lineSeparator() + responseContent));
+ logger.debug("SDNC Response: {} {}", statusCode,
+ statusMessage + (responseContent == null ? "" : System.lineSeparator() + responseContent));
if (httpResponse.getStatusLine().getStatusCode() >= 300) {
String errMsg = "SDNC returned " + statusCode + " " + statusMessage;
@@ -159,12 +162,12 @@ public abstract class SDNCConnector {
method.reset();
}
else {
- LOGGER.debug("method is NULL:");
+ logger.debug("method is NULL:");
}
method = null;
- LOGGER.info(MessageEnum.RA_RESPONSE_FROM_SDNC, responseContent, "SDNC", "");
+ logger.info("{} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), responseContent, "SDNC");
return createResponseFromContent(statusCode, statusMessage, responseContent, rt);
} catch (SocketTimeoutException | ConnectTimeoutException e) {
@@ -182,7 +185,7 @@ public abstract class SDNCConnector {
try {
EntityUtils.consume(httpResponse.getEntity());
} catch (Exception e) {
- LOGGER.debug("Exception:", e);
+ logger.debug("Exception:", e);
}
}
@@ -190,22 +193,20 @@ public abstract class SDNCConnector {
try {
method.reset();
} catch (Exception e) {
- LOGGER.debug("Exception:", e);
+ logger.debug("Exception:", e);
}
}
}
}
protected void logError(String errMsg) {
- LOGGER.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "",
- MsoLogger.ErrorCode.AvailabilityError, errMsg);
-
+ logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
+ MsoLogger.ErrorCode.AvailabilityError.getValue(), errMsg);
}
protected void logError(String errMsg, Throwable t) {
- LOGGER.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "",
- MsoLogger.ErrorCode.AvailabilityError, errMsg, t);
-
+ logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
+ MsoLogger.ErrorCode.AvailabilityError.getValue(), errMsg, t);
}
/**
@@ -288,8 +289,8 @@ public abstract class SDNCConnector {
String errorType = xpath.evaluate("error-type", error);
info += "error-type:" + errorType;
} catch (XPathExpressionException e) {
- LOGGER.error(MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-type", error.toString(), "SDNC", "",
- MsoLogger.ErrorCode.DataError, XPATH_EXCEPTION, e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-type", error.toString(),
+ "SDNC", MsoLogger.ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
}
try {
@@ -299,8 +300,8 @@ public abstract class SDNCConnector {
}
info += "error-tag:" + errorTag;
} catch (XPathExpressionException e) {
- LOGGER.error(MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-tag", error.toString(), "SDNC", "",
- MsoLogger.ErrorCode.DataError, XPATH_EXCEPTION, e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-tag", error.toString(),
+ "SDNC", MsoLogger.ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
}
try {
@@ -310,8 +311,8 @@ public abstract class SDNCConnector {
}
info += "error-message:" + errorMessage;
} catch (Exception e) {
- LOGGER.error(MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-message", error.toString(), "SDNC", "",
- MsoLogger.ErrorCode.DataError, XPATH_EXCEPTION, e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-message",
+ error.toString(), "SDNC", MsoLogger.ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
}
if (!info.isEmpty()) {
@@ -323,8 +324,8 @@ public abstract class SDNCConnector {
}
}
} catch (Exception e) {
- LOGGER.error (MessageEnum.RA_ANALYZE_ERROR_EXC, "SDNC", "",
- MsoLogger.ErrorCode.DataError, "Exception while analyzing errors", e);
+ logger.error("{} {} {} {}", MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC",
+ MsoLogger.ErrorCode.DataError.getValue(), "Exception while analyzing errors", e);
}
return output.toString();
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java
index 8ca14501e5..57051e570e 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java
@@ -6,6 +6,7 @@
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,7 +39,8 @@ import org.onap.so.adapters.sdncrest.SDNCErrorCommon;
import org.onap.so.adapters.sdncrest.SDNCResponseCommon;
import org.onap.so.adapters.sdncrest.SDNCServiceError;
import org.onap.so.adapters.sdncrest.SDNCServiceResponse;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -52,17 +54,17 @@ import org.xml.sax.SAXException;
@Component
public class SDNCServiceRequestConnector extends SDNCConnector {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,SDNCServiceRequestConnector.class);
+ private static final Logger logger = LoggerFactory.getLogger(SDNCServiceRequestConnector.class);
@Override
protected SDNCResponseCommon createResponseFromContent(int statusCode, String statusMessage,
String responseContent, TypedRequestTunables rt) {
try {
return parseResponseContent(responseContent);
} catch (ParseException e) {
- LOGGER.error(e);
+ logger.error("Error occured:", e);
return createErrorResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, e.getMessage(), rt);
}catch (Exception e) {
- LOGGER.error(e);
+ logger.error("Error occured:", e);
return createErrorResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, e.getMessage(), rt);
}
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
index deb39ac54e..62233273b1 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -34,12 +36,13 @@ import javax.xml.transform.stream.StreamResult;
import org.apache.http.HttpStatus;
import org.onap.so.adapters.sdnc.exception.SDNCAdapterException;
import org.onap.so.adapters.sdncrest.RequestInformation;
-import org.onap.so.adapters.sdncrest.SDNCErrorCommon;
import org.onap.so.adapters.sdncrest.SDNCResponseCommon;
import org.onap.so.adapters.sdncrest.SDNCServiceError;
import org.onap.so.adapters.sdncrest.SDNCServiceRequest;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
@@ -48,7 +51,7 @@ import org.w3c.dom.Element;
@Component
public class SDNCServiceRequestTask {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCServiceRequestTask.class);
+ private static final Logger logger = LoggerFactory.getLogger(SDNCServiceRequestTask.class);
@Autowired
private SDNCServiceRequestConnector connector;
@@ -91,24 +94,8 @@ public class SDNCServiceRequestTask {
long sdncStartTime = System.currentTimeMillis();
SDNCResponseCommon response = connector.send(xml, mappedTunables);
- if (response instanceof SDNCErrorCommon) {
- LOGGER.recordMetricEvent(sdncStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Received success response from SDNC", "SDNC", sdncService + "." + sdncOperation, null);
- } else {
- LOGGER.recordMetricEvent(sdncStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
- "Received error response from SDNC", "SDNC", sdncService + "." + sdncOperation, null);
- }
-
long bpStartTime = System.currentTimeMillis();
boolean callbackSuccess = bpRestCallback.send(request.getBPNotificationUrl(), response.toJson());
-
- if (callbackSuccess) {
- LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Sent notification", "BPMN", request.getBPNotificationUrl(), null);
- } else {
- LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
- "Failed to send notification", "BPMN", request.getBPNotificationUrl(), null);
- }
}
private Element addChild(Element parent, String tag) {
@@ -206,8 +193,8 @@ public class SDNCServiceRequestTask {
addTextChild(agnosticServiceInformation, "content-type", contentType);
addTextChild(agnosticServiceInformation, "anydata", anydata);
} catch (Exception e) {
- LOGGER.error(MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST, "SDNC", "",
- MsoLogger.ErrorCode.BusinessProcesssError, "Exception in genSdncReq", e);
+ logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in genSdncReq", e);
return null;
}
@@ -225,12 +212,12 @@ public class SDNCServiceRequestTask {
transformer.transform(new DOMSource(doc), new StreamResult(writer));
xml = writer.toString();
} catch (Exception e) {
- LOGGER.error(MessageEnum.RA_ERROR_CONVERT_XML2STR, "", "",
- MsoLogger.ErrorCode.DataError, "Exception - domToStr", e);
+ logger.error("{} {} {}", MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(), MsoLogger.ErrorCode.DataError.getValue(),
+ "Exception - domToStr", e);
return null;
}
- LOGGER.trace("Formatted SDNC service request XML:\n" + xml);
+ logger.trace("Formatted SDNC service request XML:\n {}", xml);
return xml;
}
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
index 48bc2d84bb..75a0b07643 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
@@ -5,6 +5,7 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,6 +36,8 @@ import org.onap.so.adapters.sdnc.impl.Constants;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@@ -47,7 +50,7 @@ import org.springframework.stereotype.Component;
@Path("/")
@Component
public class SNIROResponse {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SNIROResponse.class);
+ private static final Logger logger = LoggerFactory.getLogger(SNIROResponse.class);
@Autowired
@@ -61,34 +64,18 @@ public class SNIROResponse {
@Consumes("*/*")
@Produces({MediaType.TEXT_PLAIN})
public Response serviceNotification(@PathParam("correlator") String correlator, String content) {
- LOGGER.info(MessageEnum.RA_RECEIVE_SDNC_NOTIF, content, "SDNC", "SDNCNotify/SNIROResponse");
-
- long startTime = System.currentTimeMillis();
+ logger.info("{} {} {} {}", MessageEnum.RA_RECEIVE_SDNC_NOTIF.toString(), content, "SDNC",
+ "SDNCNotify/SNIROResponse");
String bpUrl = env.getProperty(Constants.BPEL_REST_URL_PROP, "");
if (bpUrl == null || ("").equals(bpUrl)) {
String error = "Missing configuration for: " + Constants.BPEL_REST_URL_PROP;
- LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.BPEL_REST_URL_PROP, "SDNC", "",
- MsoLogger.ErrorCode.DataError, "Missing config param");
+ logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), Constants.BPEL_REST_URL_PROP,
+ "SDNC", MsoLogger.ErrorCode.DataError.getValue(), "Missing config param");
return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(error).build();
}
-
- long bpStartTime = System.currentTimeMillis();
- boolean callbackSuccess = callback.send(bpUrl, "SNIROResponse", correlator, content);
-
- if (callbackSuccess) {
- LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Sent notification", "BPMN", bpUrl, null);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
- } else {
- LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
- "Failed to send notification", "BPMN", bpUrl, null);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
- "Failed to send notification");
- }
-
return Response.status(204).build();
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/TypedRequestTunables.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/TypedRequestTunables.java
index 6331d6aaae..4ff6dbc9a6 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/TypedRequestTunables.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/TypedRequestTunables.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -22,7 +24,8 @@ package org.onap.so.adapters.sdnc.sdncrest;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.onap.so.adapters.sdnc.impl.Constants;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Typed Request Tunables. Each entry is identified by a TYPE in the property name.
@@ -39,7 +42,7 @@ import org.onap.so.logger.MsoLogger;
*/
public class TypedRequestTunables {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, TypedRequestTunables.class);
+ private static final Logger logger = LoggerFactory.getLogger(TypedRequestTunables.class);
private String reqId;
private String myUrlSuffix;
@@ -82,7 +85,7 @@ public class TypedRequestTunables {
*/
public void setServiceKey(String service, String operation) {
key = Constants.REQUEST_TUNABLES + ".service." + service + "." + operation;
- LOGGER.debug("Generated " + getClass().getSimpleName() + " key: " + key);
+ logger.debug("Generated {} key: {}", getClass().getSimpleName(), key);
}
/**
diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/FileUtil.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/FileUtil.java
index f2fba5900f..d72775399f 100644
--- a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/FileUtil.java
+++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/FileUtil.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -20,7 +22,8 @@
package org.onap.so.adapters.sdnc;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.InputStream;
@@ -30,7 +33,7 @@ import java.io.InputStream;
*/
public class FileUtil {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, FileUtil.class);
+ private static final Logger logger = LoggerFactory.getLogger(FileUtil.class);
/**
* Read the specified resource file and return the contents as a String.
@@ -53,7 +56,7 @@ public class FileUtil {
return "";
}
} catch (IOException e) {
- LOGGER.debug("Exception:", e);
+ logger.debug("Exception:", e);
return "";
}
}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NSResourceInputParameter.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NSResourceInputParameter.java
index ce5637baa3..5d9b7ce558 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NSResourceInputParameter.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NSResourceInputParameter.java
@@ -4,6 +4,7 @@
* ================================================================================
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (C) 2018 CMCC All rights reserved.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,10 +27,10 @@ import java.io.ByteArrayOutputStream;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
-import org.onap.so.logger.MsoLogger;
-
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* NS Create Input Parameter For VFC Adapter<br>
@@ -40,7 +41,7 @@ import com.fasterxml.jackson.databind.SerializationFeature;
*/
public class NSResourceInputParameter {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, NSResourceInputParameter.class);
+ private static final Logger logger = LoggerFactory.getLogger(NSResourceInputParameter.class);
private NsOperationKey nsOperationKey;
@@ -114,7 +115,7 @@ public class NSResourceInputParameter {
mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
jsonString = mapper.writeValueAsString(this);
} catch (Exception e) {
- LOGGER.debug("Exception:", e);
+ logger.debug("Exception:", e);
}
return jsonString;
}
@@ -128,7 +129,7 @@ public class NSResourceInputParameter {
marshaller.marshal(this, bs);
return bs.toString();
} catch (Exception e) {
- LOGGER.debug("Exception:", e);
+ logger.debug("Exception:", e);
return "";
}
}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java
index c39a165338..52fd8fb103 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -27,8 +29,8 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
-import org.onap.so.logger.MsoLogger;
-import org.onap.so.utils.UUIDChecker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
@@ -44,7 +46,7 @@ import org.springframework.stereotype.Component;
@Component
public class HealthCheckHandler {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, HealthCheckHandler.class);
+ private static Logger logger = LoggerFactory.getLogger(HealthCheckHandler.class);
private static final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Health Check</title></head><body>Application ready</body></html>";
@@ -57,8 +59,6 @@ public class HealthCheckHandler {
@Path("/healthcheck")
@Produces("text/html")
public Response healthcheck(@QueryParam("requestId") String requestId) {
- MsoLogger.setServiceName("Healthcheck");
- UUIDChecker.verifyOldUUID(requestId, msoLogger);
return HEALTH_CHECK_RESPONSE;
}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java
index 0f0a14c8f5..db613ea988 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java
@@ -5,6 +5,7 @@
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +37,8 @@ import org.onap.so.adapters.vfc.model.NsOperationKey;
import org.onap.so.adapters.vfc.model.RestfulResponse;
import org.onap.so.adapters.vfc.util.JsonUtil;
import org.onap.so.adapters.vfc.util.ValidateUtil;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -52,7 +54,7 @@ import org.springframework.stereotype.Component;
@Path("/v1/vfcadapter")
public class VfcAdapterRest {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, VfcAdapterRest.class);
+ private static final Logger logger = LoggerFactory.getLogger(VfcAdapterRest.class);
private static final String REQUEST_DEBUG_MSG="body from request is {}";
private static final String APPLICATION_EXCEPTION="ApplicationException: ";
@Autowired
@@ -76,12 +78,12 @@ public class VfcAdapterRest {
public Response createNfvoNs(String data) {
try {
ValidateUtil.assertObjectNotNull(data);
- LOGGER.debug(REQUEST_DEBUG_MSG + data);
+ logger.debug(REQUEST_DEBUG_MSG + data);
NSResourceInputParameter nsInput = JsonUtil.unMarshal(data, NSResourceInputParameter.class);
RestfulResponse rsp = driverMgr.createNs(nsInput);
return buildResponse(rsp);
} catch(ApplicationException e) {
- LOGGER.debug(APPLICATION_EXCEPTION, e);
+ logger.debug(APPLICATION_EXCEPTION, e);
return e.buildErrorResponse();
}
}
@@ -102,12 +104,12 @@ public class VfcAdapterRest {
try {
ValidateUtil.assertObjectNotNull(data);
- LOGGER.debug(REQUEST_DEBUG_MSG + data);
+ logger.debug(REQUEST_DEBUG_MSG + data);
NsOperationKey nsOperationKey = JsonUtil.unMarshal(data, NsOperationKey.class);
RestfulResponse rsp = driverMgr.deleteNs(nsOperationKey, nsInstanceId);
return buildResponse(rsp);
} catch(ApplicationException e) {
- LOGGER.debug(APPLICATION_EXCEPTION, e);
+ logger.debug(APPLICATION_EXCEPTION, e);
return e.buildErrorResponse();
}
}
@@ -127,12 +129,12 @@ public class VfcAdapterRest {
public Response queryNfvoJobStatus(String data, @PathParam("jobId") String jobId) {
try {
ValidateUtil.assertObjectNotNull(data);
- LOGGER.debug(REQUEST_DEBUG_MSG + data);
+ logger.debug(REQUEST_DEBUG_MSG + data);
NsOperationKey nsOperationKey = JsonUtil.unMarshal(data, NsOperationKey.class);
RestfulResponse rsp = driverMgr.getNsProgress(nsOperationKey, jobId);
return buildResponse(rsp);
} catch(ApplicationException e) {
- LOGGER.debug(APPLICATION_EXCEPTION, e);
+ logger.debug(APPLICATION_EXCEPTION, e);
return e.buildErrorResponse();
}
}
@@ -152,12 +154,12 @@ public class VfcAdapterRest {
public Response instantiateNfvoNs(String data, @PathParam("nsInstanceId") String nsInstanceId) {
try {
ValidateUtil.assertObjectNotNull(data);
- LOGGER.debug(REQUEST_DEBUG_MSG + data);
+ logger.debug(REQUEST_DEBUG_MSG + data);
NSResourceInputParameter nsInput = JsonUtil.unMarshal(data, NSResourceInputParameter.class);
RestfulResponse rsp = driverMgr.instantiateNs(nsInstanceId, nsInput);
return buildResponse(rsp);
} catch(ApplicationException e) {
- LOGGER.debug(APPLICATION_EXCEPTION, e);
+ logger.debug(APPLICATION_EXCEPTION, e);
return e.buildErrorResponse();
}
}
@@ -177,12 +179,12 @@ public class VfcAdapterRest {
public Response terminateNfvoNs(String data, @PathParam("nsInstanceId") String nsInstanceId) {
try {
ValidateUtil.assertObjectNotNull(data);
- LOGGER.debug(REQUEST_DEBUG_MSG + data);
+ logger.debug(REQUEST_DEBUG_MSG + data);
NsOperationKey nsOperationKey = JsonUtil.unMarshal(data, NsOperationKey.class);
RestfulResponse rsp = driverMgr.terminateNs(nsOperationKey, nsInstanceId);
return buildResponse(rsp);
} catch(ApplicationException e) {
- LOGGER.debug(APPLICATION_EXCEPTION, e);
+ logger.debug(APPLICATION_EXCEPTION, e);
return e.buildErrorResponse();
}
}
@@ -201,16 +203,16 @@ public class VfcAdapterRest {
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Response scaleNfvoNs(String data, @PathParam("nsInstanceId") String nsInstanceId) {
- try {
- ValidateUtil.assertObjectNotNull(data);
- LOGGER.debug("Scale Ns Request Received.Body from request is {}" + data);
- NSResourceInputParameter nsInput = JsonUtil.unMarshal(data, NSResourceInputParameter.class);
- RestfulResponse rsp = driverMgr.scaleNs(nsInstanceId, nsInput);
- return buildResponse(rsp);
- } catch(ApplicationException e) {
- LOGGER.debug(APPLICATION_EXCEPTION, e);
- return e.buildErrorResponse();
- }
+ try {
+ ValidateUtil.assertObjectNotNull(data);
+ logger.debug("Scale Ns Request Received.Body from request is {}" + data);
+ NSResourceInputParameter nsInput = JsonUtil.unMarshal(data, NSResourceInputParameter.class);
+ RestfulResponse rsp = driverMgr.scaleNs(nsInstanceId, nsInput);
+ return buildResponse(rsp);
+ } catch (ApplicationException e) {
+ logger.debug(APPLICATION_EXCEPTION, e);
+ return e.buildErrorResponse();
+ }
}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java
index 64032e25f5..66ed6953a2 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java
@@ -5,6 +5,7 @@
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,6 +34,8 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Interface for json analyzing.<br/>
@@ -47,7 +50,7 @@ public class JsonUtil {
/**
* Log service
*/
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, JsonUtil.class);
+ private static final Logger logger = LoggerFactory.getLogger(JsonUtil.class);
/**
* Mapper.
@@ -83,7 +86,7 @@ public class JsonUtil {
try {
return MAPPER.readValue(jsonstr, type);
} catch (IOException e) {
- LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError,
+ logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
UNMARSHAL_FAIL_MSG, e);
throw new ApplicationException(HttpCode.BAD_REQUEST, UNMARSHAL_FAIL_MSG);
}
@@ -101,7 +104,7 @@ public class JsonUtil {
try {
return MAPPER.readValue(jsonstr, type);
} catch (IOException e) {
- LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError,
+ logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
UNMARSHAL_FAIL_MSG, e);
throw new ApplicationException(HttpCode.BAD_REQUEST, UNMARSHAL_FAIL_MSG);
}
@@ -118,7 +121,7 @@ public class JsonUtil {
try {
return MAPPER.writeValueAsString(srcObj);
} catch (IOException e) {
- LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError,
+ logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
"fail to marshal json", e);
throw new ApplicationException(HttpCode.BAD_REQUEST, "srcObj marshal failed!");
}
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 bb7fa70bda..9a23861bf6 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
@@ -6,6 +6,7 @@
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,6 +45,8 @@ 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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@@ -63,7 +66,7 @@ public class RestfulUtil {
/**
* Log service
*/
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, RestfulUtil.class);
+ private static final Logger logger = LoggerFactory.getLogger(RestfulUtil.class);
private static final int DEFAULT_TIME_OUT = 60000;
@@ -88,7 +91,7 @@ public class RestfulUtil {
Integer msbPort = env.getProperty("mso.msb-port", Integer.class, DEFAULT_MSB_PORT);
String msbEndpoint = UriBuilder.fromPath("").host(msbIp).port(msbPort).scheme("http").build().toString();
- LOGGER.debug("msbEndpoint in vfc adapter: " + msbEndpoint);
+ logger.debug("msbEndpoint in vfc adapter: {}", msbEndpoint);
return msbEndpoint;
}
@@ -99,7 +102,7 @@ public class RestfulUtil {
public RestfulResponse send(String url, String methodType, String content) {
String msbUrl = getMsbHost() + url;
- LOGGER.debug("Begin to sent message " + methodType +": " + msbUrl);
+ logger.debug("Begin to sent message {}: {}", methodType, msbUrl);
HttpRequestBase method = null;
HttpResponse httpResponse = null;
@@ -132,14 +135,6 @@ public class RestfulUtil {
method = httpDelete;
}
- // now VFC have no auth
- // String userCredentials =
- // SDNCAdapterProperties.getEncryptedProperty(Constants.SDNC_AUTH_PROP,
- // Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY);
- // String authorization = "Basic " +
- // DatatypeConverter.printBase64Binary(userCredentials.getBytes());
- // method.setHeader("Authorization", authorization);
-
httpResponse = client.execute(method);
String responseContent = null;
@@ -150,7 +145,7 @@ public class RestfulUtil {
int statusCode = httpResponse.getStatusLine().getStatusCode();
String statusMessage = httpResponse.getStatusLine().getReasonPhrase();
- LOGGER.debug("VFC Response: " + statusCode + " " + statusMessage
+ logger.debug("VFC Response: {} {}", statusCode, statusMessage
+ (responseContent == null ? "" : System.lineSeparator() + responseContent));
if(httpResponse.getStatusLine().getStatusCode() >= 300) {
@@ -164,7 +159,7 @@ public class RestfulUtil {
if(null != method) {
method.reset();
} else {
- LOGGER.debug("method is NULL:");
+ logger.debug("method is NULL:");
}
method = null;
@@ -185,7 +180,7 @@ public class RestfulUtil {
try {
EntityUtils.consume(httpResponse.getEntity());
} catch(Exception e) {
- LOGGER.debug("Exception :", e);
+ logger.debug("Exception :", e);
}
}
@@ -193,18 +188,20 @@ public class RestfulUtil {
try {
method.reset();
} catch(Exception e) {
- LOGGER.debug("Exception :", e);
+ logger.debug("Exception :", e);
}
}
}
}
private static void logError(String errMsg, Throwable t) {
- LOGGER.error(MessageEnum.RA_NS_EXC, VFC_ADAPTER, "", MsoLogger.ErrorCode.AvailabilityError, errMsg, t);
+ logger.error("{} {} {} {}", MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER,
+ MsoLogger.ErrorCode.AvailabilityError.getValue(), errMsg, t);
}
private static void logError(String errMsg) {
- LOGGER.error(MessageEnum.RA_NS_EXC, VFC_ADAPTER, "", MsoLogger.ErrorCode.AvailabilityError, errMsg);
+ logger.error("{} {} {} {}", MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER,
+ MsoLogger.ErrorCode.AvailabilityError.toString(), errMsg);
}
private static RestfulResponse createResponse(int statusCode, String content) {