summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers')
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java18
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java39
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java11
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java2
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java9
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java11
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java14
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java6
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java13
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java13
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java11
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java4
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java14
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java42
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java18
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java50
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java10
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java18
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java34
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java22
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java26
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java10
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java11
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java15
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java7
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java7
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java10
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java17
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java7
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java19
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java17
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailedTest.java35
37 files changed, 353 insertions, 225 deletions
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java
index 829f8ce30c..7e9eed32b1 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java
@@ -35,7 +35,7 @@ import com.fasterxml.jackson.annotation.JsonRootName;
CommonConstants.REQUEST_ID_HEADER,
CommonConstants.IS_BASE_VF_MODULE_VARIABLE, CommonConstants.RECIPE_TIMEOUT_VARIABLE,
CommonConstants.REQUEST_ACTION_VARIABLE, CommonConstants.SERVICE_INSTANCE_ID_VARIABLE,
- CommonConstants.CORRELATION_ID, CommonConstants.VNF_ID_VARIABLE, CommonConstants.VF_MODULE_ID_VARIABLE,
+ CommonConstants.PNF_CORRELATION_ID, CommonConstants.VNF_ID_VARIABLE, CommonConstants.VF_MODULE_ID_VARIABLE,
CommonConstants.VOLUME_GROUP_ID_VARIABLE, CommonConstants.NETWORK_ID_VARIABLE,
CommonConstants.CONFIGURATION_ID_VARIABLE, CommonConstants.SERVICE_TYPE_VARIABLE,
CommonConstants.VNF_TYPE_VARIABLE, CommonConstants.VF_MODULE_TYPE_VARIABLE,
@@ -68,8 +68,8 @@ public class CamundaVIDRequest {
@JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE)
private CamundaInput serviceInstanceId;
- @JsonProperty(CommonConstants.CORRELATION_ID)
- private CamundaInput correlationId;
+ @JsonProperty(CommonConstants.PNF_CORRELATION_ID)
+ private CamundaInput pnfCorrelationId;
@JsonProperty(CommonConstants.VNF_ID_VARIABLE)
private CamundaInput vnfId;
@@ -192,14 +192,14 @@ public class CamundaVIDRequest {
this.serviceInstanceId = serviceInstanceId;
}
- @JsonProperty(CommonConstants.CORRELATION_ID)
- public CamundaInput getCorrelationId() {
- return correlationId;
+ @JsonProperty(CommonConstants.PNF_CORRELATION_ID)
+ public CamundaInput getPnfCorrelationId() {
+ return pnfCorrelationId;
}
- @JsonProperty(CommonConstants.CORRELATION_ID)
- public void setCorrelationId(CamundaInput correlationId) {
- this.correlationId = correlationId;
+ @JsonProperty(CommonConstants.PNF_CORRELATION_ID)
+ public void setPnfCorrelationId(CamundaInput pnfCorrelationId) {
+ this.pnfCorrelationId = pnfCorrelationId;
}
@JsonProperty(CommonConstants.VNF_ID_VARIABLE)
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java
index 34cfe18508..d3e8323f37 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.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.
@@ -41,13 +42,15 @@ import org.onap.so.apihandler.camundabeans.CamundaRequest;
import org.onap.so.apihandler.camundabeans.CamundaVIDRequest;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
public class CamundaClient extends RequestClient{
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, CamundaClient.class);
+ private static Logger logger = LoggerFactory.getLogger(CamundaClient.class);
private static final String CAMUNDA_URL_MESAGE = "Camunda url is: ";
public CamundaClient() {
@@ -60,19 +63,19 @@ public class CamundaClient extends RequestClient{
String requestTimeout, String schemaVersion, String serviceInstanceId, String action)
throws ClientProtocolException, IOException{
HttpPost post = new HttpPost(url);
- msoLogger.debug(CAMUNDA_URL_MESAGE + url);
+ logger.debug(CAMUNDA_URL_MESAGE + url);
String jsonReq = wrapRequest(camundaReqXML, requestId, serviceInstanceId, requestTimeout, schemaVersion);
StringEntity input = new StringEntity(jsonReq);
input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
- msoLogger.info("Camunda Request Content: " + jsonReq);
+ logger.info("Camunda Request Content: {}", jsonReq);
post.setEntity(input);
setupHeaders(post);
HttpResponse response = client.execute(post);
- msoLogger.debug("Response is: " + response);
+ logger.debug("Response is: {}", response);
return response;
}
@@ -98,7 +101,7 @@ public class CamundaClient extends RequestClient{
public HttpResponse post(String jsonReq)
throws ClientProtocolException, IOException{
HttpPost post = new HttpPost(url);
- msoLogger.debug(CAMUNDA_URL_MESAGE + url);
+ logger.debug(CAMUNDA_URL_MESAGE + url);
StringEntity input = new StringEntity(jsonReq);
input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
@@ -118,7 +121,7 @@ public class CamundaClient extends RequestClient{
post.setEntity(input);
HttpResponse response = client.execute(post);
- msoLogger.debug("Response is: " + response);
+ logger.debug("Response is: {}", response);
return response;
}
@@ -126,9 +129,9 @@ public class CamundaClient extends RequestClient{
public HttpResponse post(RequestClientParameter parameterObject)
throws ClientProtocolException, IOException{
HttpPost post = new HttpPost(url);
- msoLogger.debug(CAMUNDA_URL_MESAGE+ url);
+ logger.debug(CAMUNDA_URL_MESAGE+ url);
String jsonReq = wrapVIDRequest(parameterObject.getRequestId(), parameterObject.isBaseVfModule(), parameterObject.getRecipeTimeout(), parameterObject.getRequestAction(),
- parameterObject.getServiceInstanceId(), parameterObject.getCorrelationId(), parameterObject.getVnfId(), parameterObject.getVfModuleId(), parameterObject.getVolumeGroupId(), parameterObject.getNetworkId(), parameterObject.getConfigurationId(),
+ parameterObject.getServiceInstanceId(), parameterObject.getPnfCorrelationId(), parameterObject.getVnfId(), parameterObject.getVfModuleId(), parameterObject.getVolumeGroupId(), parameterObject.getNetworkId(), parameterObject.getConfigurationId(),
parameterObject.getServiceType(), parameterObject.getVnfType(), parameterObject.getVfModuleType(), parameterObject.getNetworkType(), parameterObject.getRequestDetails(), parameterObject.getApiVersion(), parameterObject.isaLaCarte(), parameterObject.getRequestUri(), parameterObject.getRecipeParamXsd(),
parameterObject.getInstanceGroupId());
@@ -151,7 +154,7 @@ public class CamundaClient extends RequestClient{
post.setEntity(input);
HttpResponse response = client.execute(post);
- msoLogger.debug("Response is: " + response);
+ logger.debug("Response is: {}", response);
return response;
}
@@ -189,16 +192,17 @@ public class CamundaClient extends RequestClient{
mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
jsonReq = mapper.writeValueAsString(camundaRequest);
- msoLogger.trace("request body is " + jsonReq);
+ logger.trace("request body is {}", jsonReq);
}catch(Exception e){
- msoLogger.error(MessageEnum.APIH_WARP_REQUEST, "Camunda", "wrapRequest", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH Warp request", e);
+ logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapRequest",
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e);
}
return jsonReq;
}
protected String wrapVIDRequest(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId, String correlationId,
+ int recipeTimeout, String requestAction, String serviceInstanceId, String pnfCorrelationId,
String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
String serviceType, String vnfType, String vfModuleType, String networkType,
String requestDetails, String apiVersion, boolean aLaCarte, String requestUri, String paramXsd,
@@ -214,7 +218,7 @@ public class CamundaClient extends RequestClient{
CamundaIntegerInput recipeTimeoutInput = new CamundaIntegerInput();
CamundaInput requestActionInput = new CamundaInput();
CamundaInput serviceInstanceIdInput = new CamundaInput();
- CamundaInput correlationIdInput = new CamundaInput();
+ CamundaInput pnfCorrelationIdInput = new CamundaInput();
CamundaInput vnfIdInput = new CamundaInput();
CamundaInput vfModuleIdInput = new CamundaInput();
CamundaInput volumeGroupIdInput = new CamundaInput();
@@ -236,7 +240,7 @@ public class CamundaClient extends RequestClient{
recipeTimeoutInput.setValue(recipeTimeout);
requestActionInput.setValue(StringUtils.defaultString(requestAction));
serviceInstanceIdInput.setValue(StringUtils.defaultString(serviceInstanceId));
- correlationIdInput.setValue(StringUtils.defaultString(correlationId));
+ pnfCorrelationIdInput.setValue(StringUtils.defaultString(pnfCorrelationId));
vnfIdInput.setValue(StringUtils.defaultString(vnfId));
vfModuleIdInput.setValue(StringUtils.defaultString(vfModuleId));
volumeGroupIdInput.setValue(StringUtils.defaultString(volumeGroupId));
@@ -261,7 +265,7 @@ public class CamundaClient extends RequestClient{
camundaRequest.setRecipeTimeout(recipeTimeoutInput);
camundaRequest.setRequestAction(requestActionInput);
camundaRequest.setServiceInstanceId(serviceInstanceIdInput);
- camundaRequest.setCorrelationId(correlationIdInput);
+ camundaRequest.setPnfCorrelationId(pnfCorrelationIdInput);
camundaRequest.setVnfId(vnfIdInput);
camundaRequest.setVfModuleId(vfModuleIdInput);
camundaRequest.setVolumeGroupId(volumeGroupIdInput);
@@ -281,9 +285,10 @@ public class CamundaClient extends RequestClient{
mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
jsonReq = mapper.writeValueAsString(camundaRequest);
- msoLogger.trace("request body is " + jsonReq);
+ logger.trace("request body is {}", jsonReq);
}catch(Exception e){
- msoLogger.error(MessageEnum.APIH_WARP_REQUEST, "Camunda", "wrapVIDRequest", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH Warp request", e);
+ logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapVIDRequest",
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e);
}
return jsonReq;
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java
index bb0a4b0172..d8c785dcb3 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.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
@@ -28,10 +30,11 @@ import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class CamundaTaskClient extends RequestClient{
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, CamundaTaskClient.class);
+ private static Logger logger = LoggerFactory.getLogger(CamundaTaskClient.class);
public CamundaTaskClient() {
super(CommonConstants.CAMUNDATASK);
@@ -40,7 +43,7 @@ public class CamundaTaskClient extends RequestClient{
@Override
public HttpResponse post(String jsonReq) throws IOException{
HttpPost post = new HttpPost(url);
- msoLogger.debug("Camunda Task url is: "+ url);
+ logger.debug("Camunda Task url is: {}", url);
StringEntity input = new StringEntity(jsonReq);
input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
@@ -75,7 +78,7 @@ public class CamundaTaskClient extends RequestClient{
@Override
public HttpResponse get() throws IOException {
HttpGet get = new HttpGet(url);
- msoLogger.debug("Camunda Task url is: "+ url);
+ logger.debug("Camunda Task url is: {}", url);
String encryptedCredentials;
if(props!=null){
encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH);
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java
index b75ad9e415..24fb0e0d20 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java
@@ -54,7 +54,7 @@ public final class CommonConstants {
public static final String RECIPE_TIMEOUT_VARIABLE = "recipeTimeout";
public static final String REQUEST_ACTION_VARIABLE = "requestAction";
public static final String SERVICE_INSTANCE_ID_VARIABLE = "serviceInstanceId";
- public static final String CORRELATION_ID = "correlationId";
+ public static final String PNF_CORRELATION_ID = "pnfCorrelationId";
public static final String VNF_ID_VARIABLE = "vnfId";
public static final String VF_MODULE_ID_VARIABLE = "vfModuleId";
public static final String VOLUME_GROUP_ID_VARIABLE = "volumeGroupId";
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java
index 4e37561891..ee1ea8e562 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.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
@@ -26,13 +28,14 @@ import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.InputStreamReader;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.w3c.dom.ls.LSInput;
import org.w3c.dom.ls.LSResourceResolver;
public class PathResourceResolver implements LSResourceResolver {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, PathResourceResolver.class);
+ private static Logger logger = LoggerFactory.getLogger(PathResourceResolver.class);
private String path;
@@ -50,7 +53,7 @@ public class PathResourceResolver implements LSResourceResolver {
try {
stream = new FileInputStream(path + systemId);
} catch (FileNotFoundException e) {
- msoLogger.debug ("Could not resolve resource based on file: " + path + systemId, e);
+ logger.debug ("Could not resolve resource based on file: {}", path + systemId, e);
}
input.setPublicId(publicId);
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java
index ca1ad7a277..9f5c8460a1 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.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
@@ -26,12 +28,13 @@ import java.security.GeneralSecurityException;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.utils.CryptoUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.core.env.Environment;
public abstract class RequestClient {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH,RequestClient.class);
+ private static Logger logger = LoggerFactory.getLogger(RequestClient.class);
protected Environment props;
protected String url;
protected HttpClient client;
@@ -80,7 +83,7 @@ public abstract class RequestClient {
return result;
}
catch (GeneralSecurityException e) {
- msoLogger.debug("Security exception", e);
+ logger.debug("Security exception", e);
}
return defaultValue;
}
@@ -91,7 +94,7 @@ public abstract class RequestClient {
return result;
}
catch (GeneralSecurityException e) {
- msoLogger.debug("Security exception", e);
+ logger.debug("Security exception", e);
}
return defaultValue;
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java
index 1d18e2b02c..209f337a1e 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java
@@ -28,7 +28,7 @@ public class RequestClientParameter {
private int recipeTimeout;
private String requestAction;
private String serviceInstanceId;
- private String correlationId;
+ private String pnfCorrelationId;
private String vnfId;
private String vfModuleId;
private String volumeGroupId;
@@ -51,7 +51,7 @@ public class RequestClientParameter {
recipeTimeout = builder.recipeTimeout;
requestAction = builder.requestAction;
serviceInstanceId = builder.serviceInstanceId;
- correlationId = builder.correlationId;
+ pnfCorrelationId = builder.pnfCorrelationId;
vnfId = builder.vnfId;
vfModuleId = builder.vfModuleId;
volumeGroupId = builder.volumeGroupId;
@@ -90,8 +90,8 @@ public class RequestClientParameter {
return serviceInstanceId;
}
- public String getCorrelationId() {
- return correlationId;
+ public String getPnfCorrelationId() {
+ return pnfCorrelationId;
}
public String getVnfId() {
@@ -160,7 +160,7 @@ public class RequestClientParameter {
private int recipeTimeout;
private String requestAction;
private String serviceInstanceId;
- private String correlationId;
+ private String pnfCorrelationId;
private String vnfId;
private String vfModuleId;
private String volumeGroupId;
@@ -202,8 +202,8 @@ public class RequestClientParameter {
return this;
}
- public Builder setCorrelationId(String correlationId) {
- this.correlationId = correlationId;
+ public Builder setPnfCorrelationId(String pnfCorrelationId) {
+ this.pnfCorrelationId = pnfCorrelationId;
return this;
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java
index 0cac7db404..3d09a30731 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.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
@@ -37,6 +39,8 @@ import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ResponseHandler {
@@ -45,7 +49,7 @@ public class ResponseHandler {
private String responseBody="";
private HttpResponse httpResponse;
private int type;
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, ResponseHandler.class);
+ private static Logger logger = LoggerFactory.getLogger(ResponseHandler.class);
public ResponseHandler(HttpResponse httpResponse, int type) throws ApiException{
this.httpResponse = httpResponse;
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java
index 414ac8b3cc..da13ff509b 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.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
@@ -35,6 +37,8 @@ import org.apache.commons.io.IOUtils;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;
public class XMLValidator {
@@ -54,7 +58,7 @@ public class XMLValidator {
private SchemaFactory factory;
private Schema schema;
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, XMLValidator.class);
+ private static Logger logger = LoggerFactory.getLogger(XMLValidator.class);
public XMLValidator (String xsdFile){
@@ -73,7 +77,7 @@ public class XMLValidator {
} catch (IOException | SAXException e) {
- msoLogger.debug ("Cannot open file " + XSDS_PATH + xsdFile, e);
+ logger.debug ("Cannot open file {}", XSDS_PATH + xsdFile, e);
errorMsg = "ErrorDetails: xsd file " + xsdFile + "could not be opened - " + e.getMessage ();
}
}
@@ -89,11 +93,12 @@ public class XMLValidator {
validator.validate (src2);
} catch (IOException | SAXException e) {
- msoLogger.debug ("Exception: ", e);
+ logger.debug ("Exception: ", e);
return "ErrorDetails: " + e.getMessage ();
} catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_CANNOT_READ_SCHEMA, "", "", MsoLogger.ErrorCode.SchemaError, "APIH cannot read schema file", e);
+ logger.error("{} {} {}", MessageEnum.APIH_CANNOT_READ_SCHEMA.toString(),
+ MsoLogger.ErrorCode.SchemaError.getValue(), "APIH cannot read schema file", e);
return "ErrorDetails: " + "Unable to read the schema file";
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java
index d801a94c9b..aeed65b3c3 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.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.apihandler.recipe;
import java.io.IOException;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.web.client.ResponseErrorHandler;
@@ -31,14 +34,12 @@ import org.springframework.web.client.ResponseErrorHandler;
public class CamundaClientErrorHandler implements ResponseErrorHandler{
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, CamundaClientErrorHandler.class);
+ private static Logger logger = LoggerFactory.getLogger(CamundaClientErrorHandler.class);
@Override
public void handleError(ClientHttpResponse response) throws IOException {
-
- msoLogger.debug(response.getBody().toString());
- //msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.ERROR,
- // MsoLogger.ResponseCode.CommunicationError, e.getMessage(), "BPMN", fullURL, null);
+
+ logger.debug(response.getBody().toString());
}
@Override
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java
index ef19852cd1..282ca12e2b 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.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
@@ -48,11 +50,13 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
@Provider
public class ApiExceptionMapper implements ExceptionMapper<ApiException> {
- private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ApiExceptionMapper.class);
+ private static Logger logger = LoggerFactory.getLogger(ApiExceptionMapper.class);
private final JAXBContext context;
@@ -132,7 +136,8 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> {
}
} catch (JsonProcessingException | JAXBException e) {
String errorMsg = "Exception in buildServiceErrorResponse writing exceptionType to string " + e.getMessage();
- logger.error(MessageEnum.GENERAL_EXCEPTION, "BuildServiceErrorResponse", "", "", MsoLogger.ErrorCode.DataError, errorMsg, e);
+ logger.error("{} {} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), "BuildServiceErrorResponse",
+ MsoLogger.ErrorCode.DataError.getValue(), errorMsg, e);
return errorMsg;
}
@@ -141,7 +146,7 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> {
protected void writeErrorLog(Exception e, String errorText, ErrorLoggerInfo errorLogInfo) {
if( e!= null)
- logger.error(e);
+ logger.error("Exception occurred", e);
if(errorLogInfo != null)
logger.error(errorLogInfo.getLoggerMessageType().toString(), errorLogInfo.getErrorSource(), errorLogInfo.getTargetEntity(), errorLogInfo.getTargetServiceName(), errorLogInfo.getErrorCode(), errorText);
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java
index 7a03ce0542..0958905720 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java
@@ -148,7 +148,7 @@ public class CamundaClientTest{
int recipeTimeout = 10000;
String requestAction = "createInstance";
String serviceInstanceId = "12345679";
- String correlationId = "12345679";
+ String pnfCorrelationId = "12345679";
String vnfId = "234567891";
String vfModuleId = "345678912";
String volumeGroupId = "456789123";
@@ -164,7 +164,7 @@ public class CamundaClientTest{
String requestUri = "v7/serviceInstances/assign";
String instanceGroupId = "ff305d54-75b4-431b-adb2-eb6b9e5ff000";
- String testResult = testClient.wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction, serviceInstanceId, correlationId,
+ String testResult = testClient.wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction, serviceInstanceId, pnfCorrelationId,
vnfId, vfModuleId, volumeGroupId, networkId, configurationId, serviceType,
vnfType, vfModuleType, networkType, requestDetails, apiVersion, aLaCarte, requestUri, "", instanceGroupId);
String expected = inputStream("/WrappedVIDRequest.json");
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json b/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json
index 4c716c2ae3..b9d0a8c3c6 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json
+++ b/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json
@@ -1 +1 @@
-{"variables":{"bpmnRequest":{"value":"{requestDetails: }","type":"String"},"requestId":{"value":"f7ce78bb-423b-11e7-93f8-0050569a796","type":"String"},"mso-request-id":{"value":"f7ce78bb-423b-11e7-93f8-0050569a796","type":"String"},"isBaseVfModule":{"value":true,"type":"Boolean"},"recipeTimeout":{"value":10000,"type":"Integer"},"requestAction":{"value":"createInstance","type":"String"},"serviceInstanceId":{"value":"12345679","type":"String"},"correlationId":{"value":"12345679","type":"String"},"vnfId":{"value":"234567891","type":"String"},"vfModuleId":{"value":"345678912","type":"String"},"volumeGroupId":{"value":"456789123","type":"String"},"networkId":{"value":"567891234","type":"String"},"configurationId":{"value":"678912345","type":"String"},"serviceType":{"value":"testService","type":"String"},"vnfType":{"value":"testVnf","type":"String"},"vfModuleType":{"value":"vfModuleType","type":"String"},"networkType":{"value":"networkType","type":"String"},"recipeParams":{"value":"","type":"String"},"host":{"value":null,"type":"String"},"apiVersion":{"value":"6","type":"String"},"aLaCarte":{"value":true,"type":"Boolean"},"requestUri":{"value":"v7/serviceInstances/assign","type":"String"},"instanceGroupId":{"value":"ff305d54-75b4-431b-adb2-eb6b9e5ff000","type":"String"}}} \ No newline at end of file
+{"variables":{"bpmnRequest":{"value":"{requestDetails: }","type":"String"},"requestId":{"value":"f7ce78bb-423b-11e7-93f8-0050569a796","type":"String"},"mso-request-id":{"value":"f7ce78bb-423b-11e7-93f8-0050569a796","type":"String"},"isBaseVfModule":{"value":true,"type":"Boolean"},"recipeTimeout":{"value":10000,"type":"Integer"},"requestAction":{"value":"createInstance","type":"String"},"serviceInstanceId":{"value":"12345679","type":"String"},"pnfCorrelationId":{"value":"12345679","type":"String"},"vnfId":{"value":"234567891","type":"String"},"vfModuleId":{"value":"345678912","type":"String"},"volumeGroupId":{"value":"456789123","type":"String"},"networkId":{"value":"567891234","type":"String"},"configurationId":{"value":"678912345","type":"String"},"serviceType":{"value":"testService","type":"String"},"vnfType":{"value":"testVnf","type":"String"},"vfModuleType":{"value":"vfModuleType","type":"String"},"networkType":{"value":"networkType","type":"String"},"recipeParams":{"value":"","type":"String"},"host":{"value":null,"type":"String"},"apiVersion":{"value":"6","type":"String"},"aLaCarte":{"value":true,"type":"Boolean"},"requestUri":{"value":"v7/serviceInstances/assign","type":"String"},"instanceGroupId":{"value":"ff305d54-75b4-431b-adb2-eb6b9e5ff000","type":"String"}}} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java
index d801a94c9b..74d5f7a9e6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.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.apihandler.recipe;
import java.io.IOException;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.web.client.ResponseErrorHandler;
@@ -31,15 +34,12 @@ import org.springframework.web.client.ResponseErrorHandler;
public class CamundaClientErrorHandler implements ResponseErrorHandler{
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, CamundaClientErrorHandler.class);
+ private static Logger logger = LoggerFactory.getLogger(CamundaClientErrorHandler.class);
@Override
public void handleError(ClientHttpResponse response) throws IOException {
-
- msoLogger.debug(response.getBody().toString());
- //msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.ERROR,
- // MsoLogger.ResponseCode.CommunicationError, e.getMessage(), "BPMN", fullURL, null);
- }
+ logger.debug(response.getBody().toString());
+ }
@Override
public boolean hasError(ClientHttpResponse response) throws IOException {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java
index 862e9a668f..b002aa9f54 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.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
@@ -23,6 +25,9 @@ package org.onap.so.apihandlerinfra;
import java.net.URI;
import java.util.Collections;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -38,13 +43,10 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
-import java.util.UUID;
import org.apache.http.HttpStatus;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
@@ -59,16 +61,16 @@ import io.swagger.annotations.ApiOperation;
@Path("/globalhealthcheck")
@Api(value="/globalhealthcheck",description="APIH Infra Global Health Check")
public class GlobalHealthcheckHandler {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, GlobalHealthcheckHandler.class);
- private static final String CONTEXTPATH_PROPERTY = "management.context-path";
- private static final String PROPERTY_DOMAIN = "mso.health.endpoints";
- private static final String CATALOGDB_PROPERTY = PROPERTY_DOMAIN+".catalogdb";
- private static final String REQUESTDB_PROPERTY = PROPERTY_DOMAIN+".requestdb";
- private static final String SDNC_PROPERTY = PROPERTY_DOMAIN+".sdnc";
- private static final String OPENSTACK_PROPERTY = PROPERTY_DOMAIN+".openstack";
- private static final String BPMN_PROPERTY = PROPERTY_DOMAIN+".bpmn";
- private static final String ASDC_PROPERTY = PROPERTY_DOMAIN+".asdc";
- private static final String REQUESTDBATTSVC_PROPERTY = PROPERTY_DOMAIN+".requestdbattsvc";
+ private static Logger logger = LoggerFactory.getLogger(GlobalHealthcheckHandler.class);
+ private static final String CONTEXTPATH_PROPERTY = "management.context-path";
+ private static final String PROPERTY_DOMAIN = "mso.health.endpoints";
+ private static final String CATALOGDB_PROPERTY = PROPERTY_DOMAIN + ".catalogdb";
+ private static final String REQUESTDB_PROPERTY = PROPERTY_DOMAIN + ".requestdb";
+ private static final String SDNC_PROPERTY = PROPERTY_DOMAIN + ".sdnc";
+ private static final String OPENSTACK_PROPERTY = PROPERTY_DOMAIN + ".openstack";
+ private static final String BPMN_PROPERTY = PROPERTY_DOMAIN + ".bpmn";
+ private static final String ASDC_PROPERTY = PROPERTY_DOMAIN + ".asdc";
+ private static final String REQUESTDBATTSVC_PROPERTY = PROPERTY_DOMAIN + ".requestdbattsvc";
private static final String DEFAULT_PROPERTY_VALUE = "";
// e.g. /manage
@@ -117,7 +119,7 @@ public class GlobalHealthcheckHandler {
// Generated RequestId
String requestId = requestContext.getProperty("requestId").toString();
MsoLogger.setLogContext(requestId, null);
- msoLogger.info(MessageEnum.APIH_GENERATED_REQUEST_ID, requestId, "", "");
+ logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId);
// set APIH status, this is the main entry point
rsp.setApih(HealthcheckStatus.UP.toString());
@@ -137,14 +139,14 @@ public class GlobalHealthcheckHandler {
rsp.setRequestdbAdapterAttsvc(querySubsystemHealth(MsoSubsystems.REQUESTDBATT));
// set Message
rsp.setMessage(String.format("HttpStatus: %s", HttpStatus.SC_OK));
- msoLogger.info(rsp.toString(), "", "");
+ logger.info(rsp.toString());
HEALTH_CHECK_RESPONSE = Response.status (HttpStatus.SC_OK)
.entity (rsp)
.build ();
}catch (Exception ex){
- msoLogger.error(ex);
+ logger.error("Exception occurred", ex);
rsp.setMessage(ex.getMessage());
HEALTH_CHECK_RESPONSE = Response.status (HttpStatus.SC_INTERNAL_SERVER_ERROR)
.entity (rsp)
@@ -170,7 +172,7 @@ public class GlobalHealthcheckHandler {
// build final endpoint url
UriBuilder builder = UriBuilder.fromPath(ept).path(actuatorContextPath).path(health);
URI uri = builder.build();
- msoLogger.info("Calculated URL: "+uri.toString(), "", "");
+ logger.info("Calculated URL: {}", uri.toString());
ResponseEntity<SubsystemHealthcheckResponse> result =
restTemplate.exchange(uri, HttpMethod.GET, buildHttpEntityForRequest(), SubsystemHealthcheckResponse.class);
@@ -178,13 +180,13 @@ public class GlobalHealthcheckHandler {
return processResponseFromSubsystem(result,subsystem);
}catch(Exception ex){
- msoLogger.error("Exception occured in GlobalHealthcheckHandler.querySubsystemHealth() "+ ex);
+ logger.error("Exception occured in GlobalHealthcheckHandler.querySubsystemHealth() ", ex);
return HealthcheckStatus.DOWN.toString();
}
}
protected String processResponseFromSubsystem(ResponseEntity<SubsystemHealthcheckResponse> result, MsoSubsystems subsystem){
if(result == null || result.getStatusCodeValue() != HttpStatus.SC_OK){
- msoLogger.error(String.format("Globalhealthcheck: checking subsystem: %s failed ! result object is: %s",
+ logger.error(String.format("Globalhealthcheck: checking subsystem: %s failed ! result object is: %s",
subsystem,
result == null? "NULL": result));
return HealthcheckStatus.DOWN.toString();
@@ -196,7 +198,7 @@ public class GlobalHealthcheckHandler {
if("UP".equalsIgnoreCase(status)){
return HealthcheckStatus.UP.toString();
}else{
- msoLogger.error(subsystem + ", query health endpoint did not return UP status!");
+ logger.error("{}, query health endpoint did not return UP status!", subsystem);
return HealthcheckStatus.DOWN.toString();
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java
index 81a197c85c..d686e80352 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.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
@@ -55,6 +57,8 @@ import org.onap.so.exceptions.ValidationException;
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;
@@ -68,7 +72,7 @@ import io.swagger.annotations.ApiOperation;
@Path("/tasks")
@Component
public class ManualTasks {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, ManualTasks.class);
+ private static Logger logger = LoggerFactory.getLogger(ManualTasks.class);
@org.springframework.beans.factory.annotation.Value("${mso.camunda.rest.task.uri}")
@@ -94,9 +98,9 @@ public class ManualTasks {
String requestId = requestContext.getProperty("requestId").toString();
MsoLogger.setLogContext(requestId, null);
- msoLogger.info(MessageEnum.APIH_GENERATED_REQUEST_ID, requestId, "", "");
+ logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId);
long startTime = System.currentTimeMillis ();
- msoLogger.debug ("requestId is: " + requestId);
+ logger.debug ("requestId is: {}", requestId);
TasksRequest taskRequest = null;
String apiVersion = version.substring(1);
@@ -203,9 +207,7 @@ public class ManualTasks {
// BPEL accepted the request, the request is in progress
if (bpelStatus == HttpStatus.SC_NO_CONTENT || bpelStatus == HttpStatus.SC_ACCEPTED) {
- msoLogger.debug ("Received good response from Camunda");
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "BPMN completed the request");
+ logger.debug ("Received good response from Camunda");
TaskRequestReference trr = new TaskRequestReference();
trr.setTaskId(taskId);
String completeResp = null;
@@ -224,8 +226,8 @@ public class ManualTasks {
throw validateException;
}
- msoLogger.debug("Response to the caller: " + completeResp);
- msoLogger.debug ("End of the transaction, the final response is: " + (String) completeResp);
+ logger.debug("Response to the caller: {}", completeResp);
+ logger.debug ("End of the transaction, the final response is: {}", completeResp);
return builder.buildResponse(HttpStatus.SC_ACCEPTED, requestId, completeResp, apiVersion);
} else {
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).build();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
index 7f602323e1..411a5e584a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.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
@@ -66,7 +68,6 @@ import org.onap.so.apihandlerinfra.vnfbeans.VnfInputs;
import org.onap.so.apihandlerinfra.vnfbeans.VnfRequest;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
-import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
import org.onap.so.exceptions.ValidationException;
import org.onap.so.logger.LogConstants;
import org.onap.so.logger.MessageEnum;
@@ -84,6 +85,8 @@ import org.onap.so.serviceinstancebeans.RequestParameters;
import org.onap.so.serviceinstancebeans.Service;
import org.onap.so.serviceinstancebeans.ServiceException;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -107,7 +110,7 @@ public class MsoRequest {
@Autowired
private ResponseBuilder builder;
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH,MsoRequest.class);
+ private static Logger logger = LoggerFactory.getLogger(MsoRequest.class);
public Response buildServiceErrorResponse (int httpResponseCode, MsoException exceptionType,
String errorText, String messageId, List<String> variables, String version) {
@@ -150,8 +153,9 @@ public class MsoRequest {
mapper.setSerializationInclusion(Include.NON_DEFAULT);
requestErrorStr = mapper.writeValueAsString(re);
}catch(Exception e){
- msoLogger.error (MessageEnum.APIH_VALIDATION_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception in buildServiceErrorResponse writing exceptionType to string ", e);
- }
+ logger.error("{} {} {}", MessageEnum.APIH_VALIDATION_ERROR.toString(), MsoLogger.ErrorCode.DataError.getValue(),
+ "Exception in buildServiceErrorResponse writing exceptionType to string ", e);
+ }
return builder.buildResponse(httpResponseCode, null, requestErrorStr, version);
}
@@ -162,9 +166,9 @@ public class MsoRequest {
public void parse (ServiceInstancesRequest sir, HashMap<String,String> instanceIdMap, Actions action, String version,
String originalRequestJSON, int reqVersion, Boolean aLaCarteFlag) throws ValidationException, IOException {
- msoLogger.debug ("Validating the Service Instance request");
+ logger.debug ("Validating the Service Instance request");
List<ValidationRule> rules = new ArrayList<>();
- msoLogger.debug ("Incoming version is: " + version + " coverting to int: " + reqVersion);
+ logger.debug ("Incoming version is: {} coverting to int: {}", version, reqVersion);
RequestParameters requestParameters = sir.getRequestDetails().getRequestParameters();
ValidationInformation info = new ValidationInformation(sir, instanceIdMap, action,
reqVersion, aLaCarteFlag, requestParameters);
@@ -249,9 +253,7 @@ public class MsoRequest {
}
}catch(Exception e){
- //msoLogger.error (MessageEnum.APIH_VALIDATION_ERROR, e);
throw new ValidationException ("QueryParam ServiceInfo", e);
-
}
}
@@ -382,9 +384,10 @@ public class MsoRequest {
aq.setRequestStatus (status.toString ());
aq.setLastModifiedBy (Constants.MODIFIED_BY_APIHANDLER);
} catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception when creation record request", e);
-
- if (!status.equals (Status.FAILED)) {
+ logger.error("{} {} {}", MessageEnum.APIH_DB_INSERT_EXC.toString(), MsoLogger.ErrorCode.DataError.getValue(),
+ "Exception when creation record request", e);
+
+ if (!status.equals (Status.FAILED)) {
throw e;
}
}
@@ -421,9 +424,10 @@ public class MsoRequest {
aq.setLastModifiedBy (Constants.MODIFIED_BY_APIHANDLER);
} catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception when creation record request", e);
-
- if (!status.equals (Status.FAILED)) {
+ logger.error("{} {} {}", MessageEnum.APIH_DB_INSERT_EXC.toString(), MsoLogger.ErrorCode.DataError.getValue(),
+ "Exception when creation record request", e);
+
+ if (!status.equals (Status.FAILED)) {
throw e;
}
}
@@ -447,9 +451,10 @@ public class MsoRequest {
request.setRequestUrl(MDC.get(LogConstants.HTTP_URL));
requestsDbClient.save(request);
} catch (Exception e) {
- msoLogger.error(MessageEnum.APIH_DB_UPDATE_EXC, e.getMessage(), "", "", MsoLogger.ErrorCode.DataError, "Exception when updating record in DB");
- msoLogger.debug ("Exception: ", e);
- }
+ logger.error("{} {} {} {}", MessageEnum.APIH_DB_UPDATE_EXC.toString(), e.getMessage(),
+ MsoLogger.ErrorCode.DataError.getValue(), "Exception when updating record in DB");
+ logger.debug("Exception: ", e);
+ }
}
@@ -531,8 +536,9 @@ public class MsoRequest {
return null;
} catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DOM2STR_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception in domToStr", e);
- }
+ logger.error("{} {} {}", MessageEnum.APIH_DOM2STR_ERROR.toString(), MsoLogger.ErrorCode.DataError.getValue(),
+ "Exception in domToStr", e);
+ }
return null;
}
@@ -556,12 +562,12 @@ public class MsoRequest {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(Include.NON_NULL);
//mapper.configure(Feature.WRAP_ROOT_VALUE, true);
- msoLogger.debug ("building sir from object " + sir);
+ logger.debug ("building sir from object {}", sir);
String requestJSON = mapper.writeValueAsString(sir);
// Perform mapping from VID-style modelInfo fields to ASDC-style modelInfo fields
- msoLogger.debug("REQUEST JSON before mapping: " + requestJSON);
+ logger.debug("REQUEST JSON before mapping: {}", requestJSON);
// modelUuid = modelVersionId
requestJSON = requestJSON.replaceAll("\"modelVersionId\":","\"modelUuid\":");
// modelCustomizationUuid = modelCustomizationId
@@ -570,7 +576,7 @@ public class MsoRequest {
requestJSON = requestJSON.replaceAll("\"modelCustomizationName\":","\"modelInstanceName\":");
// modelInvariantUuid = modelInvariantId
requestJSON = requestJSON.replaceAll("\"modelInvariantId\":","\"modelInvariantUuid\":");
- msoLogger.debug("REQUEST JSON after mapping: " + requestJSON);
+ logger.debug("REQUEST JSON after mapping: {}", requestJSON);
return requestJSON;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java
index 35f196b263..cb458a7420 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.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,7 +35,8 @@ import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
import org.onap.so.logger.MessageEnum;
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;
import io.swagger.annotations.Api;
@@ -44,7 +47,7 @@ import io.swagger.annotations.ApiOperation;
@Component
public class NodeHealthcheckHandler {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, NodeHealthcheckHandler.class);
+ private static Logger logger = LoggerFactory.getLogger(NodeHealthcheckHandler.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>";
@@ -61,8 +64,7 @@ public class NodeHealthcheckHandler {
MsoLogger.setServiceName ("NodeHealthcheck");
// Generated RequestId
String requestId = requestContext.getProperty("requestId").toString();
- MsoLogger.setLogContext(requestId, null);
- msoLogger.info(MessageEnum.APIH_GENERATED_REQUEST_ID, requestId, "", "");
+ logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId);
return HEALTH_CHECK_RESPONSE;
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
index b65b82a87d..d74a4de451 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.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
@@ -63,6 +65,8 @@ import org.onap.so.serviceinstancebeans.RequestDetails;
import org.onap.so.serviceinstancebeans.RequestList;
import org.onap.so.serviceinstancebeans.RequestStatus;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -76,7 +80,7 @@ import io.swagger.annotations.ApiOperation;
@Component
public class OrchestrationRequests {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, OrchestrationRequests.class);
+ private static Logger logger = LoggerFactory.getLogger(OrchestrationRequests.class);
@Autowired
@@ -106,7 +110,7 @@ public class OrchestrationRequests {
requestProcessingData = requestsDbClient.getRequestProcessingDataBySoRequestId(requestId);
} catch (Exception e) {
- msoLogger.error(e);
+ logger.error("Exception occurred", e);
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.AvailabilityError).build();
@@ -164,7 +168,7 @@ public class OrchestrationRequests {
throw new ValidationException("At least one filter query param must be specified");
}
}catch(ValidationException ex){
- msoLogger.error(ex);
+ logger.error("Exception occurred", ex);
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.DataError).build();
ValidateException validateException = new ValidateException.Builder(ex.getMessage(),
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR).cause(ex).errorInfo(errorLoggerInfo).build();
@@ -202,7 +206,7 @@ public class OrchestrationRequests {
public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId, @PathParam("version") String version) throws ApiException{
long startTime = System.currentTimeMillis ();
- msoLogger.debug ("requestId is: " + requestId);
+ logger.debug ("requestId is: {}", requestId);
ServiceInstancesRequest sir = null;
InfraActiveRequests infraActiveRequest = null;
@@ -212,7 +216,7 @@ public class OrchestrationRequests {
ObjectMapper mapper = new ObjectMapper();
sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
} catch(IOException e){
- msoLogger.error(e);
+ logger.error("Exception occurred", e);
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
@@ -223,7 +227,7 @@ public class OrchestrationRequests {
try{
msoRequest.parseOrchestration(sir);
} catch (Exception e) {
- msoLogger.error(e);
+ logger.error("Exception occurred", e);
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder("Error parsing request: " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
.errorInfo(errorLoggerInfo).build();
@@ -319,7 +323,7 @@ public class OrchestrationRequests {
requestDetails = mapper.readValue(requestBody, RequestDetails.class);
}
} catch (IOException e) {
- msoLogger.error(e);
+ logger.error("Exception occurred", e);
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : ",
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
index e3b218b90a..1f9f5f5fbe 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.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
@@ -83,6 +85,8 @@ import org.onap.so.serviceinstancebeans.VfModules;
import org.onap.so.serviceinstancebeans.Vnfs;
import org.onap.so.utils.CryptoUtils;
import org.onap.so.utils.UUIDChecker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference;
@@ -126,7 +130,7 @@ import java.util.Optional;
@Api(value="/onap/so/infra/serviceInstantiation",description="Infrastructure API Requests for Service Instances")
public class ServiceInstances {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH,MsoRequest.class);
+ private static Logger logger = LoggerFactory.getLogger(MsoRequest.class);
private static String NAME = "name";
private static String VALUE = "value";
private static final String SAVE_TO_DB = "save instance to db";
@@ -809,7 +813,7 @@ public class ServiceInstances {
String vfModuleId = "";
String volumeGroupId = "";
String networkId = "";
- String correlationId = "";
+ String pnfCorrelationId = "";
String instanceGroupId = null;
if(sir.getServiceInstanceId () != null){
serviceInstanceId = sir.getServiceInstanceId ();
@@ -834,7 +838,7 @@ public class ServiceInstances {
instanceGroupId = sir.getInstanceGroupId();
}
- correlationId = getCorrelationId(sir);
+ pnfCorrelationId = getPnfCorrelationId(sir);
try{
infraActiveRequestsClient.save(currentActiveReq);
@@ -858,7 +862,7 @@ public class ServiceInstances {
.setRecipeTimeout(recipeLookupResult.getRecipeTimeout())
.setRequestAction(action.toString())
.setServiceInstanceId(serviceInstanceId)
- .setCorrelationId(correlationId)
+ .setPnfCorrelationId(pnfCorrelationId)
.setVnfId(vnfId)
.setVfModuleId(vfModuleId)
.setVolumeGroupId(volumeGroupId)
@@ -893,7 +897,7 @@ public class ServiceInstances {
try {
validateHeaders(requestContext);
} catch (ValidationException e) {
- msoLogger.error(e);
+ logger.error("Exception occurred", e);
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
.errorInfo(errorLoggerInfo).build();
@@ -944,7 +948,7 @@ public class ServiceInstances {
return postBPELRequest(currentActiveReq, requestClientParameter, recipeLookupResult.getOrchestrationURI(), requestScope);
}
- private String getCorrelationId(ServiceInstancesRequest sir) {
+ private String getPnfCorrelationId(ServiceInstancesRequest sir) {
return Optional.of(sir)
.map(ServiceInstancesRequest::getRequestDetails)
.map(RequestDetails::getRequestParameters)
@@ -1016,7 +1020,7 @@ public class ServiceInstances {
respHandler = new ResponseHandler (response, requestClient.getType ());
bpelStatus = respHandler.getStatus ();
} catch (ApiException e) {
- msoLogger.error(e);
+ logger.error("Exception occurred", e);
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder("Exception caught mapping Camunda JSON response to object", HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
.errorInfo(errorLoggerInfo).build();
@@ -1041,7 +1045,7 @@ public class ServiceInstances {
jsonResponse.getRequestReferences().setRequestSelfLink(null);
}
} catch (IOException e) {
- msoLogger.error(e);
+ logger.error("Exception occurred", e);
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder("Exception caught mapping Camunda JSON response to object", HttpStatus.SC_NOT_ACCEPTABLE, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
.errorInfo(errorLoggerInfo).build();
@@ -1130,7 +1134,7 @@ public class ServiceInstances {
sir.getRequestDetails().setCloudConfiguration(serviceInstRequest.getRequestDetails().getCloudConfiguration());
sir.getRequestDetails().getRequestParameters().setUserParams(serviceInstRequest.getRequestDetails().getRequestParameters().getUserParams());
}
- msoLogger.debug("Value as string: " + mapper.writeValueAsString(sir));
+ logger.debug("Value as string: {}", mapper.writeValueAsString(sir));
return mapper.writeValueAsString(sir);
}
return null;
@@ -1214,7 +1218,7 @@ public class ServiceInstances {
headers.add(HttpHeaders.AUTHORIZATION, "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()));
}
} catch(GeneralSecurityException e) {
- msoLogger.error("Security exception", e);
+ logger.error("Security exception", e);
}
return headers;
}
@@ -1453,7 +1457,7 @@ public class ServiceInstances {
}
protected List<Map<String, Object>> configureUserParams(RequestParameters reqParams) throws IOException {
- msoLogger.debug("Configuring UserParams for Macro Request");
+ logger.debug("Configuring UserParams for Macro Request");
Map<String, Object> userParams = new HashMap<>();
for(Map<String, Object> params : reqParams.getUserParams()){
@@ -1789,7 +1793,7 @@ public class ServiceInstances {
testApi = TestApi.valueOf(requestTestApi);
return Optional.of(testApi.getModelName());
} catch (Exception e) {
- msoLogger.warnSimple("Catching the exception on the valueOf enum call and continuing", e);
+ logger.warn("Catching the exception on the valueOf enum call and continuing", e);
throw new IllegalArgumentException("Invalid TestApi is provided", e);
}
}
@@ -1860,7 +1864,7 @@ public class ServiceInstances {
serviceInstanceId = "";
String configurationId = "";
- String correlationId = "";
+ String pnfCorrelationId = "";
if(sir.getServiceInstanceId () != null){
serviceInstanceId = sir.getServiceInstanceId ();
@@ -1870,7 +1874,7 @@ public class ServiceInstances {
configurationId = sir.getConfigurationId();
}
- correlationId = getCorrelationId(sir);
+ pnfCorrelationId = getPnfCorrelationId(sir);
try{
infraActiveRequestsClient.save(currentActiveReq);
@@ -1893,7 +1897,7 @@ public class ServiceInstances {
.setRecipeTimeout(Integer.parseInt(timeOut))
.setRequestAction(action.toString())
.setServiceInstanceId(serviceInstanceId)
- .setCorrelationId(correlationId)
+ .setPnfCorrelationId(pnfCorrelationId)
.setConfigurationId(configurationId)
.setRequestDetails(mapJSONtoMSOStyle(requestJSON, sir, aLaCarte, action))
.setApiVersion(apiVersion)
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java
index f9e6c276ec..0a72cf68ad 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.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
@@ -55,7 +57,8 @@ import org.onap.so.apihandlerinfra.tasksbeans.TasksGetResponse;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
-import org.onap.so.utils.UUIDChecker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@@ -72,7 +75,7 @@ import io.swagger.annotations.ApiOperation;
public class TasksHandler {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH,TasksHandler.class);
+ private static Logger logger = LoggerFactory.getLogger(TasksHandler.class);
@Value("${mso.camunda.rest.task.uri}")
private String requestUrl;
@@ -95,14 +98,9 @@ public class TasksHandler {
@QueryParam("originalRequestDate") String originalRequestDate,
@QueryParam("originalRequestorId") String originalRequestorId,
@PathParam("version") String version) throws ApiException {
- Response responseBack = null;
-
- String requestId = UUIDChecker.generateUUID(msoLogger);
- MsoLogger.setServiceName ("ManualTasksQuery");
- // Generate a Request Id
- UUIDChecker.generateUUID(msoLogger);
+ Response responseBack = null;
String apiVersion = version.substring(1);
-
+
// Prepare the query string to /task interface
TaskVariables tv = new TaskVariables();
@@ -229,13 +227,9 @@ public class TasksHandler {
throw validateException;
}
- return builder.buildResponse(HttpStatus.SC_ACCEPTED, requestId, jsonResponse, apiVersion);
+ return builder.buildResponse(HttpStatus.SC_ACCEPTED, "", jsonResponse, apiVersion);
}
- protected MsoLogger getMsoLogger () {
- return msoLogger;
- }
-
// Makes a GET call to Camunda to get variables for this task
private TaskList getTaskInfo(String taskId) throws ApiException{
TaskList taskList;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java
index d743c440e7..00f1d6889d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java
@@ -4,12 +4,14 @@
* ================================================================================
* 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
- *
+ *
* 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.
@@ -24,6 +26,7 @@ package org.onap.so.apihandlerinfra.tenantisolation;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
+import java.util.UUID;
import javax.inject.Provider;
import javax.transaction.Transactional;
@@ -54,7 +57,8 @@ import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
-import org.onap.so.utils.UUIDChecker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -68,9 +72,9 @@ import io.swagger.annotations.ApiOperation;
@Api(value="/onap/so/infra/cloudResources",description="API Requests for cloud resources - Tenant Isolation")
public class CloudOrchestration {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, CloudOrchestration.class);
+ private static Logger logger = LoggerFactory.getLogger(CloudOrchestration.class);
private static final String ENVIRONMENT_ID_KEY = "operationalEnvironmentId";
-
+
@Autowired
private TenantIsolationRequest tenantIsolationRequest ;
@@ -87,7 +91,7 @@ public class CloudOrchestration {
@ApiOperation(value="Create an Operational Environment",response=Response.class)
@Transactional
public Response createOperationEnvironment(String request, @PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException{
- msoLogger.debug("Received request to Create Operational Environment");
+ logger.debug("Received request to Create Operational Environment");
return cloudOrchestration(request, Action.create, null, version, getRequestId(requestContext));
}
@@ -99,7 +103,7 @@ public class CloudOrchestration {
@Transactional
public Response activateOperationEnvironment(String request, @PathParam("version") String version, @PathParam("operationalEnvironmentId") String operationalEnvironmentId,
@Context ContainerRequestContext requestContext) throws ApiException{
- msoLogger.debug("Received request to Activate an Operational Environment");
+ logger.debug("Received request to Activate an Operational Environment");
HashMap<String, String> instanceIdMap = new HashMap<>();
instanceIdMap.put(ENVIRONMENT_ID_KEY, operationalEnvironmentId);
return cloudOrchestration(request, Action.activate, instanceIdMap, version, getRequestId(requestContext));
@@ -112,7 +116,7 @@ public class CloudOrchestration {
@ApiOperation(value="Deactivate an Operational Environment",response=Response.class)
@Transactional
public Response deactivateOperationEnvironment(String request, @PathParam("version") String version, @PathParam("operationalEnvironmentId") String operationalEnvironmentId, @Context ContainerRequestContext requestContext) throws ApiException{
- msoLogger.debug("Received request to Deactivate an Operational Environment");
+ logger.debug("Received request to Deactivate an Operational Environment");
HashMap<String, String> instanceIdMap = new HashMap<>();
instanceIdMap.put(ENVIRONMENT_ID_KEY, operationalEnvironmentId);
return cloudOrchestration(request, Action.deactivate, instanceIdMap, version, getRequestId(requestContext));
@@ -121,7 +125,7 @@ public class CloudOrchestration {
private Response cloudOrchestration(String requestJSON, Action action, HashMap<String, String> instanceIdMap, String version, String requestId) throws ApiException{
MsoLogger.setLogContext(requestId, null);
- msoLogger.info(MessageEnum.APIH_GENERATED_REQUEST_ID, requestId, "", "");
+ logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId);
long startTime = System.currentTimeMillis ();
CloudOrchestrationRequest cor = null;
tenantIsolationRequest.setRequestId(requestId);
@@ -168,7 +172,7 @@ public class CloudOrchestration {
if(instanceIdMap != null && instanceIdMap.get(ENVIRONMENT_ID_KEY) != null) {
instanceId = instanceIdMap.get(ENVIRONMENT_ID_KEY);
} else {
- instanceId = UUIDChecker.generateUUID(msoLogger);
+ instanceId = UUID.randomUUID().toString();
tenantIsolationRequest.setOperationalEnvironmentId(instanceId);
cor.setOperationalEnvironmentId(instanceId);
}
@@ -217,7 +221,7 @@ public class CloudOrchestration {
private CloudOrchestrationRequest convertJsonToCloudOrchestrationRequest(String requestJSON, Action action, long startTime,
CloudOrchestrationRequest cor) throws ApiException {
try{
- msoLogger.debug("Converting incoming JSON request to Object");
+ logger.debug("Converting incoming JSON request to Object");
ObjectMapper mapper = new ObjectMapper();
return mapper.readValue(requestJSON, CloudOrchestrationRequest.class);
} catch(IOException e){
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java
index 6d8ca96080..377b03c4ab 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.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
@@ -60,7 +62,8 @@ import org.onap.so.exceptions.ValidationException;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
-import org.onap.so.utils.UUIDChecker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -74,7 +77,7 @@ import io.swagger.annotations.ApiOperation;
@Api(value="onap/so/infra/cloudResourcesRequests",description="API GET Requests for cloud resources - Tenant Isolation")
public class CloudResourcesOrchestration {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, CloudResourcesOrchestration.class);
+ private static Logger logger = LoggerFactory.getLogger(CloudResourcesOrchestration.class);
@Autowired
RequestsDbClient requestDbClient;
@@ -94,7 +97,7 @@ public class CloudResourcesOrchestration {
CloudOrchestrationRequest cor = null;
- msoLogger.debug ("requestId is: " + requestId);
+ logger.debug ("requestId is: " + requestId);
try{
ObjectMapper mapper = new ObjectMapper();
@@ -156,7 +159,6 @@ public class CloudResourcesOrchestration {
@Transactional
public Response getOperationEnvironmentStatusFilter(@Context UriInfo ui, @PathParam("version") String version ) throws ApiException{
MsoLogger.setServiceName ("getOperationEnvironmentStatusFilter");
- UUIDChecker.generateUUID(msoLogger);
MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
List<String> requestIdKey = queryParams.get("requestId");
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java
index e75d56e7d3..ace0fb664c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.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
@@ -48,6 +50,8 @@ import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.RequestError;
import org.onap.so.serviceinstancebeans.ServiceException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@@ -62,7 +66,7 @@ import io.swagger.annotations.ApiOperation;
@Api(value="/onap/so/infra/modelDistributions",description="API Requests for Model Distributions")
public class ModelDistributionRequest {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, ModelDistributionRequest.class);
+ private static Logger logger = LoggerFactory.getLogger(ModelDistributionRequest.class);
@Autowired
private Provider<TenantIsolationRunnable> tenantIsolationRunnable;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java
index 855a5433f3..47cbb0c895 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.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
@@ -49,6 +51,8 @@ import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
import org.onap.so.utils.UUIDChecker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@@ -75,7 +79,7 @@ public class TenantIsolationRequest {
@Autowired
private RequestsDbClient requestsDbClient;
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, TenantIsolationRequest.class);
+ private static Logger logger = LoggerFactory.getLogger(TenantIsolationRequest.class);
TenantIsolationRequest (String requestId) {
@@ -351,8 +355,9 @@ public class TenantIsolationRequest {
request.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
requestsDbClient.save(request);
} catch (Exception e) {
- msoLogger.error(MessageEnum.APIH_DB_UPDATE_EXC, e.getMessage(), "", "", MsoLogger.ErrorCode.DataError, "Exception when updating record in DB");
- msoLogger.debug ("Exception: ", e);
+ logger.error("{} {} {} {}", MessageEnum.APIH_DB_UPDATE_EXC.toString(), e.getMessage(),
+ MsoLogger.ErrorCode.DataError.getValue(), "Exception when updating record in DB");
+ logger.debug("Exception: ", e);
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java
index 7ad7e6626d..00ce137ee3 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.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
@@ -35,7 +37,8 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.OperationalEnvironment;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
import org.onap.so.requestsdb.RequestsDBHelper;
-import org.slf4j.MDC;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.scheduling.annotation.Async;
@@ -45,7 +48,7 @@ import org.springframework.stereotype.Component;
@Scope("prototype")
public class TenantIsolationRunnable {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, TenantIsolationRunnable.class);
+ private static final Logger logger = LoggerFactory.getLogger(TenantIsolationRunnable.class);
@Autowired
private RequestsDBHelper requestDb;
@@ -62,8 +65,9 @@ public class TenantIsolationRunnable {
@Async
public void run(Action action, String operationalEnvType, CloudOrchestrationRequest cor, String requestId) throws ApiException {
-
- msoLogger.debug ("Starting threadExecution in TenantIsolationRunnable for Action " + action.name() + " and OperationalEnvType: " + operationalEnvType);
+
+ logger.debug("Starting threadExecution in TenantIsolationRunnable for Action {} and OperationalEnvType: {}",
+ action.name(), operationalEnvType);
try {
if(Action.create.equals(action)) {
@@ -74,7 +78,8 @@ public class TenantIsolationRunnable {
} else {
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
ValidateException validateException = new ValidateException.Builder("Invalid OperationalEnvironment Type specified for Create Action",
- HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo).build();
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo)
+ .build();
throw validateException;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java
index 6a5de77c73..870fa11b5c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.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,14 +36,15 @@ import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.entities.uri.Depth;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
public class AAIClientHelper {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, AAIClientHelper.class);
+ private static Logger logger = LoggerFactory.getLogger(AAIClientHelper.class);
/**
* Get managing ECOMP Environment Info from A&AI
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java
index dcd3a42875..eb0721270d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.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,13 +24,14 @@ package org.onap.so.apihandlerinfra.tenantisolation.helpers;
import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
public class ActivateVnfDBHelper {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, ActivateVnfDBHelper.class);
+ private static Logger logger = LoggerFactory.getLogger(ActivateVnfDBHelper.class);
/**
* Insert record to OperationalEnvServiceModelStatus table
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
index 5ead7ddd7f..9303e12071 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.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
@@ -39,13 +41,15 @@ import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
import org.onap.so.utils.CryptoUtils;
import org.onap.so.utils.TargetEntity;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class SDCClientHelper {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, SDCClientHelper.class);
+ private static Logger logger = LoggerFactory.getLogger(SDCClientHelper.class);
private static final String SDC_CONTENT_TYPE = "application/json";
private static final String SDC_ACCEPT_TYPE = "application/json";
private static String PARTIAL_SDC_URI = "/sdc/v1/catalog/services/";
@@ -106,9 +110,9 @@ public class SDCClientHelper {
sdcResponseJsonObj = enhanceJsonResponse(new JSONObject(responseData), statusCode);
} catch (Exception ex) {
- msoLogger.debug("calling SDC Exception message: " + ex.getMessage());
+ logger.debug("calling SDC Exception message: {}", ex.getMessage());
String errorMessage = " Encountered Error while calling SDC POST Activate. " + ex.getMessage();
- msoLogger.debug(errorMessage);
+ logger.debug(errorMessage);
sdcResponseJsonObj.put("statusCode", String.valueOf(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()));
sdcResponseJsonObj.put("messageId", "");
sdcResponseJsonObj.put("message", errorMessage);
@@ -217,7 +221,7 @@ public class SDCClientHelper {
}
catch (Exception e) {
- msoLogger.debug("Failed to decrypt credentials: " + toDecrypt, e);
+ logger.debug("Failed to decrypt credentials: {}", toDecrypt, e);
}
return result;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
index 1d2a445c40..f70fe71554 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
@@ -50,6 +50,8 @@ import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
import org.onap.so.requestsdb.RequestsDBHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@@ -58,7 +60,7 @@ import org.springframework.stereotype.Component;
@Component
public class ActivateVnfOperationalEnvironment {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, ActivateVnfOperationalEnvironment.class);
+ private static final Logger logger = LoggerFactory.getLogger(ActivateVnfOperationalEnvironment.class);
private static final int DEFAULT_ACTIVATE_RETRY_COUNT = 3;
private static final String DISTRIBUTION_STATUS_SENT = "SENT";
private static final String OPER_ENVIRONMENT_ID_KEY = "operational-environment-id";
@@ -100,12 +102,12 @@ public class ActivateVnfOperationalEnvironment {
ecompOperationalEnvironmentId = operationalEnvironments.get(0).getURIKeys().get(OPER_ENVIRONMENT_ID_KEY);
}
}
- msoLogger.debug(" vnfOperationalEnvironmentId : " + vnfOperationalEnvironmentId);
- msoLogger.debug(" ecompOperationalEnvironmentId : " + ecompOperationalEnvironmentId);
+ logger.debug(" vnfOperationalEnvironmentId : {}", vnfOperationalEnvironmentId);
+ logger.debug(" ecompOperationalEnvironmentId : {}", ecompOperationalEnvironmentId);
OperationalEnvironment operationalEnv = wrapper.asBean(OperationalEnvironment.class).get();
String workloadContext = operationalEnv.getWorkloadContext();
- msoLogger.debug(" aai workloadContext: " + workloadContext);
+ logger.debug(" aai workloadContext: {}", workloadContext);
if (!vidWorkloadContext.equals(workloadContext)) {
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build();
throw new ValidateException.Builder(" The vid workloadContext did not match from aai record. " + " vid workloadContext:" + vidWorkloadContext + " aai workloadContext:" + workloadContext,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
index 66cfd349df..219a2efcac 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.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
@@ -42,13 +44,15 @@ import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
import org.onap.so.requestsdb.RequestsDBHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class ActivateVnfStatusOperationalEnvironment {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, ActivateVnfStatusOperationalEnvironment.class);
+ private static Logger logger = LoggerFactory.getLogger(ActivateVnfStatusOperationalEnvironment.class);
private String origRequestId = "";
private String errorMessage = "";
private OperationalEnvDistributionStatus queryDistributionDbResponse = null;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java
index b09bbae0ad..6ba78aa175 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.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
@@ -32,13 +34,15 @@ import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientObjectBuilde
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
import org.onap.so.requestsdb.RequestsDBHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class CreateEcompOperationalEnvironment {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, CreateEcompOperationalEnvironment.class);
+ private static Logger logger = LoggerFactory.getLogger(CreateEcompOperationalEnvironment.class);
@Autowired
private AAIClientObjectBuilder aaiClientObjectBuilder;
@@ -56,11 +60,12 @@ public class CreateEcompOperationalEnvironment {
// Call client to publish to DMaap
try {
- msoLogger.debug("1" + request.getOperationalEnvironmentId());
- msoLogger.debug("2" + request.getRequestDetails().getRequestInfo().getInstanceName());
- msoLogger.debug("3" + request.getRequestDetails().getRequestParameters().getOperationalEnvironmentType().toString());
- msoLogger.debug("4" + request.getRequestDetails().getRequestParameters().getTenantContext());
- msoLogger.debug("5" + request.getRequestDetails().getRequestParameters().getWorkloadContext());
+ logger.debug("1 {}", request.getOperationalEnvironmentId());
+ logger.debug("2 {}", request.getRequestDetails().getRequestInfo().getInstanceName());
+ logger.debug("3 {}", request.getRequestDetails().getRequestParameters().getOperationalEnvironmentType()
+ .toString());
+ logger.debug("4 {}", request.getRequestDetails().getRequestParameters().getTenantContext());
+ logger.debug("5 {}", request.getRequestDetails().getRequestParameters().getWorkloadContext());
dmaapClient.dmaapPublishOperationalEnvRequest(request.getOperationalEnvironmentId(),
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java
index 36226aae68..2eaba25234 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.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
@@ -48,6 +50,8 @@ import org.onap.so.client.grm.beans.Version;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
import org.onap.so.requestsdb.RequestsDBHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -56,7 +60,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class CreateVnfOperationalEnvironment {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, CreateVnfOperationalEnvironment.class);
+ private static Logger logger = LoggerFactory.getLogger(CreateVnfOperationalEnvironment.class);
protected CloudOrchestrationRequest request;
@Autowired
@@ -78,7 +82,7 @@ public class CreateVnfOperationalEnvironment {
OperationalEnvironment aaiEnv = aaiResultWrapper.asBean(OperationalEnvironment.class).get();
//Find ECOMP environments in GRM
- msoLogger.debug(" Start of GRM findRunningServicesAsString");
+ logger.debug(" Start of GRM findRunningServicesAsString");
String searchKey = getSearchKey(aaiEnv);
String tenantContext = getTenantContext().toUpperCase();
String jsonResponse = getGrmClient().findRunningServicesAsString(searchKey, 1, tenantContext);
@@ -92,7 +96,7 @@ public class CreateVnfOperationalEnvironment {
int ctr = 0;
int total = serviceEndpointRequestList.size();
for (ServiceEndPointRequest requestList : serviceEndpointRequestList) {
- msoLogger.debug("Creating endpoint " + ++ctr + " of " + total + ": " + requestList.getServiceEndPoint().getName());
+ logger.debug("Creating endpoint " + ++ctr + " of " + total + ": " + requestList.getServiceEndPoint().getName());
getGrmClient().addServiceEndPoint(requestList);
}
@@ -137,7 +141,7 @@ public class CreateVnfOperationalEnvironment {
private List<ServiceEndPointRequest> buildEndPointRequestList(ServiceEndPointList serviceEndPointList) throws TenantIsolationException {
List<ServiceEndPoint> endpointList = serviceEndPointList.getServiceEndPointList();
- msoLogger.debug("Number of service endpoints from GRM: " + endpointList.size());
+ logger.debug("Number of service endpoints from GRM: {}", endpointList.size());
List<ServiceEndPointRequest> serviceEndPointRequestList = new ArrayList<ServiceEndPointRequest>();
for(ServiceEndPoint serviceEndpoint : endpointList) {
serviceEndPointRequestList.add(buildServiceEndpoint(serviceEndpoint));
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java
index 977184e2c5..2181215ca7 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.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
@@ -35,13 +37,16 @@ import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
import org.onap.so.requestsdb.RequestsDBHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class DeactivateVnfOperationalEnvironment {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, DeactivateVnfOperationalEnvironment.class);
+ private static Logger logger = LoggerFactory.getLogger(DeactivateVnfOperationalEnvironment
+ .class);
@Autowired
private AAIClientHelper aaiHelper;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java
index a6fdcc958d..5eb3083003 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.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
@@ -25,7 +27,6 @@ import org.onap.so.apihandlerinfra.Action;
import org.onap.so.apihandlerinfra.Actions;
import org.onap.so.apihandlerinfra.Constants;
import org.onap.so.exceptions.ValidationException;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.InstanceDirection;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
@@ -33,11 +34,16 @@ import org.onap.so.serviceinstancebeans.RelatedInstance;
import org.onap.so.serviceinstancebeans.RelatedInstanceList;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.onap.so.utils.UUIDChecker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class RelatedInstancesValidation implements ValidationRule{
- private static boolean empty(String s) {
- return (s == null || s.trim().isEmpty());
- }
+
+ private static Logger logger = LoggerFactory.getLogger(RelatedInstancesValidation.class);
+
+ private static boolean empty(String s) {
+ return (s == null || s.trim().isEmpty());
+ }
@Override
public ValidationInformation validate(ValidationInformation info) throws ValidationException{
ServiceInstancesRequest sir = info.getSir();
@@ -50,7 +56,6 @@ public class RelatedInstancesValidation implements ValidationRule{
String vfModuleType = null;
String vfModuleModelName = null;
ModelInfo modelInfo = info.getSir().getRequestDetails().getModelInfo();
- MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, RelatedInstancesValidation.class);
RelatedInstanceList[] instanceList = sir.getRequestDetails().getRelatedInstanceList();
String serviceModelName = null;
String vnfModelName = null;
@@ -229,7 +234,7 @@ public class RelatedInstancesValidation implements ValidationRule{
(reqVersion >= 4 && (requestScope.equalsIgnoreCase(ModelType.volumeGroup.name ()) || requestScope.equalsIgnoreCase(ModelType.vfModule.name ())) && action == Action.updateInstance ||
(requestScope.equalsIgnoreCase(ModelType.vfModule.name ()) && action == Action.scaleOut)) ||
(requestScope.equalsIgnoreCase(ModelType.service.name()) && (action.equals(Action.addRelationships) || action.equals(Action.removeRelationships)))){
- msoLogger.debug ("related instance exception");
+ logger.debug("related instance exception");
throw new ValidationException ("related instances");
}
if(instanceList == null && requestScope.equalsIgnoreCase(ModelType.instanceGroup.toString()) && action == Action.createInstance){
@@ -242,4 +247,4 @@ public class RelatedInstancesValidation implements ValidationRule{
info.setVfModuleType(vfModuleType);
return info;
}
-} \ No newline at end of file
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java
index 4d4f23c083..54e7b27168 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.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
@@ -20,27 +22,20 @@
package org.onap.so.apihandlerinfra;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.tomakehurst.wiremock.client.WireMock;
import org.junit.After;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
-import org.onap.so.logger.MsoLogger;
-import org.onap.so.logger.MsoLogger.Catalog;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
import org.springframework.core.env.Environment;
-import org.springframework.http.HttpHeaders;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.jdbc.Sql;
-import org.springframework.test.context.jdbc.Sql.ExecutionPhase;
import org.springframework.test.context.junit4.SpringRunner;
import javax.transaction.Transactional;
@@ -55,7 +50,7 @@ import java.nio.file.Paths;
@Transactional
@AutoConfigureWireMock(port = 0)
public abstract class BaseTest {
- protected MsoLogger logger = MsoLogger.getMsoLogger(Catalog.GENERAL, BaseTest.class);
+ protected Logger logger = LoggerFactory.getLogger(BaseTest.class);
protected TestRestTemplate restTemplate = new TestRestTemplate("test", "test");
@Autowired
@@ -90,4 +85,4 @@ public abstract class BaseTest {
public String getTestUrl(String requestId) {
return "/infraActiveRequests/" + requestId;
}
-} \ No newline at end of file
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailedTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailedTest.java
new file mode 100644
index 0000000000..2cb02e9666
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailedTest.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 IBM.
+ * ================================================================================
+ * 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.apihandlerinfra.tenantisolation.exceptions;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.so.apihandlerinfra.BaseTest;
+
+public class AAIClientCallFailedTest extends BaseTest {
+
+ @Test
+ public void testAAIClientCallFailedException() {
+ AAIClientCallFailed aAIClientCallFailed = new AAIClientCallFailed("failed", new Throwable("throwable"));
+ assertEquals("failed", aAIClientCallFailed.getMessage());
+ assertEquals("throwable", aAIClientCallFailed.getCause().getMessage());
+ }
+}