diff options
Diffstat (limited to 'mso-api-handlers')
23 files changed, 220 insertions, 156 deletions
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 a473b0939e..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"; @@ -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(); @@ -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); } } 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 +} |