diff options
author | k.kazak <k.kazak@samsung.com> | 2019-03-12 09:37:14 +0100 |
---|---|---|
committer | Witold Ficio Kopel <w.kopel@samsung.com> | 2019-03-12 10:56:36 +0000 |
commit | 7dc103aaac03a5c4f011fa6eaf251cbf082743bb (patch) | |
tree | adcbdc463d13da171fc35b252b4bf50364b074e6 /bpmn/so-bpmn-infrastructure-common/src/main/groovy/org | |
parent | c068ba17e06cc1aab0616c4ad11f8be8c2d23e45 (diff) |
Remove MsoLogger form BPMN infrastructure scripts
Replaced MsoLogger with plain slf4j.
Refactored loging output.
Fixed imports.
Replaced utils.log() with respective logger calls.
Change-Id: I1154682f58206d6e97ae605f4eb9ba8ef8a10e1f
Issue-ID: LOG-631
Signed-off-by: Witold Ficio Kopel <w.kopel@samsung.com>
Signed-off-by: k.kazak <k.kazak@samsung.com>
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src/main/groovy/org')
76 files changed, 3873 insertions, 3375 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy index a8da95aa7c..f4bdde5e80 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 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 @@ -33,14 +35,15 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory /** * This groovy class supports the <class>ActivateSDNCCNetworkResource.bpmn</class> process. * flow for SDNC Network Resource Activate */ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ActivateSDNCNetworkResource.class); + private static final Logger logger = LoggerFactory.getLogger( ActivateSDNCNetworkResource.class); String Prefix = "ACTSDNCRES_" @@ -53,7 +56,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { MsoUtils msoUtils = new MsoUtils() public void preProcessRequest(DelegateExecution execution) { - msoLogger.info(" ***** Started preProcessRequest *****") + logger.info(" ***** Started preProcessRequest *****") try { //get bpmn inputs from resource request. @@ -125,13 +128,13 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { throw e; } catch (Exception ex){ String msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } public void prepareUpdateAfterActivateSDNCResource(DelegateExecution execution) { - msoLogger.info("started prepareUpdateAfterActivateSDNCResource ") + logger.info("started prepareUpdateAfterActivateSDNCResource ") ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(execution.getVariable(Prefix + "resourceInput"), ResourceInput.class) String operType = resourceInputObj.getOperationType() @@ -188,7 +191,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { } public void prepareSDNCRequest (DelegateExecution execution) { - msoLogger.info("Started prepareSDNCRequest ") + logger.info("Started prepareSDNCRequest ") try { // get variables @@ -397,38 +400,38 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in CreateSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - msoLogger.info(" ***** Exit prepareSDNCRequest *****") + logger.info(" ***** Exit prepareSDNCRequest *****") } public void postActivateSDNCCall(DelegateExecution execution) { - msoLogger.info("started postCreateSDNCCall ") + logger.info("started postCreateSDNCCall ") String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode") String responseObj = execution.getVariable(Prefix + "SuccessIndicator") - msoLogger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj) + logger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj) } public void sendSyncResponse(DelegateExecution execution) { - msoLogger.info("started sendsyncResp") + logger.info("started sendsyncResp") try { String operationStatus = "finished" // RESTResponse for main flow String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) + logger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) sendWorkflowResponse(execution, 202, resourceOperationResp) execution.setVariable("sentSyncResponse", true) } catch (Exception ex) { String msg = "Exception in sendSyncResponse:" + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.info("exited send sync Resp") + logger.info("exited send sync Resp") } -}
\ No newline at end of file +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy index 880a44c1b2..608bf66da9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 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 @@ -31,7 +33,8 @@ import org.onap.so.bpmn.common.scripts.VidUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.domain.CompareModelsResult import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import groovy.json.* @@ -52,7 +55,7 @@ import groovy.json.* * @param - WorkflowException */ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CompareModelofE2EServiceInstance.class); + private static final Logger logger = LoggerFactory.getLogger( CompareModelofE2EServiceInstance.class); String Prefix="CMPMDSI_" private static final String DebugFlag = "isDebugEnabled" @@ -65,17 +68,17 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess execution.setVariable("prefix",Prefix) String msg = "" - msoLogger.trace("preProcessRequest Request ") + logger.trace("preProcessRequest Request ") try { // check for incoming json message/input String siRequest = execution.getVariable("bpmnRequest") - msoLogger.debug(siRequest) + logger.debug(siRequest) String requestId = execution.getVariable("mso-request-id") execution.setVariable("msoRequestId", requestId) - msoLogger.info("Input Request:" + siRequest + " reqId:" + requestId) + logger.info("Input Request:" + siRequest + " reqId:" + requestId) String serviceInstanceId = execution.getVariable("serviceInstanceId") if (isBlank(serviceInstanceId)) { @@ -87,7 +90,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "globalSubscriberId") if (isBlank(globalSubscriberId)) { msg = "Input globalSubscriberId' is null" - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) } else { execution.setVariable("globalSubscriberId", globalSubscriberId) } @@ -96,7 +99,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "serviceType") if (isBlank(subscriptionServiceType)) { msg = "Input subscriptionServiceType is null" - utils.log("DEBUG", msg, isDebugEnabled) + logger.debug( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } else { execution.setVariable("serviceType", subscriptionServiceType) @@ -106,7 +109,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess String modelInvariantIdTarget = jsonUtil.getJsonValue(siRequest, "modelInvariantIdTarget") if (isBlank(modelInvariantIdTarget)) { msg = "Input modelInvariantIdTarget' is null" - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } else { execution.setVariable("modelInvariantIdTarget", modelInvariantIdTarget) @@ -116,7 +119,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess String modelVersionIdTarget = jsonUtil.getJsonValue(siRequest, "modelVersionIdTarget") if (isBlank(modelVersionIdTarget)) { msg = "Input modelVersionIdTarget is null" - utils.log("DEBUG", msg, isDebugEnabled) + logger.debug( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } else { execution.setVariable("modelVersionIdTarget", modelVersionIdTarget) @@ -128,32 +131,32 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit preProcessRequest ") + logger.trace("Exit preProcessRequest ") } public void sendSyncResponse (DelegateExecution execution) { - msoLogger.trace("sendSyncResponse ") + logger.trace("sendSyncResponse ") try { CompareModelsResult compareModelsResult = execution.getVariable("compareModelsResult") // RESTResponse (for API Handler(APIH) Reply Task) String syncResponse = compareModelsResult.toJsonStringNoRootName() - msoLogger.info(" sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse) + logger.info(" sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse) sendWorkflowResponse(execution, 202, syncResponse) } catch (Exception ex) { String msg = "Exception in sendSyncResponse: " + ex.getMessage() exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit sendSyncResopnse ") + logger.trace("Exit sendSyncResopnse ") } public void sendSyncError (DelegateExecution execution) { - msoLogger.trace("sendSyncError ") + logger.trace("sendSyncError ") try { String errorMessage = "" @@ -170,17 +173,17 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess <aetgt:ErrorCode>7000</aetgt:ErrorCode> </aetgt:WorkflowException>""" - msoLogger.debug(buildworkflowException) + logger.debug(buildworkflowException) sendWorkflowResponse(execution, 500, buildworkflowException) } catch (Exception ex) { - msoLogger.info(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + logger.info(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) } } public void prepareCompletionRequest (DelegateExecution execution) { - msoLogger.trace("prepareCompletion ") + logger.trace("prepareCompletion ") try { String requestId = execution.getVariable("msoRequestId") @@ -201,22 +204,22 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) execution.setVariable("completionRequest", xmlMsoCompletionRequest) - msoLogger.info(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + logger.info(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) } catch (Exception ex) { String msg = " Exception in prepareCompletion:" + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit prepareCompletionRequest ") + logger.trace("Exit prepareCompletionRequest ") } public void prepareFalloutRequest(DelegateExecution execution){ - msoLogger.trace("prepareFalloutRequest ") + logger.trace("prepareFalloutRequest ") try { WorkflowException wfex = execution.getVariable("WorkflowException") - msoLogger.info(" Input Workflow Exception: " + wfex.toString()) + logger.info(" Input Workflow Exception: " + wfex.toString()) String requestId = execution.getVariable("msoRequestId") String source = execution.getVariable("source") String requestInfo = @@ -229,7 +232,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) execution.setVariable("falloutRequest", falloutRequest) } catch (Exception ex) { - msoLogger.info("Exception prepareFalloutRequest:" + ex.getMessage()) + logger.info("Exception prepareFalloutRequest:" + ex.getMessage()) String errorException = " Bpmn error encountered in CompareModelofE2EServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() String requestId = execution.getVariable("msoRequestId") String falloutRequest = @@ -249,7 +252,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess execution.setVariable("falloutRequest", falloutRequest) } - msoLogger.trace("Exit prepareFalloutRequest ") + logger.trace("Exit prepareFalloutRequest ") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy index 05fd517e47..c8b48c6703 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 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 @@ -47,7 +49,8 @@ import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory import java.util.Map import java.util.UUID import javax.ws.rs.core.Response -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.camunda.bpm.engine.runtime.Execution import org.camunda.bpm.engine.delegate.BpmnError @@ -68,19 +71,19 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso JsonUtils jsonUtil = new JsonUtils() - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, Create3rdONAPE2EServiceInstance.class) + private static final Logger logger = LoggerFactory.getLogger( Create3rdONAPE2EServiceInstance.class); public void checkSPPartnerInfo (DelegateExecution execution) { - msoLogger.info(" ***** Started checkSPPartnerInfo *****") + logger.info(" ***** Started checkSPPartnerInfo *****") try { //get bpmn inputs from resource request. String requestId = execution.getVariable("mso-request-id") String requestAction = execution.getVariable("requestAction") - msoLogger.info("The requestAction is: " + requestAction) + logger.info("The requestAction is: " + requestAction) String recipeParamsFromRequest = execution.getVariable("recipeParams") - msoLogger.info("The recipeParams is: " + recipeParamsFromRequest) + logger.info("The recipeParams is: " + recipeParamsFromRequest) String resourceInput = execution.getVariable("resourceInput") - msoLogger.info("The resourceInput is: " + resourceInput) + logger.info("The resourceInput is: " + resourceInput) //Get ResourceInput Object ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) String resourceInputPrameters = resourceInputObj.getResourceParameters() @@ -102,7 +105,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso else { is3rdONAPExist = false String msg = "sppartner Url is blank." - msoLogger.debug(msg) + logger.debug(msg) } } if(inputParameters.has("sppartner_providingServiceUuid")) @@ -114,7 +117,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso else { is3rdONAPExist = false String msg = "sppartner providingServiceUuid is blank." - msoLogger.debug(msg) + logger.debug(msg) } if(inputParameters.has("sppartner_providingServiceInvariantUuid")) { @@ -125,7 +128,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso else { is3rdONAPExist = false String msg = "sppartner providingServiceInvarianteUuid is blank." - msoLogger.debug(msg) + logger.debug(msg) } if(inputParameters.has("sppartner_handoverMode")) @@ -137,7 +140,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso else { is3rdONAPExist = false String msg = "sppartner handoverMode is blank." - msoLogger.debug(msg) + logger.debug(msg) } execution.setVariable("Is3rdONAPExist", is3rdONAPExist) @@ -147,13 +150,13 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } catch (Exception ex){ String msg = "Exception in checkSPPartnerInfo " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) // exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } public void checkLocallCall (DelegateExecution execution) { - msoLogger.info(" ***** Started checkLocallCall *****") + logger.info(" ***** Started checkLocallCall *****") try { //Get ResourceInput Object @@ -179,19 +182,19 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } } execution.setVariable(Prefix + "CallSource", callSource) - msoLogger.debug("callSource is: " + callSource ) + logger.debug("callSource is: " + callSource ) execution.setVariable("IsLocalCall", isLocalCall) } catch (Exception ex){ String msg = "Exception in checkLocallCall " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) // exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } public void preProcessRequest(DelegateExecution execution){ - msoLogger.info(" ***** Started preProcessRequest *****") + logger.info(" ***** Started preProcessRequest *****") String msg = "" try { @@ -200,27 +203,27 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String globalSubscriberId = resourceInputObj.getGlobalSubscriberId() if (isBlank(globalSubscriberId)) { msg = "Input globalSubscriberId is null" - msoLogger.error(msg) + logger.error(msg) } //set local variable execution.setVariable("globalSubscriberId", globalSubscriberId) - msoLogger.info("globalSubscriberId:" + globalSubscriberId) + logger.info("globalSubscriberId:" + globalSubscriberId) String serviceType = resourceInputObj.getServiceType() if (isBlank(serviceType)) { msg = "Input serviceType is null" - msoLogger.error(msg) + logger.error(msg) } execution.setVariable("serviceType", serviceType) - msoLogger.info("serviceType:" + serviceType) + logger.info("serviceType:" + serviceType) String resourceName = resourceInputObj.getResourceInstanceName() if (isBlank(resourceName)) { msg = "Input resourceName is null" - msoLogger.error(msg) + logger.error(msg) } execution.setVariable("resourceName", resourceName) - msoLogger.info("resourceName:" + resourceName) + logger.info("resourceName:" + resourceName) int beginIndex = resourceName.indexOf("_") + 1 String serviceInstanceName = resourceName.substring(beginIndex) @@ -229,44 +232,44 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String serviceInstanceId = resourceInputObj.getServiceInstanceId() if (isBlank(serviceInstanceId)) { msg = "Input serviceInstanceId is null" - msoLogger.error(msg) + logger.error(msg) } execution.setVariable(Prefix + "ServiceInstanceId", serviceInstanceId) - msoLogger.info("serviceInstanceId:" + serviceInstanceId) + logger.info("serviceInstanceId:" + serviceInstanceId) String resourceModelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid() if (isBlank(resourceModelInvariantUuid)) { msg = "Input resourceModelInvariantUuid is null" - msoLogger.error(msg) + logger.error(msg) } execution.setVariable(Prefix + "ResourceModelInvariantUuid", resourceModelInvariantUuid) - msoLogger.info("resourceModelInvariantUuid:" + resourceModelInvariantUuid) + logger.info("resourceModelInvariantUuid:" + resourceModelInvariantUuid) String resourceModelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() if (isBlank(resourceModelUuid)) { msg = "Input resourceModelUuid is null" - msoLogger.error(msg) + logger.error(msg) } execution.setVariable(Prefix + "ResourceModelUuid", resourceModelUuid) - msoLogger.info("resourceModelUuid:" + resourceModelUuid) + logger.info("resourceModelUuid:" + resourceModelUuid) String resourceModelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() if (isBlank(resourceModelCustomizationUuid)) { msg = "Input resourceModelCustomizationUuid is null" - msoLogger.error(msg) + logger.error(msg) } execution.setVariable(Prefix + "ResourceModelCustomizationUuid", resourceModelCustomizationUuid) - msoLogger.info("resourceModelCustomizationUuid:" + resourceModelCustomizationUuid) + logger.info("resourceModelCustomizationUuid:" + resourceModelCustomizationUuid) } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) // exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } public void prepareUpdateProgress(DelegateExecution execution) { - msoLogger.info(" ***** Started prepareUpdateProgress *****") + logger.info(" ***** Started prepareUpdateProgress *****") ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") String operType = resourceInputObj.getOperationType() String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() @@ -295,11 +298,11 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso </soapenv:Envelope>""" setProgressUpdateVariables(execution, body) - msoLogger.info(" ***** Exit prepareUpdateProgress *****") + logger.info(" ***** Exit prepareUpdateProgress *****") } public void allocateCrossONAPResource(DelegateExecution execution) { - msoLogger.info(" ***** Started allocateCrossONAPResource *****") + logger.info(" ***** Started allocateCrossONAPResource *****") //get TP links from AAI for SOTN handoverMode only String handoverMode = execution.getVariable(Prefix + "HandoverMode") @@ -333,15 +336,15 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso execution.setVariable(Prefix + "ServiceParameters", inputParameters) } else { - msoLogger.error("No allocated CrossONAPResource found in ServiceParameters") + logger.error("No allocated CrossONAPResource found in ServiceParameters") } } - msoLogger.info("Exit " + allocateCrossONAPResource) + logger.info("Exit " + allocateCrossONAPResource) } public void prepare3rdONAPRequest(DelegateExecution execution) { - msoLogger.info(" ***** Started prepare3rdONAPRequest *****") + logger.info(" ***** Started prepare3rdONAPRequest *****") String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") String extAPIPath = sppartnerUrl + '/serviceOrder' @@ -416,16 +419,16 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String payload = externalAPIUtil.setTemplate(ExternalAPIUtil.PostServiceOrderRequestsTemplate, valueMap) execution.setVariable(Prefix + "Payload", payload) - msoLogger.info("Exit " + prepare3rdONAPRequest) + logger.info("Exit " + prepare3rdONAPRequest) } public void doCreateE2ESIin3rdONAP(DelegateExecution execution) { - msoLogger.info(" ***** Started doCreateE2ESIin3rdONAP *****") + logger.info(" ***** Started doCreateE2ESIin3rdONAP *****") try { String extAPIPath = execution.getVariable("ExternalAPIURL") String payload = execution.getVariable(Prefix + "Payload") - msoLogger.debug("doCreateE2ESIin3rdONAP externalAPIURL is: " + extAPIPath) - msoLogger.debug("doCreateE2ESIin3rdONAP payload is: " + payload) + logger.debug("doCreateE2ESIin3rdONAP externalAPIURL is: " + extAPIPath) + logger.debug("doCreateE2ESIin3rdONAP payload is: " + payload) ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create() execution.setVariable("ServiceOrderId", "") @@ -434,43 +437,43 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso int responseCode = response.getStatus() execution.setVariable(Prefix + "PostServiceOrderResponseCode", responseCode) - msoLogger.debug("Post ServiceOrder response code is: " + responseCode) + logger.debug("Post ServiceOrder response code is: " + responseCode) String extApiResponse = response.readEntity(String.class) JSONObject responseObj = new JSONObject(extApiResponse) execution.setVariable(Prefix + "PostServiceOrderResponse", extApiResponse) - msoLogger.debug("doCreateE2ESIin3rdONAP response body is: " + extApiResponse) + logger.debug("doCreateE2ESIin3rdONAP response body is: " + extApiResponse) //Process Response if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) //200 OK 201 CREATED 202 ACCEPTED { - msoLogger.debug("Post ServiceOrder Received a Good Response") + logger.debug("Post ServiceOrder Received a Good Response") String serviceOrderId = responseObj.get("id") execution.setVariable(Prefix + "SuccessIndicator", true) execution.setVariable("ServiceOrderId", serviceOrderId) - msoLogger.info("Post ServiceOrderid is: " + serviceOrderId) + logger.info("Post ServiceOrderid is: " + serviceOrderId) } else{ - msoLogger.error("Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) + logger.error("Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) // exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Post ServiceOrder Received a bad response from 3rdONAP External API") } }catch(Exception e){ - msoLogger.error("doCreateE2ESIin3rdONAP exception:" + e.getMessage()) + logger.error("doCreateE2ESIin3rdONAP exception:" + e.getMessage()) } - msoLogger.info("Exit " + doCreateE2ESIin3rdONAP) + logger.info("Exit " + doCreateE2ESIin3rdONAP) } public void getE2ESIProgressin3rdONAP(DelegateExecution execution) { - msoLogger.info(" ***** Started getE2ESIProgressin3rdONAP *****") + logger.info(" ***** Started getE2ESIProgressin3rdONAP *****") try { String extAPIPath = execution.getVariable("ExternalAPIURL") extAPIPath += "/" + execution.getVariable("ServiceOrderId") - msoLogger.debug("getE2ESIProgressin3rdONAP create externalAPIURL is: " + extAPIPath) + logger.debug("getE2ESIProgressin3rdONAP create externalAPIURL is: " + extAPIPath) ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create() @@ -478,18 +481,18 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso int responseCode = response.getStatus() execution.setVariable(Prefix + "GetServiceOrderResponseCode", responseCode) - msoLogger.debug("Get ServiceOrder response code is: " + responseCode) + logger.debug("Get ServiceOrder response code is: " + responseCode) String extApiResponse = response.readEntity(String.class) JSONObject responseObj = new JSONObject(extApiResponse) execution.setVariable(Prefix + "GetServiceOrderResponse", extApiResponse) - msoLogger.debug("getE2ESIProgressin3rdONAP create response body is: " + extApiResponse) + logger.debug("getE2ESIProgressin3rdONAP create response body is: " + extApiResponse) //Process Response //200 OK 201 CREATED 202 ACCEPTED if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) { - msoLogger.debug("Get Create ServiceOrder Received a Good Response") + logger.debug("Get Create ServiceOrder Received a Good Response") String orderState = responseObj.get("state") if("REJECTED".equalsIgnoreCase(orderState)) { @@ -507,7 +510,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso execution.setVariable("progress", 100) execution.setVariable("status", "error") execution.setVariable("statusDescription", "Create Service Order Status get null sppartnerServiceId") - msoLogger.error("null sppartnerServiceId while getting progress from externalAPI") + logger.error("null sppartnerServiceId while getting progress from externalAPI") return } @@ -545,7 +548,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } } else{ - msoLogger.debug("Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) + logger.debug("Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) execution.setVariable("progress", 100) execution.setVariable("status", "error") execution.setVariable("statusDescription", "Get Create ServiceOrder Received a bad response") @@ -556,9 +559,9 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso execution.setVariable("progress", 100) execution.setVariable("status", "error") execution.setVariable("statusDescription", "Get Create ServiceOrder Exception") - msoLogger.error("getE2ESIProgressin3rdONAP exception:" + e.getMessage()) + logger.error("getE2ESIProgressin3rdONAP exception:" + e.getMessage()) } - msoLogger.info("Exit " + getE2ESIProgressin3rdONAP) + logger.info("Exit " + getE2ESIProgressin3rdONAP) } /** @@ -568,12 +571,12 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso try { Thread.sleep(5000) } catch(InterruptedException e) { - msoLogger.error("Time Delay exception" + e) + logger.error("Time Delay exception" + e) } } public void saveSPPartnerInAAI(DelegateExecution execution) { - msoLogger.info(" ***** Started saveSPPartnerInAAI *****") + logger.info(" ***** Started saveSPPartnerInAAI *****") try { String sppartnerId = execution.getVariable(Prefix + "SppartnerServiceId") String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") @@ -601,10 +604,10 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso client.connect(uri, siUri) } catch (Exception ex) { String msg = "Exception in Create3rdONAPE2EServiceInstance.saveSPPartnerInAAI. " + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) // throw new BpmnError("MSOWorkflowException") } - msoLogger.info("Exit " + saveSPPartnerInAAI) + logger.info("Exit " + saveSPPartnerInAAI) } private void setProgressUpdateVariables(DelegateExecution execution, String body) { @@ -614,30 +617,30 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } public void postProcess(DelegateExecution execution){ - msoLogger.info(" ***** Started postProcess *****") + logger.info(" ***** Started postProcess *****") String responseCode = execution.getVariable(Prefix + "PutSppartnerResponseCode") String responseObj = execution.getVariable(Prefix + "PutSppartnerResponse") - msoLogger.info("response from AAI for put sppartner, response code :" + responseCode + " response object :" + responseObj) - msoLogger.info(" ***** Exit postProcess *****") + logger.info("response from AAI for put sppartner, response code :" + responseCode + " response object :" + responseObj) + logger.info(" ***** Exit postProcess *****") } public void sendSyncResponse (DelegateExecution execution) { - msoLogger.debug(" *** sendSyncResponse *** ") + logger.debug(" *** sendSyncResponse *** ") try { String operationStatus = "finished" // RESTResponse for main flow String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) + logger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) sendWorkflowResponse(execution, 202, resourceOperationResp) execution.setVariable("sentSyncResponse", true) } catch (Exception ex) { String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) // exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.debug(" ***** Exit sendSyncResopnse *****") + logger.debug(" ***** Exit sendSyncResopnse *****") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy index 02ae6a6f48..0c8477ca20 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy @@ -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 @@ -34,6 +36,8 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils import groovy.json.* @@ -47,27 +51,27 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor String Prefix="CRESI_" ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateCustomE2EServiceInstance.class); + private static final Logger logger = LoggerFactory.getLogger( CreateCustomE2EServiceInstance.class); public void preProcessRequest (DelegateExecution execution) { - msoLogger.trace("start preProcessRequest") + logger.trace("start preProcessRequest") execution.setVariable("prefix",Prefix) String msg = "" try { String siRequest = execution.getVariable("bpmnRequest") - msoLogger.debug(siRequest) + logger.debug(siRequest) String requestId = execution.getVariable("mso-request-id") execution.setVariable("msoRequestId", requestId) - msoLogger.debug("Input Request:" + siRequest + " reqId:" + requestId) + logger.debug("Input Request:" + siRequest + " reqId:" + requestId) String serviceInstanceId = execution.getVariable("serviceInstanceId") if (isBlank(serviceInstanceId)) { serviceInstanceId = UUID.randomUUID().toString() } - msoLogger.debug("Generated new Service Instance:" + serviceInstanceId) + logger.debug("Generated new Service Instance:" + serviceInstanceId) serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8") execution.setVariable("serviceInstanceId", serviceInstanceId) @@ -88,7 +92,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor if (isBlank(productFamilyId)) { msg = "Input productFamilyId is null" - msoLogger.debug(msg) + logger.debug(msg) //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } else { execution.setVariable("productFamilyId", productFamilyId) @@ -98,20 +102,20 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") if (isBlank(serviceModelInfo)) { msg = "Input serviceModelInfo is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } else { execution.setVariable("serviceModelInfo", serviceModelInfo) } - msoLogger.debug("modelInfo: " + serviceModelInfo) + logger.debug("modelInfo: " + serviceModelInfo) //requestParameters String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType") if (isBlank(subscriptionServiceType)) { msg = "Input subscriptionServiceType is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } else { execution.setVariable("subscriptionServiceType", subscriptionServiceType) @@ -137,7 +141,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor } } - msoLogger.debug("User Input Parameters map: " + inputMap.toString()) + logger.debug("User Input Parameters map: " + inputMap.toString()) execution.setVariable("serviceInputParams", inputMap) execution.setVariable("uuiRequest", inputMap.get("UUIRequest")) @@ -148,33 +152,33 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("finished preProcessRequest") + logger.trace("finished preProcessRequest") } public void sendSyncResponse (DelegateExecution execution) { - msoLogger.trace("start sendSyncResponse") + logger.trace("start sendSyncResponse") try { String operationId = execution.getVariable("operationId") String serviceInstanceId = execution.getVariable("serviceInstanceId") // RESTResponse for API Handler (APIH) Reply Task String createServiceRestRequest = """{"service":{"serviceId":"${serviceInstanceId}","operationId":"${operationId}"}}""".trim() - msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + createServiceRestRequest) + logger.debug(" sendSyncResponse to APIH:" + "\n" + createServiceRestRequest) sendWorkflowResponse(execution, 202, createServiceRestRequest) execution.setVariable("sentSyncResponse", true) } catch (Exception ex) { String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("finished sendSyncResponse") + logger.trace("finished sendSyncResponse") } public void sendSyncError (DelegateExecution execution) { - msoLogger.trace("start sendSyncError") + logger.trace("start sendSyncError") try { String errorMessage = "" if (execution.getVariable("WorkflowException") instanceof WorkflowException) { @@ -190,17 +194,17 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor <aetgt:ErrorCode>7000</aetgt:ErrorCode> </aetgt:WorkflowException>""" - msoLogger.debug(buildworkflowException) + logger.debug(buildworkflowException) sendWorkflowResponse(execution, 500, buildworkflowException) } catch (Exception ex) { - msoLogger.debug("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + logger.debug("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) } - msoLogger.trace("finished sendSyncError") + logger.trace("finished sendSyncError") } public void prepareCompletionRequest (DelegateExecution execution) { - msoLogger.trace("start prepareCompletionRequest") + logger.trace("start prepareCompletionRequest") try { String requestId = execution.getVariable("msoRequestId") String serviceInstanceId = execution.getVariable("serviceInstanceId") @@ -223,21 +227,21 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) execution.setVariable("completionRequest", xmlMsoCompletionRequest) - msoLogger.debug("Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + logger.debug("Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) } catch (Exception ex) { String msg = " Exception in prepareCompletion:" + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("finished prepareCompletionRequest") + logger.trace("finished prepareCompletionRequest") } public void prepareFalloutRequest(DelegateExecution execution){ - msoLogger.trace("start prepareFalloutRequest") + logger.trace("start prepareFalloutRequest") try { WorkflowException wfex = execution.getVariable("WorkflowException") - msoLogger.debug("Input Workflow Exception: " + wfex.toString()) + logger.debug("Input Workflow Exception: " + wfex.toString()) String requestId = execution.getVariable("msoRequestId") String source = execution.getVariable("source") String requestInfo = @@ -250,7 +254,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) execution.setVariable("falloutRequest", falloutRequest) } catch (Exception ex) { - msoLogger.debug("Exception prepareFalloutRequest:" + ex.getMessage()) + logger.debug("Exception prepareFalloutRequest:" + ex.getMessage()) String errorException = " Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() String requestId = execution.getVariable("msoRequestId") String falloutRequest = @@ -270,14 +274,14 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor execution.setVariable("falloutRequest", falloutRequest) } - msoLogger.trace("finished prepareFalloutRequest") + logger.trace("finished prepareFalloutRequest") } /** * Init the service Operation Status */ public void prepareInitServiceOperationStatus(DelegateExecution execution){ - msoLogger.trace("start prepareInitServiceOperationStatus") + logger.trace("start prepareInitServiceOperationStatus") try{ String serviceId = execution.getVariable("serviceInstanceId") String operationId = UUID.randomUUID().toString() @@ -287,7 +291,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor String progress = "0" String reason = "" String operationContent = "Prepare service creation" - msoLogger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId) + logger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId) serviceId = UriUtils.encode(serviceId,"UTF-8") execution.setVariable("serviceInstanceId", serviceId) execution.setVariable("operationId", operationId) @@ -295,7 +299,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint",execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - msoLogger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint) + logger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint) String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" @@ -317,15 +321,16 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor payload = utils.formatXml(payload) execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) - msoLogger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload) - msoLogger.debug("CreateVfModuleInfra Outgoing updateServiceOperStatusRequest Request: " + payload) + logger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload) + logger.debug("CreateVfModuleInfra Outgoing updateServiceOperStatusRequest Request: " + payload) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) } - msoLogger.trace("finished prepareInitServiceOperationStatus") + logger.trace("finished prepareInitServiceOperationStatus") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy index 489e77e88e..493af2de6a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 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 @@ -36,7 +38,8 @@ import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import java.util.UUID; @@ -59,21 +62,21 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { JsonUtils jsonUtil = new JsonUtils() - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateDeviceResource.class) + private static final Logger logger = LoggerFactory.getLogger( CreateDeviceResource.class); public void preProcessRequest(DelegateExecution execution){ - msoLogger.info(" ***** Started preProcessRequest *****") + logger.info(" ***** Started preProcessRequest *****") String msg = "" try { //get bpmn inputs from resource request. String requestId = execution.getVariable("mso-request-id") String requestAction = execution.getVariable("requestAction") - msoLogger.info("The requestAction is: " + requestAction) + logger.info("The requestAction is: " + requestAction) String recipeParamsFromRequest = execution.getVariable("recipeParams") - msoLogger.info("The recipeParams is: " + recipeParamsFromRequest) + logger.info("The recipeParams is: " + recipeParamsFromRequest) String resourceInput = execution.getVariable("resourceInput") - msoLogger.info("The resourceInput is: " + resourceInput) + logger.info("The resourceInput is: " + resourceInput) //Get ResourceInput Object ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) execution.setVariable(Prefix + "ResourceInput", resourceInputObj) @@ -94,47 +97,47 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { String resourceName = resourceInputObj.getResourceInstanceName() if (isBlank(resourceName)) { msg = "Input resourceName is null" - msoLogger.error(msg) + logger.error(msg) } execution.setVariable("resourceName", resourceName) - msoLogger.info("resourceName:" + resourceName) + logger.info("resourceName:" + resourceName) String resourceModelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid() if (isBlank(resourceModelInvariantUuid)) { msg = "Input resourceModelInvariantUuid is null" - msoLogger.error(msg) + logger.error(msg) } execution.setVariable(Prefix + "ResourceModelInvariantUuid", resourceModelInvariantUuid) - msoLogger.info("resourceModelInvariantUuid:" + resourceModelInvariantUuid) + logger.info("resourceModelInvariantUuid:" + resourceModelInvariantUuid) String resourceModelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() if (isBlank(resourceModelUuid)) { msg = "Input resourceModelUuid is null" - msoLogger.error(msg) + logger.error(msg) } execution.setVariable(Prefix + "ResourceModelUuid", resourceModelUuid) - msoLogger.info("resourceModelUuid:" + resourceModelUuid) + logger.info("resourceModelUuid:" + resourceModelUuid) String resourceModelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() if (isBlank(resourceModelCustomizationUuid)) { msg = "Input resourceModelCustomizationUuid is null" - msoLogger.error(msg) + logger.error(msg) } execution.setVariable(Prefix + "ResourceModelCustomizationUuid", resourceModelCustomizationUuid) - msoLogger.info("resourceModelCustomizationUuid:" + resourceModelCustomizationUuid) + logger.info("resourceModelCustomizationUuid:" + resourceModelCustomizationUuid) execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) execution.setVariable("mso-request-id", requestId) } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) // exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } public void checkDevType(DelegateExecution execution){ - msoLogger.info(" ***** Started checkDevType *****") + logger.info(" ***** Started checkDevType *****") try { JSONObject resourceInputParameters = execution.getVariable(Prefix + "ResourceRequestInputs") @@ -148,7 +151,7 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { } catch (Exception ex){ String msg = "Exception in checkDevType " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) // exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } @@ -160,7 +163,7 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { } public void prepareUpdateProgress(DelegateExecution execution) { - msoLogger.info(" ***** Started prepareUpdateProgress *****") + logger.info(" ***** Started prepareUpdateProgress *****") ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") String operType = resourceInputObj.getOperationType() String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() @@ -189,25 +192,25 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { </soapenv:Envelope>""" setProgressUpdateVariables(execution, body) - msoLogger.info(" ***** Exit prepareUpdateProgress *****") + logger.info(" ***** Exit prepareUpdateProgress *****") } private void getVNFTemplatefromSDC(DelegateExecution execution){ - msoLogger.info(" ***** Started getVNFTemplatefromSDC *****") + logger.info(" ***** Started getVNFTemplatefromSDC *****") try { // To do } catch (Exception ex){ String msg = "Exception in getVNFTemplatefromSDC " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) // exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } public void prepareVnfAndModulesCreate(DelegateExecution execution) { try { - msoLogger.trace("Inside prepareVnfAndModulesCreate of CreateDeviceResource ") + logger.trace("Inside prepareVnfAndModulesCreate of CreateDeviceResource ") JSONObject resourceInputParameters = execution.getVariable(Prefix + "ResourceRequestInputs") String devType = resourceInputParameters.get("device_type") @@ -221,30 +224,30 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { String vnfModelInfoString = null; if (vnf != null) { - msoLogger.debug("getting model info for vnf # " + vnfsCreatedCount) + logger.debug("getting model info for vnf # " + vnfsCreatedCount) ModelInfo vnfModelInfo = vnf.getModelInfo() vnfModelInfoString = vnfModelInfo.toString() } else { - msoLogger.debug("vnf is null") + logger.debug("vnf is null") vnfModelInfoString = execution.getVariable("vnfModelInfo") } - msoLogger.debug(" vnfModelInfoString :" + vnfModelInfoString) + logger.debug(" vnfModelInfoString :" + vnfModelInfoString) // extract cloud configuration // String vimId = jsonUtil.getJsonValue(createVcpeServiceRequest, // "requestDetails.cloudConfiguration.lcpCloudRegionId") // def cloudRegion = vimId.split("_") // execution.setVariable("cloudOwner", cloudRegion[0]) -// msoLogger.debug("cloudOwner: "+ cloudRegion[0]) +// logger.debug("cloudOwner: "+ cloudRegion[0]) // execution.setVariable("cloudRegionId", cloudRegion[1]) -// msoLogger.debug("cloudRegionId: "+ cloudRegion[1]) +// logger.debug("cloudRegionId: "+ cloudRegion[1]) // execution.setVariable("lcpCloudRegionId", cloudRegion[1]) -// msoLogger.debug("lcpCloudRegionId: "+ cloudRegion[1]) +// logger.debug("lcpCloudRegionId: "+ cloudRegion[1]) // String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest, // "requestDetails.cloudConfiguration.tenantId") // execution.setVariable("tenantId", tenantId) -// msoLogger.debug("tenantId: " + tenantId) +// logger.debug("tenantId: " + tenantId) execution.setVariable("cloudOwner", "") @@ -256,13 +259,13 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { execution.setVariable("tenantId", "") String sdncVersion = execution.getVariable("sdncVersion") - msoLogger.debug("sdncVersion: " + sdncVersion) + logger.debug("sdncVersion: " + sdncVersion) - msoLogger.trace("Completed prepareVnfAndModulesCreate of CreateVcpeResCustService ") + logger.trace("Completed prepareVnfAndModulesCreate of CreateVcpeResCustService ") } catch (Exception ex) { // try error in method block String exceptionMessage = "Bpmn error encountered in CreateDeviceResource flow. Unexpected Error from method prepareVnfAndModulesCreate() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) } } @@ -272,7 +275,7 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { public void validateVnfCreate(DelegateExecution execution) { try { - msoLogger.trace("Inside validateVnfCreate of CreateDeviceResource ") + logger.trace("Inside validateVnfCreate of CreateDeviceResource ") //Update Relationship between VNF to Device addVNFAAIRelationShip(execution) @@ -282,45 +285,45 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "VnfsCreatedCount", vnfsCreatedCount) - msoLogger.debug(" ***** Completed validateVnfCreate of CreateDeviceResource ***** " + " vnf # " + vnfsCreatedCount) + logger.debug(" ***** Completed validateVnfCreate of CreateDeviceResource ***** " + " vnf # " + vnfsCreatedCount) } catch (Exception ex) { // try error in method block String exceptionMessage = "Bpmn error encountered in CreateDeviceResource flow. Unexpected Error from method validateVnfCreate() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) } } public void addVNFAAIRelationShip(DelegateExecution execution) { try { - msoLogger.trace("Inside addVNFAAIRelationShip of CreateDeviceResource ") + logger.trace("Inside addVNFAAIRelationShip of CreateDeviceResource ") - msoLogger.debug(" ***** Completed addVNFAAIRelationShip of CreateDeviceResource ***** ") + logger.debug(" ***** Completed addVNFAAIRelationShip of CreateDeviceResource ***** ") } catch (Exception ex) { // try error in method block String exceptionMessage = "Bpmn error encountered in CreateDeviceResource flow. Unexpected Error from method addVNFAAIRelationShip() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) } } public void sendSyncResponse (DelegateExecution execution) { - msoLogger.debug(" *** sendSyncResponse *** ") + logger.debug(" *** sendSyncResponse *** ") try { String operationStatus = "finished" // RESTResponse for main flow String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) + logger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) sendWorkflowResponse(execution, 202, resourceOperationResp) execution.setVariable("sentSyncResponse", true) } catch (Exception ex) { String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) // exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - utils.log("DEBUG"," ***** Exit sendSyncResopnse *****") + logger.debug(" ***** Exit sendSyncResopnse *****") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy index 848785e5f3..6f5f5b3290 100755 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy @@ -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.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils import groovy.json.* @@ -49,7 +52,7 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro String Prefix="CRESI_" ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateGenericALaCarteServiceInstance.class); + private static final Logger logger = LoggerFactory.getLogger( CreateGenericALaCarteServiceInstance.class); public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") @@ -59,18 +62,18 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro try { String siRequest = execution.getVariable("bpmnRequest") - msoLogger.debug(siRequest) + logger.debug(siRequest) String requestId = execution.getVariable("mso-request-id") execution.setVariable("msoRequestId", requestId) - msoLogger.debug("Input Request:" + siRequest + " reqId:" + requestId) + logger.debug("Input Request:" + siRequest + " reqId:" + requestId) String serviceInstanceId = execution.getVariable("serviceInstanceId") if (isBlank(serviceInstanceId)) { serviceInstanceId = UUID.randomUUID().toString() - msoLogger.debug("Generated new Service Instance ID:" + serviceInstanceId) + logger.debug("Generated new Service Instance ID:" + serviceInstanceId) } else { - msoLogger.debug("Using provided Service Instance ID:" + serviceInstanceId) + logger.debug("Using provided Service Instance ID:" + serviceInstanceId) } serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8") @@ -98,7 +101,7 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro if (isBlank(productFamilyId)) { msg = "Input productFamilyId is null" - msoLogger.debug(msg) + logger.debug(msg) //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } else { execution.setVariable("productFamilyId", productFamilyId) @@ -108,20 +111,20 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") if (isBlank(serviceModelInfo)) { msg = "Input serviceModelInfo is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } else { execution.setVariable("serviceModelInfo", serviceModelInfo) } - msoLogger.debug("modelInfo" + serviceModelInfo) + logger.debug("modelInfo" + serviceModelInfo) //requestParameters String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType") if (isBlank(subscriptionServiceType)) { msg = "Input subscriptionServiceType is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } else { execution.setVariable("subscriptionServiceType", subscriptionServiceType) @@ -144,7 +147,7 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro userParams.each { userParam -> if ("Customer_Location".equals(userParam?.name)) { - msoLogger.debug("User Input customerLocation: " + userParam.value.toString()) + logger.debug("User Input customerLocation: " + userParam.value.toString()) Map<String, String> customerMap = [:] userParam.value.each { param -> @@ -155,14 +158,14 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro execution.setVariable("customerLocation", customerMap) } if ("Homing_Solution".equals(userParam?.name)) { - msoLogger.debug("User Input Homing_Solution: " + userParam.value.toString()) + logger.debug("User Input Homing_Solution: " + userParam.value.toString()) execution.setVariable("homingService", userParam.value) execution.setVariable("callHoming", true) inputMap.put("Homing_Solution", userParam.value) } if (!"Homing_Solution".equals(userParam?.name) && !"Customer_Location".equals(userParam?.name)) { - msoLogger.debug("User Input Parameter " + userParam.name + ": " + userParam.value.toString()) + logger.debug("User Input Parameter " + userParam.name + ": " + userParam.value.toString()) inputMap.put(userParam.name, userParam.value) } if ("Orchestrator".equalsIgnoreCase(userParam?.name)) { @@ -172,8 +175,8 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro } } - msoLogger.debug("User Input Parameters map: " + userParams.toString()) - msoLogger.debug("User Input Map: " + inputMap.toString()) + logger.debug("User Input Parameters map: " + userParams.toString()) + logger.debug("User Input Map: " + inputMap.toString()) if (inputMap.toString() != "[:]") { execution.setVariable("serviceInputParams", inputMap) } @@ -185,37 +188,37 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit preProcessRequest") + logger.trace("Exit preProcessRequest") } public void sendSyncResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("Start sendSyncResponse") + logger.trace("Start sendSyncResponse") try { String requestId = execution.getVariable("msoRequestId") String serviceInstanceId = execution.getVariable("serviceInstanceId") // RESTResponse for API Handler (APIH) Reply Task String createServiceRestRequest = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() - msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + createServiceRestRequest) + logger.debug(" sendSyncResponse to APIH:" + "\n" + createServiceRestRequest) sendWorkflowResponse(execution, 202, createServiceRestRequest) execution.setVariable("sentSyncResponse", true) } catch (Exception ex) { String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit sendSyncResopnse") + logger.trace("Exit sendSyncResopnse") } public void sendSyncError (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("Start sendSyncError") + logger.trace("Start sendSyncError") try { String errorMessage = "" @@ -232,11 +235,11 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro <aetgt:ErrorCode>7000</aetgt:ErrorCode> </aetgt:WorkflowException>""" - msoLogger.debug(buildworkflowException) + logger.debug(buildworkflowException) sendWorkflowResponse(execution, 500, buildworkflowException) } catch (Exception ex) { - msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + logger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) } } @@ -246,7 +249,7 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro // ******************************* public void prepareDecomposeService(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("Inside prepareDecomposeService of CreateGenericALaCarteServiceInstance ") + logger.trace("Inside prepareDecomposeService of CreateGenericALaCarteServiceInstance ") try { String siRequest = execution.getVariable("bpmnRequest") String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") @@ -256,13 +259,13 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - msoLogger.trace("Completed prepareDecomposeService of CreateGenericALaCarteServiceInstance") + logger.trace("Completed prepareDecomposeService of CreateGenericALaCarteServiceInstance") } public void processDecomposition(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - msoLogger.trace("Inside processDecomposition() of CreateGenericALaCarteServiceInstance ") + logger.trace("Inside processDecomposition() of CreateGenericALaCarteServiceInstance ") try { @@ -278,7 +281,7 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro String vnfModelInfoString = "" if (vnfList != null && vnfList.size() > 0) { execution.setVariable(Prefix + "VNFsCount", vnfList.size()) - msoLogger.debug("vnfs to create: " + vnfList.size()) + logger.debug("vnfs to create: " + vnfList.size()) ModelInfo vnfModelInfo = vnfList[0].getModelInfo() vnfModelInfoString = vnfModelInfo.toString() @@ -286,18 +289,18 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro vnfModelInfoString = jsonUtil.getJsonValue(vnfModelInfoWithRoot, "modelInfo") } else { execution.setVariable(Prefix + "VNFsCount", 0) - msoLogger.debug("no vnfs to create based upon serviceDecomposition content") + logger.debug("no vnfs to create based upon serviceDecomposition content") } execution.setVariable("vnfModelInfo", vnfModelInfoString) execution.setVariable("vnfModelInfoString", vnfModelInfoString) - msoLogger.debug(" vnfModelInfoString :" + vnfModelInfoString) + logger.debug(" vnfModelInfoString :" + vnfModelInfoString) - msoLogger.trace("Completed processDecomposition() of CreateGenericALaCarteServiceInstance ") + logger.trace("Completed processDecomposition() of CreateGenericALaCarteServiceInstance ") } catch (Exception ex) { sendSyncError(execution) String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. processDecomposition() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } } @@ -309,7 +312,7 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro def isDebugEnabled=execution.getVariable("isDebugLogEnabled") try { - msoLogger.trace("Inside prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance") + logger.trace("Inside prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance") /* * Extracting User Parameters from incoming Request and converting into a Map @@ -327,7 +330,7 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro userParams.each { userParam -> if ("Customer_Location".equals(userParam?.name)) { - msoLogger.debug("User Input customerLocation: " + userParam.value.toString()) + logger.debug("User Input customerLocation: " + userParam.value.toString()) Map<String, String> customerMap = [:] userParam.value.each { param -> @@ -338,14 +341,14 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro execution.setVariable("customerLocation", customerMap) } if ("Homing_Solution".equals(userParam?.name)) { - msoLogger.debug("User Input Homing_Solution: " + userParam.value.toString()) + logger.debug("User Input Homing_Solution: " + userParam.value.toString()) execution.setVariable("homingService", userParam.value) execution.setVariable("callHoming", true) inputMap.put("Homing_Solution", userParam.value) } if (!"Homing_Solution".equals(userParam?.name) && !"Customer_Location".equals(userParam?.name)) { - msoLogger.debug("User Input Parameter " + userParam.name + ": " + userParam.value.toString()) + logger.debug("User Input Parameter " + userParam.name + ": " + userParam.value.toString()) inputMap.put(userParam.name, userParam.value) } if ("Orchestrator".equalsIgnoreCase(userParam?.name)) { @@ -355,8 +358,8 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro } } - msoLogger.debug("User Input Parameters map: " + userParams.toString()) - msoLogger.debug("User Input Map: " + inputMap.toString()) + logger.debug("User Input Parameters map: " + userParams.toString()) + logger.debug("User Input Map: " + inputMap.toString()) if (inputMap.toString() != "[:]") { execution.setVariable("serviceInputParams", inputMap) } @@ -370,9 +373,9 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro execution.setVariable("serviceInstanceName", serviceInstanceName) execution.setVariable("serviceDecomposition", serviceDecomposition) execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonString()) - msoLogger.debug("serviceDecomposition.serviceInstanceName: " + serviceDecomposition.getServiceInstance().getInstanceName()) + logger.debug("serviceDecomposition.serviceInstanceName: " + serviceDecomposition.getServiceInstance().getInstanceName()) - msoLogger.trace("Completed prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance ***** ") + logger.trace("Completed prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance ***** ") } catch (Exception ex) { // try error in method block String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() @@ -383,7 +386,7 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro public void prepareCompletionRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("prepareCompletion *** ") + logger.trace("prepareCompletion *** ") try { String requestId = execution.getVariable("msoRequestId") @@ -407,23 +410,23 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) execution.setVariable("completionRequest", xmlMsoCompletionRequest) - msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + logger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) } catch (Exception ex) { String msg = " Exception in prepareCompletion:" + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit prepareCompletionRequest") + logger.trace("Exit prepareCompletionRequest") } public void prepareFalloutRequest(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("prepareFalloutRequest") + logger.trace("prepareFalloutRequest") try { WorkflowException wfex = execution.getVariable("WorkflowException") - msoLogger.debug(" Input Workflow Exception: " + wfex.toString()) + logger.debug(" Input Workflow Exception: " + wfex.toString()) String requestId = execution.getVariable("msoRequestId") String source = execution.getVariable("source") String requestInfo = @@ -436,7 +439,7 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) execution.setVariable("falloutRequest", falloutRequest) } catch (Exception ex) { - msoLogger.debug("Exception prepareFalloutRequest:" + ex.getMessage()) + logger.debug("Exception prepareFalloutRequest:" + ex.getMessage()) String errorException = " Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() String requestId = execution.getVariable("msoRequestId") String falloutRequest = @@ -456,6 +459,6 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro execution.setVariable("falloutRequest", falloutRequest) } - msoLogger.trace("Exit prepareFalloutRequest") + logger.trace("Exit prepareFalloutRequest") } -}
\ No newline at end of file +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy index bdb44ca3e2..16f7d53087 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy @@ -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 @@ -29,6 +31,8 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import groovy.json.* @@ -37,7 +41,7 @@ import groovy.json.* * */ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateNetworkInstance.class); + private static final Logger logger = LoggerFactory.getLogger( CreateNetworkInstance.class); String Prefix="CRENI_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -71,7 +75,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) - msoLogger.trace("Start preProcessRequest") + logger.trace("Start preProcessRequest") try { // initialize flow variables @@ -87,20 +91,20 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { String disableRollback = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.requestInfo.suppressRollback") if (disableRollback != null) { execution.setVariable("disableRollback", disableRollback) - msoLogger.debug("Received 'suppressRollback': " + disableRollback ) + logger.debug("Received 'suppressRollback': " + disableRollback ) } else { execution.setVariable("disableRollback", false) } - msoLogger.debug(" Set 'disableRollback' : " + execution.getVariable("disableRollback") ) + logger.debug(" Set 'disableRollback' : " + execution.getVariable("disableRollback") ) } else { String dataErrorMessage = " Invalid 'bpmnRequest' request." - msoLogger.debug(dataErrorMessage) + logger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } } else { // 'macro' TEST ONLY, sdncVersion = '1702' - msoLogger.debug(" 'disableRollback' : " + execution.getVariable("disableRollback") ) + logger.debug(" 'disableRollback' : " + execution.getVariable("disableRollback") ) } // get/set 'msoRequestId' and 'mso-request-id' @@ -146,7 +150,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { sendSyncError(execution) // caught exception String exceptionMessage = "Exception Encountered in CreateNetworkInstance, PreProcessRequest() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -156,7 +160,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) - msoLogger.trace("Start sendSyncResponse") + logger.trace("Start sendSyncResponse") try { String requestId = execution.getVariable("mso-request-id") @@ -164,12 +168,12 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { // RESTResponse (for API Handler (APIH) Reply Task) String createNetworkRestRequest = """{"requestReferences":{"instanceId":"","requestId":"${requestId}"}}""".trim() - msoLogger.debug(" sendSyncResponse to APIH - " + "\n" + createNetworkRestRequest) + logger.debug(" sendSyncResponse to APIH - " + "\n" + createNetworkRestRequest) sendWorkflowResponse(execution, 202, createNetworkRestRequest) } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in CreateNetworkInstance flow. sendSyncResponse() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -180,7 +184,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) - msoLogger.trace("Start getNetworkModelInfo") + logger.trace("Start getNetworkModelInfo") try { @@ -193,7 +197,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { } catch (Exception ex) { sendSyncError(execution) String exceptionMessage = "Bpmn error encountered in CreateNetworkInstance flow. getNetworkModelInfo() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -205,7 +209,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) - msoLogger.trace("Start sendSyncError") + logger.trace("Start sendSyncError") try { @@ -217,7 +221,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { sendWorkflowResponse(execution, 500, syncError) } catch (Exception ex) { - msoLogger.debug(" Bpmn error encountered in CreateNetworkInstance flow. sendSyncError() - " + ex.getMessage()) + logger.debug(" Bpmn error encountered in CreateNetworkInstance flow. sendSyncError() - " + ex.getMessage()) } } @@ -227,7 +231,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) try { - msoLogger.trace("Start prepareDBRequestError") + logger.trace("Start prepareDBRequestError") // set DB Header Authorization setBasicDBAuthHeader(execution, isDebugEnabled) @@ -258,12 +262,12 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { </soapenv:Envelope>""" execution.setVariable(Prefix + "createDBRequest", dbRequest) - msoLogger.debug(" DB Adapter Request - " + "\n" + dbRequest) - msoLogger.debug(dbRequest) + logger.debug(" DB Adapter Request - " + "\n" + dbRequest) + logger.debug(dbRequest) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in CreateNetworkInstance flow. prepareDBRequestError() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) } @@ -274,7 +278,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) - msoLogger.trace("Start prepareCompletion") + logger.trace("Start prepareCompletion") try { @@ -301,11 +305,11 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { // normal path execution.setVariable(Prefix + "Success", true) execution.setVariable(Prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest) - msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + logger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in CreateNetworkInstance flow. prepareCompletion() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -324,25 +328,25 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) - msoLogger.trace("Start postProcessResponse") + logger.trace("Start postProcessResponse") try { if (execution.getVariable("CMSO_ResponseCode") == "200") { execution.setVariable(Prefix + "Success", true) - msoLogger.trace("CreateNetworkInstance Success ****") + logger.trace("CreateNetworkInstance Success ****") // Place holder for additional code. } else { execution.setVariable(Prefix + "Success", false) - msoLogger.trace("CreateNetworkInstance Failed in CompletionMsoProces flow!. ****") + logger.trace("CreateNetworkInstance Failed in CompletionMsoProces flow!. ****") } } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in CreateNetworkInstance flow. postProcessResponse() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -358,7 +362,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) - msoLogger.trace("Start processRollbackData") + logger.trace("Start processRollbackData") try { //execution.getVariable("orchestrationStatus") @@ -369,7 +373,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { //rolledBack } catch (Exception ex) { - msoLogger.debug(" Bpmn error encountered in CreateNetworkInstance flow. callDBCatalog() - " + ex.getMessage()) + logger.debug(" Bpmn error encountered in CreateNetworkInstance flow. callDBCatalog() - " + ex.getMessage()) } } @@ -379,10 +383,10 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) - msoLogger.debug("DB updateInfraRequest ResponseCode: " + execution.getVariable(Prefix + "dbReturnCode")) - msoLogger.debug("DB updateInfraRequest Response: " + execution.getVariable(Prefix + "createDBResponse")) + logger.debug("DB updateInfraRequest ResponseCode: " + execution.getVariable(Prefix + "dbReturnCode")) + logger.debug("DB updateInfraRequest Response: " + execution.getVariable(Prefix + "createDBResponse")) - msoLogger.trace("Prepare for FalloutHandler. FAILURE - prepare request for sub-process FalloutHandler.") + logger.trace("Prepare for FalloutHandler. FAILURE - prepare request for sub-process FalloutHandler.") String falloutHandlerRequest = "" String requestId = execution.getVariable("mso-request-id") @@ -407,13 +411,13 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { </aetgt:WorkflowException> </aetgt:FalloutHandlerRequest>""" - msoLogger.debug(falloutHandlerRequest) + logger.debug(falloutHandlerRequest) execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) - msoLogger.debug(" Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest) + logger.debug(" Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest) } catch (Exception ex) { String errorException = " Bpmn error encountered in CreateNetworkInstance flow. FalloutHandlerRequest, buildErrorResponse()" - msoLogger.debug("Exception error in CreateNetworkInstance flow, buildErrorResponse(): " + ex.getMessage()) + logger.debug("Exception error in CreateNetworkInstance flow, buildErrorResponse(): " + ex.getMessage()) falloutHandlerRequest = """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:ns="http://org.onap/so/request/types/v1" @@ -430,7 +434,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { </aetgt:FalloutHandlerRequest>""" execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) - msoLogger.debug(" Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest) + logger.debug(" Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest) } @@ -440,18 +444,18 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) try{ - msoLogger.debug("Caught a Java Exception in " + Prefix) - msoLogger.debug("Started processJavaException Method") - msoLogger.debug("Variables List: " + execution.getVariables()) + logger.debug("Caught a Java Exception in " + Prefix) + logger.debug("Started processJavaException Method") + logger.debug("Variables List: " + execution.getVariables()) execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") }catch(Exception e){ - msoLogger.debug("Caught Exception during processJavaException Method: " + e) + logger.debug("Caught Exception during processJavaException Method: " + e) execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix) } - msoLogger.debug("Completed processJavaException Method in " + Prefix) + logger.debug("Completed processJavaException Method in " + Prefix) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index 9301f3d508..bb2116acb9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 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 @@ -39,7 +41,8 @@ import org.onap.so.client.aai.AAIObjectPlurals import org.onap.so.client.aai.AAIResourcesClient import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import static org.apache.commons.lang3.StringUtils.* @@ -49,7 +52,7 @@ import static org.apache.commons.lang3.StringUtils.* */ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateSDNCNetworkResource.class); + private static final Logger logger = LoggerFactory.getLogger( CreateSDNCNetworkResource.class); String Prefix="CRESDNCRES_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -60,17 +63,17 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { public void preProcessRequest(DelegateExecution execution){ - msoLogger.info(" ***** Started preProcessRequest *****") + logger.info(" ***** Started preProcessRequest *****") try { //get bpmn inputs from resource request. String requestId = execution.getVariable("mso-request-id") String requestAction = execution.getVariable("requestAction") - msoLogger.info("The requestAction is: " + requestAction) + logger.info("The requestAction is: " + requestAction) String recipeParamsFromRequest = execution.getVariable("recipeParams") - msoLogger.info("The recipeParams is: " + recipeParamsFromRequest) + logger.info("The recipeParams is: " + recipeParamsFromRequest) String resourceInput = execution.getVariable("resourceInput") - msoLogger.info("The resourceInput is: " + resourceInput) + logger.info("The resourceInput is: " + resourceInput) //Get ResourceInput Object ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) execution.setVariable(Prefix + "resourceInput", resourceInputObj.toString()) @@ -158,7 +161,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } @@ -238,7 +241,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { * generate the nsParameters */ public void prepareSDNCRequest (DelegateExecution execution) { - msoLogger.info(" ***** Started prepareSDNCRequest *****") + logger.info(" ***** Started prepareSDNCRequest *****") try { // get variables @@ -440,15 +443,15 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String sndcTopologyCreateRequesAsString = utils.formatXml(sdncTopologyCreateRequest) utils.logAudit(sndcTopologyCreateRequesAsString) execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyCreateRequesAsString) - msoLogger.debug("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyCreateRequesAsString) + logger.debug("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyCreateRequesAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in CreateSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - msoLogger.info(" ***** Exit prepareSDNCRequest *****") + logger.info(" ***** Exit prepareSDNCRequest *****") } private void setProgressUpdateVariables(DelegateExecution execution, String body) { @@ -523,7 +526,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { } public void afterCreateSDNCCall(DelegateExecution execution){ - msoLogger.info(" ***** Started prepareSDNCRequest *****") + logger.info(" ***** Started prepareSDNCRequest *****") String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode") String responseObj = execution.getVariable(Prefix + "SuccessIndicator") @@ -533,8 +536,8 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { execution.setVariable("networkInstanceId", instnaceId) } - msoLogger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj) - msoLogger.info(" ***** Exit prepareSDNCRequest *****") + logger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj) + logger.info(" ***** Exit prepareSDNCRequest *****") } private def getInstnaceId(DelegateExecution execution) { @@ -566,21 +569,21 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { } public void sendSyncResponse (DelegateExecution execution) { - msoLogger.debug(" *** sendSyncResponse *** ") + logger.debug(" *** sendSyncResponse *** ") try { String operationStatus = "finished" // RESTResponse for main flow String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) + logger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) sendWorkflowResponse(execution, 202, resourceOperationResp) execution.setVariable("sentSyncResponse", true) } catch (Exception ex) { String msg = "Exception in sendSyncResponse:" + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.debug(" ***** Exit sendSyncResponse *****") + logger.debug(" ***** Exit sendSyncResponse *****") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy index 6222214108..433a8d0bb9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -30,7 +32,8 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.onap.so.bpmn.core.UrnPropertiesReader import javax.ws.rs.core.Response @@ -41,7 +44,7 @@ import org.onap.so.utils.TargetEntity * flow for VFC Network Service Create */ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateVFCNSResource.class); + private static final Logger logger = LoggerFactory.getLogger( CreateVFCNSResource.class); ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -58,7 +61,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { JsonUtils jsonUtil = new JsonUtils() String msg = "" - msoLogger.trace("preProcessRequest() ") + logger.trace("preProcessRequest() ") try { //deal with nsName and Description String resourceInput = execution.getVariable("resourceInput") @@ -69,24 +72,24 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { execution.setVariable("nsServiceName", resourceName) String nsServiceDescription = execution.getVariable("nsServiceDescription") - msoLogger.info("nsServiceName:" + resourceName + " nsServiceDescription:" + nsServiceDescription) + logger.info("nsServiceName:" + resourceName + " nsServiceDescription:" + nsServiceDescription) //deal with operation key String globalSubscriberId = jsonUtil.getJsonValue(resourceInput, "globalSubscriberId") - msoLogger.info("globalSubscriberId:" + globalSubscriberId) + logger.info("globalSubscriberId:" + globalSubscriberId) //set local globalSubscriberId variable execution.setVariable("globalSubscriberId", globalSubscriberId); String serviceType = execution.getVariable("serviceType") - msoLogger.info("serviceType:" + serviceType) + logger.info("serviceType:" + serviceType) String serviceId = execution.getVariable("serviceInstanceId") - msoLogger.info("serviceId:" + serviceId) + logger.info("serviceId:" + serviceId) String operationId = jsonUtil.getJsonValue(resourceInput, "operationId") - msoLogger.info("serviceType:" + serviceType) + logger.info("serviceType:" + serviceType) String nodeTemplateUUID = jsonUtil.getJsonValue(resourceInput, "resourceModelInfo.modelCustomizationUuid") String nsServiceModelUUID = jsonUtil.getJsonValue(resourceParameters, "requestInputs.nsd0_providing_service_uuid") - msoLogger.info("nodeTemplateUUID:" + nodeTemplateUUID) + logger.info("nodeTemplateUUID:" + nodeTemplateUUID) /* * segmentInformation needed as a object of segment * { @@ -99,7 +102,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { * } */ String nsParameters = jsonUtil.getJsonValue(resourceInput, "resourceParameters") - msoLogger.info("nsParameters:" + nsParameters) + logger.info("nsParameters:" + nsParameters) String nsOperationKey = """{ "globalSubscriberId":"${globalSubscriberId}", "serviceType":"${serviceType}", @@ -115,7 +118,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { if (vfcAdapterUrl == null || vfcAdapterUrl.isEmpty()) { msg = getProcessKey(execution) + ': mso:adapters:vfcc:rest:endpoint URN mapping is not defined' - msoLogger.debug(msg) + logger.debug(msg) } while (vfcAdapterUrl.endsWith('/')) { @@ -128,17 +131,17 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit preProcessRequest ") + logger.trace("Exit preProcessRequest ") } /** * create NS task */ public void createNetworkService(DelegateExecution execution) { - msoLogger.trace("createNetworkService ") + logger.trace("createNetworkService ") String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl") String nsOperationKey = execution.getVariable("nsOperationKey"); String nsServiceModelUUID = execution.getVariable("nsServiceModelUUID"); @@ -165,14 +168,14 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { nsInstanceId = jsonUtil.getJsonValue(aaiResponseAsString, "nsInstanceId") } execution.setVariable("nsInstanceId", nsInstanceId) - msoLogger.info(" *****Exit createNetworkService *****") + logger.info(" *****Exit createNetworkService *****") } /** * instantiate NS task */ public void instantiateNetworkService(DelegateExecution execution) { - msoLogger.trace("instantiateNetworkService ") + logger.trace("instantiateNetworkService ") String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl") String nsOperationKey = execution.getVariable("nsOperationKey"); String nsParameters = execution.getVariable("nsParameters"); @@ -194,14 +197,14 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId") } execution.setVariable("jobId", jobId) - msoLogger.info(" *****Exit instantiateNetworkService *****") + logger.info(" *****Exit instantiateNetworkService *****") } /** * query NS task */ public void queryNSProgress(DelegateExecution execution) { - msoLogger.trace("queryNSProgress ") + logger.trace("queryNSProgress ") String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl") String jobId = execution.getVariable("jobId") String nsOperationKey = execution.getVariable("nsOperationKey"); @@ -214,7 +217,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { operationStatus = jsonUtil.getJsonValue(aaiResponseAsString, "responseDescriptor.status") } execution.setVariable("operationStatus", operationStatus) - msoLogger.info(" *****Exit queryNSProgress *****") + logger.info(" *****Exit queryNSProgress *****") } /** @@ -224,7 +227,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { try { Thread.sleep(5000); } catch(InterruptedException e) { - msoLogger.error( "Time Delay exception" + e.getMessage()); + logger.error("Time Delay exception" + e.getMessage()); } } @@ -232,10 +235,10 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { * finish NS task */ public void addNSRelationship(DelegateExecution execution) { - msoLogger.trace("addNSRelationship ") + logger.trace("addNSRelationship ") String nsInstanceId = execution.getVariable("nsInstanceId") if(nsInstanceId == null || nsInstanceId == ""){ - msoLogger.info(" create NS failed, so do not need to add relationship") + logger.info(" create NS failed, so do not need to add relationship") return } String globalSubscriberId = execution.getVariable("globalSubscriberId") @@ -247,9 +250,9 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { try{ getAAIClient().connect(nsUri,relatedServiceUri) - msoLogger.info("NS relationship to Service added successfully") + logger.info("NS relationship to Service added successfully") }catch(Exception e){ - msoLogger.error("Exception occured while Creating NS relationship."+ e.getMessage()); + logger.error("Exception occured while Creating NS relationship."+ e.getMessage()); throw new BpmnError("MSOWorkflowException") } } @@ -260,8 +263,8 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { * requestBody: the body of the request */ private Response postRequest(DelegateExecution execution, String urlString, String requestBody){ - msoLogger.trace("Started Execute VFC adapter Post Process ") - msoLogger.info("url:" + urlString +"\nrequestBody:"+ requestBody) + logger.trace("Started Execute VFC adapter Post Process ") + logger.info("url:" + urlString +"\nrequestBody:"+ requestBody) Response apiResponse = null try{ @@ -276,36 +279,36 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { apiResponse = httpClient.post(requestBody) - msoLogger.debug("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class)) + logger.debug("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class)) }catch(Exception e){ - msoLogger.error("VFC Aatpter Post Call Exception:" + e.getMessage()); + logger.error("VFC Aatpter Post Call Exception:" + e.getMessage()); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "VFC Aatpter Post Call Exception") } - msoLogger.trace("Completed Execute VF-C adapter Post Process ") + logger.trace("Completed Execute VF-C adapter Post Process ") return apiResponse } public void sendSyncResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) + logger.debug( " *** sendSyncResponse *** ") try { String operationStatus = execution.getVariable("operationStatus") // RESTResponse for main flow String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled) + logger.debug( " sendSyncResponse to APIH:" + "\n" + resourceOperationResp) sendWorkflowResponse(execution, 202, resourceOperationResp) execution.setVariable("sentSyncResponse", true) } catch (Exception ex) { String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) + logger.debug( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) + logger.debug(" ***** Exit sendSyncResopnse *****") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy index ffac4c0174..e3ac04e9e3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy @@ -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 @@ -36,6 +38,8 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.infrastructure.aai.AAICreateResources; import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.w3c.dom.* import javax.xml.parsers.* import org.xml.sax.InputSource @@ -43,7 +47,7 @@ import groovy.json.JsonOutput import groovy.json.JsonSlurper public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateVfModuleInfra.class); + private static final Logger logger = LoggerFactory.getLogger( CreateVfModuleInfra.class); ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() @@ -63,7 +67,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' - msoLogger.debug('Started ' + method) + logger.debug('Started ' + method) def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') execution.setVariable("CVFMI_sentSyncResponse", false) @@ -79,8 +83,8 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { execution.setVariable("RollbackData", rollbackData) def incomingRequest = execution.getVariable('bpmnRequest') - msoLogger.debug("Incoming Infra Request: " + incomingRequest) - msoLogger.debug("CreateVfModule Infra incoming Request: " + incomingRequest) + logger.debug("Incoming Infra Request: " + incomingRequest) + logger.debug("CreateVfModule Infra incoming Request: " + incomingRequest) setBasicDBAuthHeader(execution, isDebugLogEnabled) @@ -89,7 +93,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { def jsonSlurper = new JsonSlurper() def jsonOutput = new JsonOutput() Map reqMap = jsonSlurper.parseText(incomingRequest) - msoLogger.debug(" Request is in JSON format.") + logger.debug(" Request is in JSON format.") def serviceInstanceId = execution.getVariable('serviceInstanceId') def vnfId = execution.getVariable('vnfId') @@ -140,7 +144,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { } } - msoLogger.debug('Processed user params: ' + userParamsMap) + logger.debug('Processed user params: ' + userParamsMap) execution.setVariable(prefix + 'vfModuleInputParams', userParamsMap) @@ -232,24 +236,25 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { execution.setVariable(prefix + 'controllerType', controllerType) execution.setVariable('healthCheckIndex0', 0) - msoLogger.debug('RequestInfo: ' + execution.getVariable("CVFMI_requestInfo")) + logger.debug('RequestInfo: ' + execution.getVariable("CVFMI_requestInfo")) - msoLogger.debug('rollbackEnabled: ' + execution.getVariable("CVFMI_rollbackEnabled")) + logger.debug('rollbackEnabled: ' + execution.getVariable("CVFMI_rollbackEnabled")) - msoLogger.trace('Finished ' + method) + logger.trace('Finished ' + method) } catch (BpmnError bpmnError) { throw bpmnError } catch(groovy.json.JsonException je) { - msoLogger.debug("Request is not in JSON format.") + logger.debug("Request is not in JSON format.") exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest") } catch(Exception e) { String restFaultMessage = e.getMessage() //execution.setVariable("CVFMODVOL2_RESTFault", restFaultMessage) //execution.setVariable("CVFMODVOL2_isDataOk", false) - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest") } @@ -278,7 +283,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' - msoLogger.trace('Started ' + method) + logger.trace('Started ' + method) try { def requestInfo = execution.getVariable('CVFMI_requestInfo') @@ -292,13 +297,14 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { sendWorkflowResponse(execution, 200, synchResponse) execution.setVariable("CVFMI_sentSyncResponse", true) - msoLogger.debug("CreateVfModule Infra Response: " + synchResponse) - msoLogger.trace('Finished ' + method) + logger.debug("CreateVfModule Infra Response: " + synchResponse) + logger.trace('Finished ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered ", "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Encountered ", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) } } @@ -371,13 +377,13 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { * @param execution the execution */ public void postProcessResponse(DelegateExecution execution){ - msoLogger.trace("STARTED PostProcessResponse Process") + logger.trace("STARTED PostProcessResponse Process") try{ def requestInfo = execution.getVariable("CVFMI_requestInfo") def action = utils.getNodeText(requestInfo, "action") - msoLogger.debug("requestInfo is: " + requestInfo) - msoLogger.debug("action is: " + action) + logger.debug("requestInfo is: " + requestInfo) + logger.debug("action is: " + action) String payload = """ <aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" @@ -393,15 +399,16 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { payload = utils.formatXml(payload) execution.setVariable("CVFMI_SuccessFlag", true) execution.setVariable("CVFMI_msoCompletionRequest", payload) - msoLogger.debug("CreateVfModuleInfra completion request: " + payload) - msoLogger.debug("Outgoing MsoCompletionRequest: \n" + payload) + logger.debug("CreateVfModuleInfra completion request: " + payload) + logger.debug("Outgoing MsoCompletionRequest: \n" + payload) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Occured Processing PostProcessResponse - " + "\n", "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing PostProcessResponse - " + "\n", "BPMN", + MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("CVFMI_ErrorResponse", "Error Occured during PostProcessResponse Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED PostProcessResponse Process") + logger.trace("COMPLETED PostProcessResponse Process") } @@ -420,7 +427,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' - msoLogger.trace('Started ' + method) + logger.trace('Started ' + method) String processKey = getProcessKey(execution); def prefix = execution.getVariable("prefix") @@ -466,20 +473,22 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { utils.logContext(requestId, serviceInstanceId) */ - msoLogger.debug("CreateVfModule incoming request: " + request) - msoLogger.debug('Incoming message: ' + System.lineSeparator() + request) - msoLogger.trace('Finished ' + method) + logger.debug("CreateVfModule incoming request: " + request) + logger.debug('Incoming message: ' + System.lineSeparator() + request) + logger.trace('Finished ' + method) return request } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Caught exception in " + method , "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Caught exception in " + method , "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message") } } public void prepareUpdateInfraRequest(DelegateExecution execution){ - msoLogger.trace("STARTED prepareUpdateInfraRequest Process") + logger.trace("STARTED prepareUpdateInfraRequest Process") try{ String requestInfo = execution.getVariable("CVFMI_requestInfo") @@ -493,7 +502,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint",execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - msoLogger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint) + logger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint) String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" @@ -516,15 +525,16 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { payload = utils.formatXml(payload) execution.setVariable("CVFMI_updateInfraRequest", payload) - msoLogger.debug("Outgoing UpdateInfraRequest: \n" + payload) - msoLogger.debug("CreateVfModuleInfra Outgoing UpdateInfra Request: " + payload) + logger.debug("Outgoing UpdateInfraRequest: \n" + payload) + logger.debug("CreateVfModuleInfra Outgoing UpdateInfra Request: " + payload) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing prepareUpdateInfraRequest.", "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing prepareUpdateInfraRequest.", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateInfraRequest Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED prepareUpdateInfraRequest Process") + logger.trace("COMPLETED prepareUpdateInfraRequest Process") } /** @@ -539,7 +549,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { ', resultVar=' + resultVar + ')' - msoLogger.trace("Started " + method) + logger.trace("Started " + method) try { @@ -565,17 +575,19 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { </aetgt:FalloutHandlerRequest> """ - msoLogger.debug("CONTENT before translation: " + content) + logger.debug("CONTENT before translation: " + content) content = utils.formatXml(content) - msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content) - msoLogger.debug("CreateVfModuleInfra FallOutHander Request: " + content) + logger.debug(resultVar + ' = ' + System.lineSeparator() + content) + logger.debug("CreateVfModuleInfra FallOutHander Request: " + content) execution.setVariable(resultVar, content) - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Caught exception in " + method , "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Caught exception in " + method , "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') } } @@ -584,7 +596,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { def method = getClass().getSimpleName() + '.validateRollbackResponse(' + 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) logWorkflowException(execution, 'CreateVfModuleInfra caught an event') saveWorkflowException(execution, 'CVFMI_originalWorkflowException') @@ -594,7 +606,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { def method = getClass().getSimpleName() + '.validateRollbackResponse(' + 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) def originalException = execution.getVariable("CVFMI_originalWorkflowException") execution.setVariable("WorkflowException", originalException) @@ -603,23 +615,23 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { } public void sendErrorResponse(DelegateExecution execution){ - msoLogger.trace("STARTED CreateVfModulenfra sendErrorResponse Process") + logger.trace("STARTED CreateVfModulenfra sendErrorResponse Process") try { def sentSyncResponse = execution.getVariable("CVFMI_sentSyncResponse") if(sentSyncResponse == false){ WorkflowException wfex = execution.getVariable("WorkflowException") String response = exceptionUtil.buildErrorResponseXml(wfex) - msoLogger.debug(response) + logger.debug(response) sendWorkflowResponse(execution, 500, response) }else{ - msoLogger.debug("Not Sending Error Response. Sync Response Already Sent") + logger.debug("Not Sending Error Response. Sync Response Already Sent") } } catch (Exception ex) { - msoLogger.debug("Error Occured in CreateVfModuleInfra sendErrorResponse Process " + ex.getMessage()) + logger.debug("Error Occured in CreateVfModuleInfra sendErrorResponse Process " + ex.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVfModuleInfra sendErrorResponse Process") } - msoLogger.trace("COMPLETED CreateVfModuleInfra sendErrorResponse Process") + logger.trace("COMPLETED CreateVfModuleInfra sendErrorResponse Process") } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy index 05c8246311..d85ea481d5 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy @@ -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.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import groovy.json.JsonOutput import groovy.json.JsonSlurper @@ -42,7 +46,7 @@ import groovy.json.JsonSlurper class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateVfModuleVolumeInfraV1.class); + private static final Logger logger = LoggerFactory.getLogger( CreateVfModuleVolumeInfraV1.class); public static final String prefix='CVMVINFRAV1_' /** @@ -68,13 +72,13 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { execution.setVariable(prefix+'syncResponseSent', false) String createVolumeIncoming = validateRequest(execution, 'vnfId') - msoLogger.debug(createVolumeIncoming) + logger.debug(createVolumeIncoming) try { def jsonSlurper = new JsonSlurper() Map reqMap = jsonSlurper.parseText(createVolumeIncoming) setupVariables(execution, reqMap, isDebugEnabled) - msoLogger.debug("XML request:\n" + createVolumeIncoming) + logger.debug("XML request:\n" + createVolumeIncoming) } catch(groovy.json.JsonException je) { (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, 'Request is not a valid JSON document') @@ -100,7 +104,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { // volumeGroupId - is generated String volumeGroupId = UUID.randomUUID() execution.setVariable('volumeGroupId', volumeGroupId) - msoLogger.debug("Generated volumeGroupId: " + volumeGroupId) + logger.debug("Generated volumeGroupId: " + volumeGroupId) // volumeGroupName def volGrpName = requestMap.requestDetails.requestInfo?.instanceName ?: '' @@ -159,7 +163,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { // disableRollback (true or false) def disableRollback = requestMap.requestDetails.requestInfo.suppressRollback execution.setVariable('disableRollback', disableRollback) - msoLogger.debug('disableRollback (suppressRollback) from request: ' + disableRollback) + logger.debug('disableRollback (suppressRollback) from request: ' + disableRollback) } @@ -172,7 +176,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { String syncResponse = """{"requestReferences":{"instanceId":"${volumeGroupId}","requestId":"${requestId}"}}""".trim() - msoLogger.debug("Sync Response: " + "\n" + syncResponse) + logger.debug("Sync Response: " + "\n" + syncResponse) sendWorkflowResponse(execution, 200, syncResponse) execution.setVariable(prefix+'syncResponseSent', true) @@ -194,7 +198,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { * @param isDebugEnabled */ public void buildWorkflowException(DelegateExecution execution, int errorCode, errorMessage, isDebugEnabled) { - msoLogger.debug(errorMessage) + logger.debug(errorMessage) (new ExceptionUtil()).buildWorkflowException(execution, 2500, errorMessage) } @@ -237,7 +241,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { String buildDBRequestAsString = utils.formatXml(dbRequest) execution.setVariable(prefix+"createDBRequest", buildDBRequestAsString) - msoLogger.debug("DB Infra Request: " + buildDBRequestAsString) + logger.debug("DB Infra Request: " + buildDBRequestAsString) } @@ -251,8 +255,8 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { def dbReturnCode = execution.getVariable(prefix+'dbReturnCode') def createDBResponse = execution.getVariable(prefix+'createDBResponse') - msoLogger.debug('DB return code: ' + dbReturnCode) - msoLogger.debug('DB response: ' + createDBResponse) + logger.debug('DB return code: ' + dbReturnCode) + logger.debug('DB response: ' + createDBResponse) def requestId = execution.getVariable("mso-request-id") def source = execution.getVariable(prefix+'source') @@ -273,7 +277,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { execution.setVariable(prefix+'Success', true) execution.setVariable(prefix+'CompleteMsoProcessRequest', xmlMsoCompletionRequest) - msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + logger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) } @@ -306,7 +310,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { String xmlHandlerRequest = utils.formatXml(falloutHandlerRequest) execution.setVariable(prefix+'FalloutHandlerRequest', xmlHandlerRequest) - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Overall Error Response going to FalloutHandler", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "\n" + xmlHandlerRequest); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Overall Error Response going to FalloutHandler", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "\n" + xmlHandlerRequest); } @@ -324,10 +328,10 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { AAIResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectType.SERVICE_INSTANCE,serviceInstanceId) if(getAAIClient().exists(uri)){ - msoLogger.debug('Service instance ' + serviceInstanceId + ' found in AAI.') + logger.debug('Service instance ' + serviceInstanceId + ' found in AAI.') }else{ def message = 'Service instance ' + serviceInstanceId + ' was not found in AAI. Return code: 404.' - msoLogger.debug(message) + logger.debug(message) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, message) } }catch(BpmnError bpmnError){ diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy index af46bf65b8..29eb47c1e7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy @@ -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 @@ -41,6 +43,8 @@ import org.onap.so.bpmn.core.json.JsonUtils; import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources; import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory /** @@ -50,7 +54,7 @@ import org.onap.so.logger.MsoLogger */ class CreateVnfInfra extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateVnfInfra.class); + private static final Logger logger = LoggerFactory.getLogger( CreateVnfInfra.class); String Prefix="CREVI_" @@ -69,7 +73,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { public void preProcessRequest(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED CreateVnfInfra PreProcessRequest Process") + logger.trace("STARTED CreateVnfInfra PreProcessRequest Process") setBasicDBAuthHeader(execution, isDebugEnabled) execution.setVariable("CREVI_sentSyncResponse", false) @@ -78,59 +82,59 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { // Get Variables String createVnfRequest = execution.getVariable("bpmnRequest") execution.setVariable("CREVI_createVnfRequest", createVnfRequest) - msoLogger.debug("Incoming CreateVnfInfra Request is: \n" + createVnfRequest) + logger.debug("Incoming CreateVnfInfra Request is: \n" + createVnfRequest) if(createVnfRequest != null){ String requestId = execution.getVariable("mso-request-id") execution.setVariable("CREVI_requestId", requestId) - msoLogger.debug("Incoming Request Id is: " + requestId) + logger.debug("Incoming Request Id is: " + requestId) String serviceInstanceId = execution.getVariable("serviceInstanceId") execution.setVariable("CREVI_serviceInstanceId", serviceInstanceId) - msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + logger.debug("Incoming Service Instance Id is: " + serviceInstanceId) String vnfType = execution.getVariable("vnfType") execution.setVariable("CREVI_vnfType", vnfType) - msoLogger.debug("Incoming Vnf Type is: " + vnfType) + logger.debug("Incoming Vnf Type is: " + vnfType) String vnfName = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.instanceName") execution.setVariable("CREVI_vnfName", vnfName) - msoLogger.debug("Incoming Vnf Name is: " + vnfName) + logger.debug("Incoming Vnf Name is: " + vnfName) String serviceId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.productFamilyId") execution.setVariable("CREVI_serviceId", serviceId) - msoLogger.debug("Incoming Service Id is: " + serviceId) + logger.debug("Incoming Service Id is: " + serviceId) String source = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.source") execution.setVariable("CREVI_source", source) - msoLogger.debug("Incoming Source is: " + source) + logger.debug("Incoming Source is: " + source) String suppressRollback = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.suppressRollback") execution.setVariable("CREVI_suppressRollback", suppressRollback) - msoLogger.debug("Incoming Suppress Rollback is: " + suppressRollback) + logger.debug("Incoming Suppress Rollback is: " + suppressRollback) def vnfModelInfo = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo") execution.setVariable("CREVI_vnfModelInfo", vnfModelInfo) String modelInvariantId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo.modelInvariantUuid") execution.setVariable("CREVI_modelInvariantId", modelInvariantId) - msoLogger.debug("Incoming Invariant Id is: " + modelInvariantId) + logger.debug("Incoming Invariant Id is: " + modelInvariantId) String modelVersion = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo.modelVersion") execution.setVariable("CREVI_modelVersion", modelVersion) - msoLogger.debug("Incoming Model Version is: " + modelVersion) + logger.debug("Incoming Model Version is: " + modelVersion) def cloudConfiguration = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration") execution.setVariable("CREVI_cloudConfiguration", cloudConfiguration) String cloudSiteId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId") execution.setVariable("CREVI_cloudSiteId", cloudSiteId) - msoLogger.debug("Incoming Cloud Site Id is: " + cloudSiteId) + logger.debug("Incoming Cloud Site Id is: " + cloudSiteId) String tenantId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration.tenantId") execution.setVariable("CREVI_tenantId", tenantId) - msoLogger.debug("Incoming Tenant Id is: " + tenantId) + logger.debug("Incoming Tenant Id is: " + tenantId) //For Completion Handler & Fallout Handler String requestInfo = @@ -153,7 +157,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { String vnfId = execution.getVariable("testVnfId") // for junits if(isBlank(vnfId)){ vnfId = UUID.randomUUID().toString() - msoLogger.debug("Generated Vnf Id is: " + vnfId) + logger.debug("Generated Vnf Id is: " + vnfId) } execution.setVariable("CREVI_vnfId", vnfId) @@ -164,7 +168,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -175,31 +179,31 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { vnfInputParameters = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestParameters.userParams") } catch (Exception e) { - msoLogger.debug("userParams are not present in the request") + logger.debug("userParams are not present in the request") } execution.setVariable("CREVI_vnfInputParameters", vnfInputParameters) - msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl) + logger.debug("SDNC Callback URL: " + sdncCallbackUrl) }else{ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Bpmn Request is Null.") } }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") + logger.debug("Rethrowing MSOWorkflowException") throw b }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error Occurred in CreateVnfInfra PreProcessRequest method", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e) + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Error Occurred in CreateVnfInfra PreProcessRequest method", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in CreateVnfInfra PreProcessRequest") } - msoLogger.trace("COMPLETED CreateVnfInfra PreProcessRequest Process") + logger.trace("COMPLETED CreateVnfInfra PreProcessRequest Process") } public void sendSyncResponse (DelegateExecution execution) { execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED CreateVnfInfra SendSyncResponse Process") + logger.trace("STARTED CreateVnfInfra SendSyncResponse Process") try { String requestId = execution.getVariable("CREVI_requestId") @@ -207,28 +211,28 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { String createVnfResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim() - msoLogger.debug("CreateVnfInfra Sync Response is: \n" + createVnfResponse) + logger.debug("CreateVnfInfra Sync Response is: \n" + createVnfResponse) sendWorkflowResponse(execution, 202, createVnfResponse) execution.setVariable("CREVI_sentSyncResponse", true) } catch (Exception ex) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error Occurred in CreateVnfInfra SendSyncResponse Process", "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e) + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Error Occurred in CreateVnfInfra SendSyncResponse Process", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra SendSyncResponse Process") } - msoLogger.trace("COMPLETED CreateVnfInfra SendSyncResponse Process") + logger.trace("COMPLETED CreateVnfInfra SendSyncResponse Process") } public void preProcessSDNCAssignRequest(DelegateExecution execution){ execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED preProcessSDNCAssignRequest") + logger.trace("STARTED preProcessSDNCAssignRequest") def vnfId = execution.getVariable("CREVI_vnfId") def serviceInstanceId = execution.getVariable("CREVI_serviceInstanceId") - msoLogger.debug("NEW VNF ID: " + vnfId) + logger.debug("NEW VNF ID: " + vnfId) try{ //Build SDNC Request @@ -237,23 +241,23 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { assignSDNCRequest = utils.formatXml(assignSDNCRequest) execution.setVariable("CREVI_assignSDNCRequest", assignSDNCRequest) - msoLogger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest) + logger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e) + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preProcessSDNCAssignRequest") + logger.trace("COMPLETED preProcessSDNCAssignRequest") } public void preProcessSDNCActivateRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessSDNCActivateRequest(' + 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED preProcessSDNCActivateRequest Process") + logger.trace("STARTED preProcessSDNCActivateRequest Process") try{ String vnfId = execution.getVariable("CREVI_vnfId") String serviceInstanceId = execution.getVariable("CREVI_serviceInstanceId") @@ -261,13 +265,13 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { String activateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "activate") execution.setVariable("CREVI_activateSDNCRequest", activateSDNCRequest) - msoLogger.debug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest) + logger.debug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessSDNCActivateRequest", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e) + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessSDNCActivateRequest", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preProcessSDNCActivateRequest Process") + logger.trace("COMPLETED preProcessSDNCActivateRequest Process") } public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ @@ -329,39 +333,39 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { </sdncadapterworkflow:SDNCRequestData> </sdncadapterworkflow:SDNCAdapterWorkflowRequest>""" - msoLogger.debug("sdncRequest: " + sdncRequest) + logger.debug("sdncRequest: " + sdncRequest) return sdncRequest } public void validateSDNCResponse(DelegateExecution execution, String response, String method){ execution.setVariable("prefix",Prefix) - msoLogger.debug("STARTED ValidateSDNCResponse Process") + logger.debug("STARTED ValidateSDNCResponse Process") WorkflowException workflowException = execution.getVariable("WorkflowException") boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - msoLogger.debug("workflowException: " + workflowException) + logger.debug("workflowException: " + workflowException) SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - msoLogger.debug("SDNCResponse: " + response) + logger.debug("SDNCResponse: " + response) String sdncResponse = response if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - msoLogger.trace("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse) + logger.trace("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse) }else{ - msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") + logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") throw new BpmnError("MSOWorkflowException") } - msoLogger.trace("COMPLETED ValidateSDNCResponse Process") + logger.trace("COMPLETED ValidateSDNCResponse Process") } public void prepareCompletionHandlerRequest(DelegateExecution execution){ execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED CreateVnfInfra PrepareCompletionHandlerRequest Process") + logger.trace("STARTED CreateVnfInfra PrepareCompletionHandlerRequest Process") try { String requestInfo = execution.getVariable("CREVI_requestInfo") @@ -378,52 +382,52 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { </aetgt:MsoCompletionRequest>""" execution.setVariable("CREVI_completionHandlerRequest", request) - msoLogger.debug("Completion Handler Request is: " + request) + logger.debug("Completion Handler Request is: " + request) execution.setVariable("WorkflowResponse", "Success") // for junits } catch (Exception ex) { - msoLogger.debug("Error Occured in CreateVnfInfra PrepareCompletionHandlerRequest Process " + ex.getMessage()) + logger.debug("Error Occured in CreateVnfInfra PrepareCompletionHandlerRequest Process " + ex.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra PrepareCompletionHandlerRequest Process") } - msoLogger.trace("COMPLETED CreateVnfInfra PrepareCompletionHandlerRequest Process") + logger.trace("COMPLETED CreateVnfInfra PrepareCompletionHandlerRequest Process") } public void sendErrorResponse(DelegateExecution execution){ execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED CreateVnfInfra sendErrorResponse Process") + logger.trace("STARTED CreateVnfInfra sendErrorResponse Process") try { def sentSyncResponse = execution.getVariable("CREVI_sentSyncResponse") if(sentSyncResponse == false){ WorkflowException wfex = execution.getVariable("WorkflowException") String response = exceptionUtil.buildErrorResponseXml(wfex) - msoLogger.debug(response) + logger.debug(response) sendWorkflowResponse(execution, 500, response) }else{ - msoLogger.debug("Not Sending Error Response. Sync Response Already Sent") + logger.debug("Not Sending Error Response. Sync Response Already Sent") } } catch (Exception ex) { - msoLogger.debug("Error Occured in CreateVnfInfra sendErrorResponse Process " + ex.getMessage()) + logger.debug("Error Occured in CreateVnfInfra sendErrorResponse Process " + ex.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra sendErrorResponse Process") } - msoLogger.trace("COMPLETED CreateVnfInfra sendErrorResponse Process") + logger.trace("COMPLETED CreateVnfInfra sendErrorResponse Process") } public void prepareFalloutRequest(DelegateExecution execution){ execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED CreateVnfInfra prepareFalloutRequest Process") + logger.trace("STARTED CreateVnfInfra prepareFalloutRequest Process") try { WorkflowException wfex = execution.getVariable("WorkflowException") - msoLogger.debug(" Incoming Workflow Exception: " + wfex.toString()) + logger.debug(" Incoming Workflow Exception: " + wfex.toString()) String requestInfo = execution.getVariable("CREVI_requestInfo") - msoLogger.debug(" Incoming Request Info: " + requestInfo) + logger.debug(" Incoming Request Info: " + requestInfo) String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) @@ -431,30 +435,30 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { } catch (Exception ex) { - msoLogger.debug("Error Occured in CreateVnfInfra prepareFalloutRequest Process " + ex.getMessage()) + logger.debug("Error Occured in CreateVnfInfra prepareFalloutRequest Process " + ex.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra prepareFalloutRequest Process") } - msoLogger.trace("COMPLETED CreateVnfInfra prepareFalloutRequest Process") + logger.trace("COMPLETED CreateVnfInfra prepareFalloutRequest Process") } public void queryCatalogDB (DelegateExecution execution) { execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED CreateVnfInfra QueryCatalogDB Process") + logger.trace("STARTED CreateVnfInfra QueryCatalogDB Process") try { //Get Vnf Info String vnfModelInfo = execution.getVariable("CREVI_vnfModelInfo") String vnfModelCustomizationUuid = jsonUtil.getJsonValueForKey(vnfModelInfo, "modelCustomizationUuid") - msoLogger.debug("querying Catalog DB by vnfModelCustomizationUuid: " + vnfModelCustomizationUuid) + logger.debug("querying Catalog DB by vnfModelCustomizationUuid: " + vnfModelCustomizationUuid) JSONArray vnfs = catalogDbUtils.getAllVnfsByVnfModelCustomizationUuid(execution, vnfModelCustomizationUuid, "v2") - msoLogger.debug("obtained VNF list: " + vnfs) + logger.debug("obtained VNF list: " + vnfs) if (vnfs == null) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid) } @@ -462,7 +466,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { JSONObject vnf = vnfs.get(0) if (vnf == null) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "No matching VNF in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching VNF in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNF in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid) } @@ -481,63 +485,63 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { }catch(BpmnError e) { throw e; }catch(Exception ex) { - msoLogger.debug("Error Occurred in CreateVnfInfra QueryCatalogDB Process " + ex.getMessage()) + logger.debug("Error Occurred in CreateVnfInfra QueryCatalogDB Process " + ex.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in CreateVnfInfra QueryCatalogDB Process") } - msoLogger.trace("COMPLETED CreateVnfInfra QueryCatalogDb Process") + logger.trace("COMPLETED CreateVnfInfra QueryCatalogDb Process") } public void createPlatform (DelegateExecution execution) { - msoLogger.trace("START createPlatform") + logger.trace("START createPlatform") String request = execution.getVariable("bpmnRequest") String platformName = jsonUtil.getJsonValue(request, "requestDetails.platform.platformName") String vnfId = execution.getVariable("CREVI_vnfId") - msoLogger.debug("Platform NAME: " + platformName) - msoLogger.debug("VnfID: " + vnfId) + logger.debug("Platform NAME: " + platformName) + logger.debug("VnfID: " + vnfId) if(platformName == null||platformName.equals("")){ String msg = "Exception in createPlatform. platformName was not found in the request."; - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) }else{ - msoLogger.debug("platformName was found.") + logger.debug("platformName was found.") try{ AAICreateResources aaiCR = new AAICreateResources() aaiCR.createAAIPlatform(platformName, vnfId) }catch(Exception ex){ String msg = "Exception in createPlatform. " + ex.getMessage(); - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } - msoLogger.trace("Exit createPlatform") + logger.trace("Exit createPlatform") } public void createLineOfBusiness (DelegateExecution execution) { - msoLogger.trace("START createLineOfBusiness") + logger.trace("START createLineOfBusiness") String request = execution.getVariable("bpmnRequest") String lineOfBusiness = jsonUtil.getJsonValue(request, "requestDetails.lineOfBusiness.lineOfBusinessName") String vnfId = execution.getVariable("CREVI_vnfId") - msoLogger.debug("LineOfBusiness NAME: " + lineOfBusiness) - msoLogger.debug("VnfID: " + vnfId) + logger.debug("LineOfBusiness NAME: " + lineOfBusiness) + logger.debug("VnfID: " + vnfId) if(lineOfBusiness == null || lineOfBusiness.equals("")){ - msoLogger.debug("LineOfBusiness was not found. Continuing on with flow...") + logger.debug("LineOfBusiness was not found. Continuing on with flow...") }else{ - msoLogger.debug("LineOfBusiness was found.") + logger.debug("LineOfBusiness was found.") try{ AAICreateResources aaiCR = new AAICreateResources() aaiCR.createAAILineOfBusiness(lineOfBusiness, vnfId) }catch(Exception ex){ String msg = "Exception in LineOfBusiness. " + ex.getMessage(); - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex) + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } - msoLogger.trace("Exit createLineOfBusiness") + logger.trace("Exit createLineOfBusiness") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy index 66479be973..ccdb5d77cd 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 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 @@ -31,14 +33,15 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory /** * This groovy class supports the <class>ActivateSDNCCNetworkResource.bpmn</class> process. * flow for SDNC Network Resource Activate */ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeActivateSDNCNetworkResource.class); + private static final Logger logger = LoggerFactory.getLogger( DeActivateSDNCNetworkResource.class); String Prefix = "DEACTSDNCRES_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -51,7 +54,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor public void preProcessRequest(DelegateExecution execution) { - msoLogger.info(" ***** Started preProcessRequest *****") + logger.info(" ***** Started preProcessRequest *****") try { @@ -126,13 +129,13 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } public void prepareSDNCRequest(DelegateExecution execution) { - msoLogger.info(" ***** Started prepareSDNCRequest *****") + logger.info(" ***** Started prepareSDNCRequest *****") try { // get variables @@ -327,15 +330,15 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor String sdncTopologyDeleteRequesAsString = utils.formatXml(sdncTopologyDeleteRequest) utils.logAudit(sdncTopologyDeleteRequesAsString) execution.setVariable("sdncAdapterWorkflowRequest", sdncTopologyDeleteRequesAsString) - msoLogger.info("sdncAdapterWorkflowRequest - " + "\n" + sdncTopologyDeleteRequesAsString) + logger.info("sdncAdapterWorkflowRequest - " + "\n" + sdncTopologyDeleteRequesAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DeleteSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - msoLogger.info(" ***** Exit prepareSDNCRequest *****") + logger.info(" ***** Exit prepareSDNCRequest *****") } public void prepareUpdateAfterDeActivateSDNCResource(DelegateExecution execution) { @@ -377,31 +380,31 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor } public void postDeactivateSDNCCall(DelegateExecution execution) { - msoLogger.info(" ***** Started prepareSDNCRequest *****") + logger.info(" ***** Started prepareSDNCRequest *****") String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode") String responseObj = execution.getVariable(Prefix + "SuccessIndicator") - msoLogger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj) - msoLogger.info(" ***** Exit prepareSDNCRequest *****") + logger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj) + logger.info(" ***** Exit prepareSDNCRequest *****") } public void sendSyncResponse(DelegateExecution execution) { - msoLogger.debug(" *** sendSyncResponse *** ") + logger.debug(" *** sendSyncResponse *** ") try { String operationStatus = "finished" // RESTResponse for main flow String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) + logger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) sendWorkflowResponse(execution, 202, resourceOperationResp) execution.setVariable("sentSyncResponse", true) } catch (Exception ex) { String msg = "Exception in sendSyncResponse:" + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.debug(" ***** Exit sendSyncResponse *****") + logger.debug(" ***** Exit sendSyncResponse *****") } -}
\ No newline at end of file +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy index b718e4a2e0..443c8f6616 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 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 @@ -43,7 +45,8 @@ import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.AAIResourcesClient import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory /** * This groovy class supports the <class>Delete3rdONAPE2EServiceInstance.bpmn</class> process. @@ -57,19 +60,19 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso JsonUtils jsonUtil = new JsonUtils() - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, Delete3rdONAPE2EServiceInstance.class) + private static final Logger logger = LoggerFactory.getLogger( Delete3rdONAPE2EServiceInstance.class); public void checkSPPartnerInfoFromAAI (DelegateExecution execution) { - msoLogger.info(" ***** Started checkSPPartnerInfo *****") + logger.info(" ***** Started checkSPPartnerInfo *****") try { //get bpmn inputs from resource request. String requestId = execution.getVariable("mso-request-id") String requestAction = execution.getVariable("requestAction") - msoLogger.info("The requestAction is: " + requestAction) + logger.info("The requestAction is: " + requestAction) String recipeParamsFromRequest = execution.getVariable("recipeParams") - msoLogger.info("The recipeParams is: " + recipeParamsFromRequest) + logger.info("The recipeParams is: " + recipeParamsFromRequest) String resourceInput = execution.getVariable("resourceInput") - msoLogger.info("The resourceInput is: " + resourceInput) + logger.info("The resourceInput is: " + resourceInput) //Get ResourceInput Object ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) // set local resourceInput @@ -101,13 +104,13 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } catch (Exception ex){ String msg = "Exception in checkSPPartnerInfoFromAAI " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) // exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } public void checkLocallCall (DelegateExecution execution) { - msoLogger.info(" ***** Started checkLocallCall *****") + logger.info(" ***** Started checkLocallCall *****") boolean isLocalCall = true String callSource = execution.getVariable(Prefix + "CallSource") @@ -118,7 +121,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } public void preProcessRequest(DelegateExecution execution){ - msoLogger.info(" ***** Started preProcessRequest *****") + logger.info(" ***** Started preProcessRequest *****") String msg = "" try { @@ -127,53 +130,53 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String globalSubscriberId = resourceInputObj.getGlobalSubscriberId() if (isBlank(globalSubscriberId)) { msg = "Input globalSubscriberId is null" - msoLogger.error( msg) + logger.error(msg) } //set local variable execution.setVariable("globalSubscriberId", globalSubscriberId) - msoLogger.info( "globalSubscriberId:" + globalSubscriberId) + logger.info( "globalSubscriberId:" + globalSubscriberId) String serviceType = resourceInputObj.getServiceType() if (isBlank(serviceType)) { msg = "Input serviceType is null" - msoLogger.error( msg) + logger.error(msg) } execution.setVariable("serviceType", serviceType) - msoLogger.info( "serviceType:" + serviceType) + logger.info( "serviceType:" + serviceType) String operationId = resourceInputObj.getOperationId() if (isBlank(operationId)) { msg = "Input operationId is null" - msoLogger.error( msg) + logger.error(msg) } execution.setVariable("operationId", operationId) - msoLogger.info( "operationId:" + operationId) + logger.info( "operationId:" + operationId) String resourceName = resourceInputObj.getResourceInstanceName() if (isBlank(resourceName)) { msg = "Input resourceName is null" - msoLogger.error( msg) + logger.error(msg) } execution.setVariable("resourceName", resourceName) - msoLogger.info("resourceName:" + resourceName) + logger.info("resourceName:" + resourceName) String resourceTemplateId = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() if (isBlank(resourceTemplateId)) { msg = "Input resourceTemplateId is null" - msoLogger.error( msg) + logger.error(msg) } execution.setVariable("resourceTemplateId", resourceTemplateId) - msoLogger.info( "resourceTemplateId:" + resourceTemplateId) + logger.info( "resourceTemplateId:" + resourceTemplateId) } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) // exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } public void prepareUpdateProgress(DelegateExecution execution) { - msoLogger.info(" ***** Started prepareUpdateProgress *****") + logger.info(" ***** Started prepareUpdateProgress *****") ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") String operType = resourceInputObj.getOperationType() String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() @@ -202,11 +205,11 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso </soapenv:Envelope>""" setProgressUpdateVariables(execution, body) - msoLogger.info(" ***** End prepareUpdateProgress *****") + logger.info(" ***** End prepareUpdateProgress *****") } public void prepare3rdONAPRequest(DelegateExecution execution) { - msoLogger.info(" ***** Started prepare3rdONAPRequest *****") + logger.info(" ***** Started prepare3rdONAPRequest *****") String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") String extAPIPath = sppartnerUrl + '/serviceOrder' @@ -257,12 +260,12 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String payload = externalAPIUtil.setTemplate(ExternalAPIUtil.PostServiceOrderRequestsTemplate, valueMap) execution.setVariable(Prefix + "Payload", payload) - msoLogger.info( "Exit " + prepare3rdONAPRequest) + logger.info( "Exit " + prepare3rdONAPRequest) } private void queryServicefrom3rdONAP(DelegateExecution execution) { - msoLogger.info(" ***** Started queryServicefrom3rdONAP *****") + logger.info(" ***** Started queryServicefrom3rdONAP *****") try { String globalSubscriberId = execution.getVariable("globalSubscriberId") @@ -271,7 +274,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso //https://{api_url}/nbi/api/v1/service?relatedParty.id=${globalSubscriberId} String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") String extAPIPath = sppartnerUrl + "/service?relatedParty.id=" + globalSubscriberId - msoLogger.debug("queryServicefrom3rdONAP externalAPIURL is: " + extAPIPath) + logger.debug("queryServicefrom3rdONAP externalAPIURL is: " + extAPIPath) ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create() @@ -279,17 +282,17 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso int responseCode = response.getStatus() execution.setVariable(Prefix + "GetServiceResponseCode", responseCode) - msoLogger.debug("Get Service response code is: " + responseCode) + logger.debug("Get Service response code is: " + responseCode) String extApiResponse = response.readEntity(String.class) execution.setVariable(Prefix + "GetServiceResponse", extApiResponse) - msoLogger.debug("queryServicefrom3rdONAP response body is: " + extApiResponse) + logger.debug("queryServicefrom3rdONAP response body is: " + extApiResponse) //Process Response //200 OK 201 CREATED 202 ACCEPTED if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) { - msoLogger.debug("Get Service Received a Good Response") + logger.debug("Get Service Received a Good Response") JSONArray responseList = new JSONArray(extApiResponse) for(JSONObject obj : responseList) { String svcId = obj.get("id") @@ -302,22 +305,22 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } } else{ - msoLogger.error("Get Service Received a Bad Response Code. Response Code is: " + responseCode) + logger.error("Get Service Received a Bad Response Code. Response Code is: " + responseCode) // exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get Service Received a bad response from 3rdONAP External API") } }catch(Exception e) { - msoLogger.error("queryServicefrom3rdONAP exception:" + e.getMessage()) + logger.error("queryServicefrom3rdONAP exception:" + e.getMessage()) } - msoLogger.info( "Exit " + queryServicefrom3rdONAP) + logger.info( "Exit " + queryServicefrom3rdONAP) } public void doDeleteE2ESIin3rdONAP(DelegateExecution execution) { - msoLogger.info(" ***** Started doDeleteE2ESIin3rdONAP *****") + logger.info(" ***** Started doDeleteE2ESIin3rdONAP *****") try { String extAPIPath = execution.getVariable("ExternalAPIURL") String payload = execution.getVariable(Prefix + "Payload") - msoLogger.debug("doDeleteE2ESIin3rdONAP externalAPIURL is: " + extAPIPath) - msoLogger.debug("doDeleteE2ESIin3rdONAP payload is: " + payload) + logger.debug("doDeleteE2ESIin3rdONAP externalAPIURL is: " + extAPIPath) + logger.debug("doDeleteE2ESIin3rdONAP payload is: " + payload) ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create() execution.setVariable("ServiceOrderId", "") @@ -326,42 +329,42 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso int responseCode = response.getStatus() execution.setVariable(Prefix + "PostServiceOrderResponseCode", responseCode) - msoLogger.debug("Post ServiceOrder response code is: " + responseCode) + logger.debug("Post ServiceOrder response code is: " + responseCode) String extApiResponse = response.readEntity(String.class) JSONObject responseObj = new JSONObject(extApiResponse) execution.setVariable(Prefix + "PostServiceOrderResponse", extApiResponse) - msoLogger.debug("doDeleteE2ESIin3rdONAP response body is: " + extApiResponse) + logger.debug("doDeleteE2ESIin3rdONAP response body is: " + extApiResponse) //Process Response if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) //200 OK 201 CREATED 202 ACCEPTED { - msoLogger.debug("Post ServiceOrder Received a Good Response") + logger.debug("Post ServiceOrder Received a Good Response") String serviceOrderId = responseObj.get("id") execution.setVariable(Prefix + "SuccessIndicator", true) execution.setVariable("ServiceOrderId", serviceOrderId) - msoLogger.info("Post ServiceOrderid is: " + serviceOrderId) + logger.info("Post ServiceOrderid is: " + serviceOrderId) } else{ - msoLogger.error("Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) + logger.error("Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) // exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Post ServiceOrder Received a bad response from 3rdONAP External API") } }catch(Exception e) { - msoLogger.error("doDeleteE2ESIin3rdONAP exception:" + e.getMessage()) + logger.error("doDeleteE2ESIin3rdONAP exception:" + e.getMessage()) } - msoLogger.info( "Exit " + doDeleteE2ESIin3rdONAP) + logger.info( "Exit " + doDeleteE2ESIin3rdONAP) } public void getE2ESIProgressin3rdONAP(DelegateExecution execution) { - msoLogger.info(" ***** Started getE2ESIProgressin3rdONAP *****") + logger.info(" ***** Started getE2ESIProgressin3rdONAP *****") try { String extAPIPath = execution.getVariable("ExternalAPIURL") extAPIPath += "/" + execution.getVariable("ServiceOrderId") - msoLogger.debug("getE2ESIProgressin3rdONAP delete externalAPIURL is: " + extAPIPath) + logger.debug("getE2ESIProgressin3rdONAP delete externalAPIURL is: " + extAPIPath) ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create() @@ -369,18 +372,18 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso int responseCode = response.getStatus() execution.setVariable(Prefix + "GetServiceOrderResponseCode", responseCode) - msoLogger.debug("Get ServiceOrder response code is: " + responseCode) + logger.debug("Get ServiceOrder response code is: " + responseCode) String extApiResponse = response.readEntity(String.class) JSONObject responseObj = new JSONObject(extApiResponse) execution.setVariable(Prefix + "GetServiceOrderResponse", extApiResponse) - utils.log("DEBUG", "getE2ESIProgressin3rdONAP delete response body is: " + extApiResponse) + logger.debug( "getE2ESIProgressin3rdONAP delete response body is: " + extApiResponse) //Process Response //200 OK 201 CREATED 202 ACCEPTED if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) { - msoLogger.debug("Get ServiceOrder Received a Good Response") + logger.debug("Get ServiceOrder Received a Good Response") String orderState = responseObj.get("state") if("REJECTED".equalsIgnoreCase(orderState)) { @@ -398,7 +401,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso execution.setVariable("progress", 100) execution.setVariable("status", "error") execution.setVariable("statusDescription", "Delete Service Order Status get null sppartnerServiceId") - msoLogger.error("null sppartnerServiceId while getting progress from externalAPI") + logger.error("null sppartnerServiceId while getting progress from externalAPI") return } execution.setVariable(Prefix + "SppartnerServiceId", sppartnerServiceId) @@ -435,7 +438,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } } else{ - msoLogger.debug("Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) + logger.debug("Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) execution.setVariable("progress", 100) execution.setVariable("status", "error") execution.setVariable("statusDescription", "Get Delete ServiceOrder Received a bad response") @@ -445,9 +448,9 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso execution.setVariable("progress", 100) execution.setVariable("status", "error") execution.setVariable("statusDescription", "Get Delete ServiceOrder Exception") - msoLogger.error("getE2ESIProgressin3rdONAP exception:" + e.getMessage()) + logger.error("getE2ESIProgressin3rdONAP exception:" + e.getMessage()) } - msoLogger.info( "Exit " + getE2ESIProgressin3rdONAP) + logger.info( "Exit " + getE2ESIProgressin3rdONAP) } /** @@ -457,12 +460,12 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso try { Thread.sleep(5000) } catch(InterruptedException e) { - msoLogger.error("Time Delay exception" + e ) + logger.error("Time Delay exception" + e ) } } private void getSPPartnerInAAI(DelegateExecution execution) { - msoLogger.info(" ***** Started getSPPartnerInAAI *****") + logger.info(" ***** Started getSPPartnerInAAI *****") try { String id = execution.getVariable(Prefix + "SppartnerId") @@ -470,33 +473,33 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SP_PARTNER, id) SpPartner sp = client.get(uri).asBean(SpPartner.class).get() - msoLogger.debug("GET sppartner Received a Good Response") + logger.debug("GET sppartner Received a Good Response") execution.setVariable(Prefix + "SuccessIndicator", true) execution.setVariable(Prefix + "FoundIndicator", true) // String sppartnerId = sp.getSpPartnerId() // execution.setVariable(Prefix + "SppartnerId", sppartnerId) -// msoLogger.debug(" SppartnerId is: " + sppartnerId) +// logger.debug(" SppartnerId is: " + sppartnerId) String sppartnerUrl = sp.getUrl() execution.setVariable(Prefix + "SppartnerUrl", sppartnerUrl) - msoLogger.debug(" SppartnerUrl is: " + sppartnerUrl) + logger.debug(" SppartnerUrl is: " + sppartnerUrl) String callSource = sp.getCallsource() execution.setVariable(Prefix + "CallSource", callSource) - msoLogger.debug(" CallSource is: " + callSource) + logger.debug(" CallSource is: " + callSource) String sppartnerVersion = sp.getResourceVersion() execution.setVariable(Prefix + "SppartnerVersion", sppartnerVersion) - msoLogger.debug(" Resource Version is: " + sppartnerVersion) + logger.debug(" Resource Version is: " + sppartnerVersion) } catch (Exception ex) { String msg = "Exception in Delete3rdONAPE2EServiceInstance.saveSPPartnerInAAI. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) // throw new BpmnError("MSOWorkflowException") } - msoLogger.info( "Exit " + getSPPartnerInAAI) + logger.info( "Exit " + getSPPartnerInAAI) } public void deleteSPPartnerInAAI(DelegateExecution execution) { - msoLogger.info(" ***** Started deleteSPPartnerInAAI *****") + logger.info(" ***** Started deleteSPPartnerInAAI *****") try { String sppartnerId = execution.getVariable(Prefix + "SppartnerId") @@ -504,16 +507,16 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso AAIResourcesClient client = new AAIResourcesClient() AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SP_PARTNER, sppartnerId) client.delete(uri) - msoLogger.debug("Delete sppartner Received a Good Response") + logger.debug("Delete sppartner Received a Good Response") execution.setVariable(Prefix + "SuccessIndicator", true) } catch (Exception ex) { String msg = "Exception in Delete3rdONAPE2EServiceInstance.deleteSPPartnerInAAI. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) // throw new BpmnError("MSOWorkflowException") } - msoLogger.info( "Exit " + deleteSPPartnerInAAI) + logger.info( "Exit " + deleteSPPartnerInAAI) } private void setProgressUpdateVariables(DelegateExecution execution, String body) { @@ -523,30 +526,30 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } public void postProcess(DelegateExecution execution){ - msoLogger.info(" ***** Started postProcess *****") + logger.info(" ***** Started postProcess *****") String responseCode = execution.getVariable(Prefix + "PutSppartnerResponseCode") String responseObj = execution.getVariable(Prefix + "PutSppartnerResponse") - msoLogger.info("response from AAI for put sppartner, response code :" + responseCode + " response object :" + responseObj) - msoLogger.info(" ***** Exit postProcess *****") + logger.info("response from AAI for put sppartner, response code :" + responseCode + " response object :" + responseObj) + logger.info(" ***** Exit postProcess *****") } public void sendSyncResponse (DelegateExecution execution) { - msoLogger.debug(" *** sendSyncResponse *** ") + logger.debug(" *** sendSyncResponse *** ") try { String operationStatus = "finished" // RESTResponse for main flow String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) + logger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) sendWorkflowResponse(execution, 202, resourceOperationResp) execution.setVariable("sentSyncResponse", true) } catch (Exception ex) { String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) // exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.debug(" ***** Exit sendSyncResopnse *****") + logger.debug(" ***** Exit sendSyncResopnse *****") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy index 5bb8c83628..a9b1fdaac3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy @@ -6,6 +6,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 @@ -34,7 +36,8 @@ import org.onap.so.bpmn.common.scripts.VidUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils; import groovy.json.* @@ -49,23 +52,23 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() VidUtils vidUtils = new VidUtils() - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteCustomE2EServiceInstance.class); + private static final Logger logger = LoggerFactory.getLogger( DeleteCustomE2EServiceInstance.class); public void preProcessRequest (DelegateExecution execution) { execution.setVariable("prefix",Prefix) String msg = "" - msoLogger.info("Starting preProcessRequest") + logger.info("Starting preProcessRequest") try { // check for incoming json message/input String siRequest = execution.getVariable("bpmnRequest") - msoLogger.debug(siRequest) + logger.debug(siRequest) String requestId = execution.getVariable("mso-request-id") execution.setVariable("msoRequestId", requestId) - msoLogger.info("Input Request:" + siRequest + " reqId:" + requestId) + logger.info("Input Request:" + siRequest + " reqId:" + requestId) String serviceInstanceId = execution.getVariable("serviceInstanceId") if (isBlank(serviceInstanceId)) { @@ -79,7 +82,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor // if (isBlank(productFamilyId)) // { // msg = "Input productFamilyId is null" -// utils.log("INFO", msg, isDebugEnabled) +// logger.info( msg) // //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) // } else { // execution.setVariable("productFamilyId", productFamilyId) @@ -91,7 +94,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "globalSubscriberId") if (isBlank(globalSubscriberId)) { msg = "Input globalSubscriberId' is null" - msoLogger.info(msg) + logger.info(msg) } else { execution.setVariable("globalSubscriberId", globalSubscriberId) } @@ -100,7 +103,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "serviceType") if (isBlank(subscriptionServiceType)) { msg = "Input subscriptionServiceType is null" - msoLogger.debug(msg) + logger.debug(msg) //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } else { execution.setVariable("subscriptionServiceType", subscriptionServiceType) @@ -113,31 +116,31 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor throw e } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit preProcessRequest") + logger.trace("Exit preProcessRequest") } public void sendSyncResponse (DelegateExecution execution) { - msoLogger.trace("Staring sendSyncResponse") + logger.trace("Staring sendSyncResponse") try { String operationId = execution.getVariable("operationId") String syncResponse = """{"operationId":"${operationId}"}""".trim() - msoLogger.info("sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse) + logger.info("sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse) sendWorkflowResponse(execution, 202, syncResponse) } catch (Exception ex) { String msg = "Exception in sendSyncResponse: " + ex.getMessage() exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - msoLogger.trace("Exit sendSyncResopnse") + logger.trace("Exit sendSyncResopnse") } public void sendSyncError (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.info("Starting sendSyncError") + logger.info("Starting sendSyncError") try { String errorMessage = "" @@ -154,17 +157,17 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor <aetgt:ErrorCode>7000</aetgt:ErrorCode> </aetgt:WorkflowException>""" - msoLogger.info(buildworkflowException) + logger.info(buildworkflowException) sendWorkflowResponse(execution, 500, buildworkflowException) } catch (Exception ex) { - msoLogger.info("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + logger.info("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) } } public void prepareCompletionRequest (DelegateExecution execution) { - msoLogger.trace("Starting prepareCompletion") + logger.trace("Starting prepareCompletion") try { String requestId = execution.getVariable("msoRequestId") @@ -185,23 +188,23 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) execution.setVariable("completionRequest", xmlMsoCompletionRequest) - msoLogger.info(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + logger.info(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) } catch (Exception ex) { String msg = " Exception in prepareCompletion:" + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit prepareCompletionRequest") + logger.trace("Exit prepareCompletionRequest") } public void prepareFalloutRequest(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("Starting prepareFalloutRequest ") + logger.trace("Starting prepareFalloutRequest ") try { WorkflowException wfex = execution.getVariable("WorkflowException") - msoLogger.info(" Input Workflow Exception: " + wfex.toString()) + logger.info(" Input Workflow Exception: " + wfex.toString()) String requestId = execution.getVariable("msoRequestId") String source = execution.getVariable("source") String requestInfo = @@ -214,7 +217,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) execution.setVariable("falloutRequest", falloutRequest) } catch (Exception ex) { - msoLogger.info("Exception prepareFalloutRequest:" + ex.getMessage()) + logger.info("Exception prepareFalloutRequest:" + ex.getMessage()) String errorException = " Bpmn error encountered in CreateServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() String requestId = execution.getVariable("msoRequestId") String falloutRequest = @@ -234,7 +237,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor execution.setVariable("falloutRequest", falloutRequest) } - msoLogger.trace("Exit prepareFalloutRequest") + logger.trace("Exit prepareFalloutRequest") } @@ -246,7 +249,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor execution.setVariable("prefix", Prefix) try { - msoLogger.info("Starting prepareDBRequest") + logger.info("Starting prepareDBRequest") String requestId = execution.getVariable("DELSI_requestId") String statusMessage = "E2E Service Instance successfully deleted." @@ -269,7 +272,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor String buildDeleteDBRequestAsString = utils.formatXml(dbRequest) execution.setVariable("DELSI_createDBRequest", buildDeleteDBRequestAsString) - msoLogger.info(buildDeleteDBRequestAsString) + logger.info(buildDeleteDBRequestAsString) } catch (Exception ex) { // try error in method block @@ -287,7 +290,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) - msoLogger.trace("Start prepareDBRequestError") + logger.trace("Start prepareDBRequestError") try { String requestId = execution.getVariable("DELSI_requestId") @@ -317,7 +320,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor String buildDBRequestAsString = utils.formatXml(dbRequest) execution.setVariable("DELSI_createDBInfraErrorRequest", buildDBRequestAsString) - msoLogger.info(buildDBRequestAsString) + logger.info(buildDBRequestAsString) } catch (Exception ex) { // try error in method block @@ -336,7 +339,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor * Init the service Operation Status */ public void prepareInitServiceOperationStatus(DelegateExecution execution){ - msoLogger.debug("======== STARTED prepareInitServiceOperationStatus Process ======== ") + logger.debug("======== STARTED prepareInitServiceOperationStatus Process ======== ") try{ String serviceId = execution.getVariable("serviceInstanceId") String operationId = execution.getVariable("operationId") @@ -345,12 +348,12 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor String progress = "0" String reason = "" String operationContent = "Prepare service creation" - msoLogger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId) + logger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId) serviceId = UriUtils.encode(serviceId,"UTF-8") def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - msoLogger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint) + logger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint) String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" @@ -372,12 +375,12 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor payload = utils.formatXml(payload) execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) - msoLogger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload) + logger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload) }catch(Exception e){ - msoLogger.error("Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e) + logger.error("Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e) execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) } - msoLogger.debug("======== COMPLETED prepareInitServiceOperationStatus Process ======== ") + logger.debug("======== COMPLETED prepareInitServiceOperationStatus Process ======== ") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy index 05e0f23925..7abdd49d1d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 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 @@ -39,7 +41,8 @@ import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.AAIResourcesClient import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import java.util.UUID; @@ -64,20 +67,20 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { JsonUtils jsonUtil = new JsonUtils() - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteDeviceResource.class) + private static final Logger logger = LoggerFactory.getLogger( DeleteDeviceResource.class); public void preProcessRequest(DelegateExecution execution){ - msoLogger.info(" ***** Started preProcessRequest *****") + logger.info(" ***** Started preProcessRequest *****") try { //get bpmn inputs from resource request. String requestId = execution.getVariable("mso-request-id") String requestAction = execution.getVariable("requestAction") - msoLogger.info("The requestAction is: " + requestAction) + logger.info("The requestAction is: " + requestAction) String recipeParamsFromRequest = execution.getVariable("recipeParams") - msoLogger.info("The recipeParams is: " + recipeParamsFromRequest) + logger.info("The recipeParams is: " + recipeParamsFromRequest) String resourceInput = execution.getVariable("resourceInput") - msoLogger.info("The resourceInput is: " + resourceInput) + logger.info("The resourceInput is: " + resourceInput) //Get ResourceInput Object ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) execution.setVariable(Prefix + "ResourceInput", resourceInputObj) @@ -101,13 +104,13 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { } catch (Exception ex){ String msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) // exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } private void getDeviceInAAI(DelegateExecution execution) { - msoLogger.info(" ***** Started getDeviceInAAI *****") + logger.info(" ***** Started getDeviceInAAI *****") try { String deviceId = execution.getVariable(Prefix + "DeviceId") @@ -117,19 +120,19 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { String devClass = dev.getClass () execution.setVariable(Prefix + "DeviceClass", devClass) - msoLogger.debug(" DeviceClass is: " + devClass) + logger.debug(" DeviceClass is: " + devClass) } catch (Exception ex){ String msg = "Exception in getDeviceInAAI " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) // exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.info(" ***** Exit getDeviceInAAI *****") + logger.info(" ***** Exit getDeviceInAAI *****") } public void checkDevType(DelegateExecution execution){ - msoLogger.info(" ***** Started checkDevType *****") + logger.info(" ***** Started checkDevType *****") try { String devType = execution.getVariable(Prefix + "DeviceClass") @@ -142,7 +145,7 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { } catch (Exception ex){ String msg = "Exception in checkDevType " + ex.getMessage() - msoLogger.debug( msg) + logger.debug( msg) // exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } @@ -154,7 +157,7 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { } public void prepareUpdateProgress(DelegateExecution execution) { - msoLogger.info(" ***** Started prepareUpdateProgress *****") + logger.info(" ***** Started prepareUpdateProgress *****") ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") String operType = resourceInputObj.getOperationType() String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() @@ -183,51 +186,51 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor { </soapenv:Envelope>""" setProgressUpdateVariables(execution, body) - msoLogger.info(" ***** Exit prepareUpdateProgress *****") + logger.info(" ***** Exit prepareUpdateProgress *****") } public void getVNFTemplatefromSDC(DelegateExecution execution){ - msoLogger.info(" ***** Started getVNFTemplatefromSDC *****") + logger.info(" ***** Started getVNFTemplatefromSDC *****") try { // To do } catch (Exception ex){ String msg = "Exception in getVNFTemplatefromSDC " + ex.getMessage() - msoLogger.debug( msg) + logger.debug( msg) // exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } public void postVNFInfoProcess(DelegateExecution execution){ - msoLogger.info(" ***** Started postVNFInfoProcess *****") + logger.info(" ***** Started postVNFInfoProcess *****") try { // To do } catch (Exception ex){ String msg = "Exception in postVNFInfoProcess " + ex.getMessage() - msoLogger.debug( msg) + logger.debug( msg) // exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } public void sendSyncResponse (DelegateExecution execution) { - msoLogger.debug( " *** sendSyncResponse *** ") + logger.debug( " *** sendSyncResponse *** ") try { String operationStatus = "finished" // RESTResponse for main flow String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - msoLogger.debug( " sendSyncResponse to APIH:" + "\n" + resourceOperationResp) + logger.debug( " sendSyncResponse to APIH:" + "\n" + resourceOperationResp) sendWorkflowResponse(execution, 202, resourceOperationResp) execution.setVariable("sentSyncResponse", true) } catch (Exception ex) { String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - msoLogger.debug( msg) + logger.debug( msg) // exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.debug(" ***** Exit sendSyncResopnse *****") + logger.debug(" ***** Exit sendSyncResopnse *****") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy index ec2fed50c3..3542828a98 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -31,7 +33,8 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.VidUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import groovy.json.* @@ -46,14 +49,14 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro JsonUtils jsonUtil = new JsonUtils() VidUtils vidUtils = new VidUtils() - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteGenericALaCarteServiceInstance.class); + private static final Logger logger = LoggerFactory.getLogger( DeleteGenericALaCarteServiceInstance.class); public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) String msg = "" - msoLogger.trace("Start preProcessRequest") + logger.trace("Start preProcessRequest") try { // check for incoming json message/input @@ -61,7 +64,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro String requestId = execution.getVariable("mso-request-id") execution.setVariable("msoRequestId", requestId) - msoLogger.debug("Input Request:" + siRequest + " reqId:" + requestId) + logger.debug("Input Request:" + siRequest + " reqId:" + requestId) String serviceInstanceId = execution.getVariable("serviceInstanceId") if (isBlank(serviceInstanceId)) { @@ -76,11 +79,11 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") if (isBlank(serviceModelInfo)) { msg = "Input serviceModelInfo is null" - msoLogger.debug(msg) + logger.debug(msg) } else { execution.setVariable("serviceModelInfo", serviceModelInfo) - //msoLogger.debug("modelInfo" + serviceModelInfo) + //logger.debug("modelInfo" + serviceModelInfo) } //requestInfo @@ -88,7 +91,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro if (isBlank(productFamilyId)) { msg = "Input productFamilyId is null" - msoLogger.debug(msg) + logger.debug(msg) //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } else { execution.setVariable("productFamilyId", productFamilyId) @@ -100,7 +103,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId") if (isBlank(globalSubscriberId)) { msg = "Input globalSubscriberId' is null" - msoLogger.debug(msg) + logger.debug(msg) } else { execution.setVariable("globalSubscriberId", globalSubscriberId) } @@ -109,7 +112,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType") if (isBlank(subscriptionServiceType)) { msg = "Input subscriptionServiceType is null" - msoLogger.debug(msg) + logger.debug(msg) //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } else { execution.setVariable("subscriptionServiceType", subscriptionServiceType) @@ -133,22 +136,22 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro } } - msoLogger.debug("User Input Parameters map: " + userParams.toString()) + logger.debug("User Input Parameters map: " + userParams.toString()) execution.setVariable("serviceInputParams", inputMap) } catch (BpmnError e) { throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit preProcessRequest") + logger.trace("Exit preProcessRequest") } public void sendSyncResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("Start sendSyncResponse") + logger.trace("Start sendSyncResponse") try { String requestId = execution.getVariable("msoRequestId") @@ -156,19 +159,19 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro // RESTResponse (for API Handler (APIH) Reply Task) String syncResponse = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() - msoLogger.debug(" sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse) + logger.debug(" sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse) sendWorkflowResponse(execution, 202, syncResponse) } catch (Exception ex) { String msg = "Exception in sendSyncResponse: " + ex.getMessage() exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - msoLogger.trace("Exit sendSyncResopnse") + logger.trace("Exit sendSyncResopnse") } public void sendSyncError (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("Start sendSyncError") + logger.trace("Start sendSyncError") try { String errorMessage = "" @@ -185,18 +188,18 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro <aetgt:ErrorCode>7000</aetgt:ErrorCode> </aetgt:WorkflowException>""" - MsoLogger.info(buildworkflowException) + logger.info(buildworkflowException) sendWorkflowResponse(execution, 500, buildworkflowException) } catch (Exception ex) { - msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + logger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) } } public void prepareCompletionRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("Start prepareCompletion") + logger.trace("Start prepareCompletion") try { String requestId = execution.getVariable("msoRequestId") @@ -219,23 +222,23 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) execution.setVariable("completionRequest", xmlMsoCompletionRequest) - msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + logger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) } catch (Exception ex) { String msg = " Exception in prepareCompletion:" + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit prepareCompletionRequest") + logger.trace("Exit prepareCompletionRequest") } public void prepareFalloutRequest(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("Start prepareFalloutRequest") + logger.trace("Start prepareFalloutRequest") try { WorkflowException wfex = execution.getVariable("WorkflowException") - msoLogger.debug(" Input Workflow Exception: " + wfex.toString()) + logger.debug(" Input Workflow Exception: " + wfex.toString()) String requestId = execution.getVariable("msoRequestId") String source = execution.getVariable("source") String requestInfo = @@ -248,7 +251,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) execution.setVariable("falloutRequest", falloutRequest) } catch (Exception ex) { - msoLogger.debug("Exception prepareFalloutRequest:" + ex.getMessage()) + logger.debug("Exception prepareFalloutRequest:" + ex.getMessage()) String errorException = " Bpmn error encountered in CreateServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() String requestId = execution.getVariable("msoRequestId") String falloutRequest = @@ -268,7 +271,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro execution.setVariable("falloutRequest", falloutRequest) } - msoLogger.trace("Exit prepareFalloutRequest ") + logger.trace("Exit prepareFalloutRequest ") } @@ -280,7 +283,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro execution.setVariable("prefix", Prefix) try { - msoLogger.trace("Inside prepareDBRequest of DeleteGenericALaCarteServiceInstance ") + logger.trace("Inside prepareDBRequest of DeleteGenericALaCarteServiceInstance ") String requestId = execution.getVariable("DELSI_requestId") String statusMessage = "Service Instance successfully deleted." @@ -303,7 +306,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro String buildDeleteDBRequestAsString = utils.formatXml(dbRequest) execution.setVariable("DELSI_createDBRequest", buildDeleteDBRequestAsString) - msoLogger.info(buildDeleteDBRequestAsString) + logger.info(buildDeleteDBRequestAsString) } catch (Exception ex) { // try error in method block @@ -321,7 +324,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) - msoLogger.trace("Inside prepareDBRequestError of DeleteGenericALaCarteServiceInstance ") + logger.trace("Inside prepareDBRequestError of DeleteGenericALaCarteServiceInstance ") try { String requestId = execution.getVariable("DELSI_requestId") @@ -351,7 +354,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro String buildDBRequestAsString = utils.formatXml(dbRequest) execution.setVariable("DELSI_createDBInfraErrorRequest", buildDBRequestAsString) - msoLogger.info(buildDBRequestAsString) + logger.info(buildDBRequestAsString) } catch (Exception ex) { // try error in method block diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy index 816ba859ee..0008f6fd65 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -31,6 +33,8 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils; import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import groovy.json.* @@ -42,7 +46,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { VidUtils vidUtils = new VidUtils(this) NetworkUtils networkUtils = new NetworkUtils() - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteNetworkInstance.class); + private static final Logger logger = LoggerFactory.getLogger( DeleteNetworkInstance.class); public InitializeProcessVariables(DelegateExecution execution){ @@ -63,7 +67,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside preProcessRequest() of " + groovyClassName + "") + logger.trace("Inside preProcessRequest() of " + groovyClassName + "") try { // initialize flow variables @@ -79,20 +83,20 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { String disableRollback = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.requestInfo.suppressRollback") if (disableRollback != null) { execution.setVariable("disableRollback", disableRollback) - msoLogger.debug("Received 'suppressRollback': " + disableRollback ) + logger.debug("Received 'suppressRollback': " + disableRollback ) } else { execution.setVariable("disableRollback", false) } - msoLogger.debug(" Set 'disableRollback' : " + execution.getVariable("disableRollback") ) + logger.debug(" Set 'disableRollback' : " + execution.getVariable("disableRollback") ) } else { String dataErrorMessage = " Invalid 'bpmnRequest' request." - msoLogger.debug(dataErrorMessage) + logger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } } else { // 'macro' test ONLY, sdncVersion = '1702' - msoLogger.debug(" 'disableRollback' : " + execution.getVariable("disableRollback") ) + logger.debug(" 'disableRollback' : " + execution.getVariable("disableRollback") ) } // get/set 'msoRequestId' and 'mso-request-id' @@ -138,7 +142,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { } catch (Exception ex){ sendSyncError(execution) String exceptionMessage = "Exception Encountered in " + groovyClassName + ", PreProcessRequest() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -149,7 +153,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) - msoLogger.trace("Inside getNetworkModelInfo() of DeleteNetworkInstance") + logger.trace("Inside getNetworkModelInfo() of DeleteNetworkInstance") try { @@ -162,7 +166,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { } catch (Exception ex) { sendSyncError(execution) String exceptionMessage = "Bpmn error encountered in DeleteNetworkInstance flow. getNetworkModelInfo() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -173,7 +177,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside sendSyncResponse() of DeleteNetworkInstance") + logger.trace("Inside sendSyncResponse() of DeleteNetworkInstance") try { String requestId = execution.getVariable("mso-request-id") @@ -182,14 +186,14 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { // RESTResponse (for API Handler (APIH) Reply Task) String deleteNetworkRestRequest = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() - msoLogger.debug(" sendSyncResponse to APIH - " + "\n" + deleteNetworkRestRequest) + logger.debug(" sendSyncResponse to APIH - " + "\n" + deleteNetworkRestRequest) sendWorkflowResponse(execution, 202, deleteNetworkRestRequest) } catch (Exception ex) { // caught exception String exceptionMessage = "Exception Encountered in DeleteNetworkInstance, sendSyncResponse() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -200,7 +204,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside prepareCompletion() of CreateNetworkInstance") + logger.trace("Inside prepareCompletion() of CreateNetworkInstance") try { @@ -224,11 +228,11 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { // normal path execution.setVariable(Prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest) - msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + logger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in CreateNetworkInstance flow. prepareCompletion() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -241,7 +245,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) try { - msoLogger.trace("Inside prepareDBRequestError of DeleteNetworkInstance") + logger.trace("Inside prepareDBRequestError of DeleteNetworkInstance") // set DB Header Authorization setBasicDBAuthHeader(execution, isDebugEnabled) @@ -267,12 +271,12 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { </soapenv:Envelope>""" execution.setVariable(Prefix + "deleteDBRequest", dbRequest) - msoLogger.debug(" DB Adapter Request - " + "\n" + dbRequest) + logger.debug(" DB Adapter Request - " + "\n" + dbRequest) } catch (Exception ex) { // caught exception String exceptionMessage = "Bpmn error encountered in DeleteNetworkInstance, prepareDBRequestError() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) } @@ -287,24 +291,24 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) - msoLogger.trace("Inside postProcessResponse() of DeleteNetworkInstance") + logger.trace("Inside postProcessResponse() of DeleteNetworkInstance") try { if (execution.getVariable("CMSO_ResponseCode") == "200") { execution.setVariable(Prefix + "Success", true) - msoLogger.trace("DeleteNetworkInstance Success") + logger.trace("DeleteNetworkInstance Success") // Place holder for additional code. } else { execution.setVariable(Prefix + "Success", false) - msoLogger.trace("DeleteNetworkInstance Failed in CompletionMsoProces flow!.") + logger.trace("DeleteNetworkInstance Failed in CompletionMsoProces flow!.") } } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DeleteNetworkInstance flow. postProcessResponse() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -321,11 +325,11 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) - msoLogger.trace("Prepare for FalloutHandler. FAILURE - prepare request for sub-process FalloutHandler.") + logger.trace("Prepare for FalloutHandler. FAILURE - prepare request for sub-process FalloutHandler.") String dbReturnCode = execution.getVariable(Prefix + "dbReturnCode") - msoLogger.debug("DB Update Response Code : " + dbReturnCode) - msoLogger.debug("DB Update Response String: " + '\n' + execution.getVariable(Prefix + "deleteDBResponse")) + logger.debug("DB Update Response Code : " + dbReturnCode) + logger.debug("DB Update Response String: " + '\n' + execution.getVariable(Prefix + "deleteDBResponse")) String falloutHandlerRequest = "" String requestId = execution.getVariable("mso-request-id") @@ -351,14 +355,16 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { </aetgt:WorkflowException> </aetgt:FalloutHandlerRequest>""" - msoLogger.debug(falloutHandlerRequest) + logger.debug(falloutHandlerRequest) execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG,"Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest,"BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "") + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue()) } catch (Exception ex) { // caught exception String exceptionMessage = "Bpmn error encountered in DeleteNetworkInstance, buildErrorResponse() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) falloutHandlerRequest = """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:ns="http://org.onap/so/request/types/v1" @@ -374,7 +380,9 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { </aetgt:WorkflowException> </aetgt:FalloutHandlerRequest>""" execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG,"Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest,"BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex) + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest,"BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex) } } @@ -390,12 +398,12 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { // RESTResponse (for API Handler (APIH) Reply Task) String deleteNetworkRestError = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() - msoLogger.debug(" sendSyncResponse to APIH - " + "\n" + deleteNetworkRestError) + logger.debug(" sendSyncResponse to APIH - " + "\n" + deleteNetworkRestError) sendWorkflowResponse(execution, 500, deleteNetworkRestError) } catch (Exception ex) { - msoLogger.debug(" Sending Sync Error Activity Failed - DeleteNetworkInstance, sendSyncError(): " + "\n" + ex.getMessage()) + logger.debug(" Sending Sync Error Activity Failed - DeleteNetworkInstance, sendSyncError(): " + "\n" + ex.getMessage()) } } @@ -403,18 +411,18 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) try{ - msoLogger.debug("Caught a Java Exception") - msoLogger.debug("Started processJavaException Method") - msoLogger.debug("Variables List: " + execution.getVariables()) + logger.debug("Caught a Java Exception") + logger.debug("Started processJavaException Method") + logger.debug("Variables List: " + execution.getVariables()) execution.setVariable("UnexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") }catch(Exception e){ - msoLogger.debug("Caught Exception during processJavaException Method: " + e) + logger.debug("Caught Exception during processJavaException Method: " + e) execution.setVariable("UnexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method") } - msoLogger.debug("Completed processJavaException Method of " + Prefix) + logger.debug("Completed processJavaException Method of " + Prefix) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy index cf781933f6..0dc86632e2 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 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 @@ -31,7 +33,8 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import static org.apache.commons.lang3.StringUtils.* @@ -40,7 +43,7 @@ import static org.apache.commons.lang3.StringUtils.* * flow for SDNC Network Resource */ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteSDNCNetworkResource.class); + private static final Logger logger = LoggerFactory.getLogger( DeleteSDNCNetworkResource.class); String Prefix="DELSDNCRES_" @@ -53,17 +56,17 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { MsoUtils msoUtils = new MsoUtils() public void preProcessRequest(DelegateExecution execution){ - msoLogger.info(" ***** Started preProcessRequest *****") + logger.info(" ***** Started preProcessRequest *****") try { //get bpmn inputs from resource request. String requestId = execution.getVariable("mso-request-id") String requestAction = execution.getVariable("requestAction") - msoLogger.info("The requestAction is: " + requestAction) + logger.info("The requestAction is: " + requestAction) String recipeParamsFromRequest = execution.getVariable("recipeParams") - msoLogger.info("The recipeParams is: " + recipeParamsFromRequest) + logger.info("The recipeParams is: " + recipeParamsFromRequest) String resourceInput = execution.getVariable("resourceInput") - msoLogger.info("The resourceInput is: " + resourceInput) + logger.info("The resourceInput is: " + resourceInput) //Get ResourceInput Object ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) execution.setVariable(Prefix + "resourceInput", resourceInputObj) @@ -146,7 +149,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug( msg) + logger.debug( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } @@ -158,7 +161,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { * generate the nsParameters */ public void prepareSDNCRequest (DelegateExecution execution) { - msoLogger.info(" ***** Started prepareSDNCRequest *****") + logger.info(" ***** Started prepareSDNCRequest *****") try { // get variables @@ -353,15 +356,15 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { String sdncTopologyDeleteRequesAsString = utils.formatXml(sdncTopologyDeleteRequest) utils.logAudit(sdncTopologyDeleteRequesAsString) execution.setVariable("sdncAdapterWorkflowRequest", sdncTopologyDeleteRequesAsString) - msoLogger.info("sdncAdapterWorkflowRequest - " + "\n" + sdncTopologyDeleteRequesAsString) + logger.info("sdncAdapterWorkflowRequest - " + "\n" + sdncTopologyDeleteRequesAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DeleteSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage() - msoLogger.debug( exceptionMessage) + logger.debug( exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - msoLogger.info(" ***** Exit prepareSDNCRequest *****") + logger.info(" ***** Exit prepareSDNCRequest *****") } private void setProgressUpdateVariables(DelegateExecution execution, String body) { @@ -436,30 +439,30 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { } public void postDeleteSDNCCall(DelegateExecution execution){ - msoLogger.info(" ***** Started prepareSDNCRequest *****") + logger.info(" ***** Started prepareSDNCRequest *****") String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode") String responseObj = execution.getVariable(Prefix + "SuccessIndicator") - msoLogger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj) - msoLogger.info(" ***** Exit prepareSDNCRequest *****") + logger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj) + logger.info(" ***** Exit prepareSDNCRequest *****") } public void sendSyncResponse (DelegateExecution execution) { - msoLogger.debug( " *** sendSyncResponse *** ") + logger.debug( " *** sendSyncResponse *** ") try { String operationStatus = "finished" // RESTResponse for main flow String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - msoLogger.debug( " sendSyncResponse to APIH:" + "\n" + resourceOperationResp) + logger.debug( " sendSyncResponse to APIH:" + "\n" + resourceOperationResp) sendWorkflowResponse(execution, 202, resourceOperationResp) execution.setVariable("sentSyncResponse", true) } catch (Exception ex) { String msg = "Exception in sendSyncResponse:" + ex.getMessage() - msoLogger.debug( msg) + logger.debug( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.debug(" ***** Exit sendSyncResponse *****") + logger.debug(" ***** Exit sendSyncResponse *****") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy index 536783bc33..9b269c734f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy @@ -5,6 +5,8 @@ * ================================================================================ * Copyright (C) 2018 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 @@ -26,6 +28,8 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.slf4j.Logger +import org.slf4j.LoggerFactory public class DeleteVFCNSResource extends AbstractServiceTaskProcessor { @@ -34,9 +38,11 @@ public class DeleteVFCNSResource extends AbstractServiceTaskProcessor { ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() + private static final Logger logger = LoggerFactory.getLogger( DeleteVFCNSResource.class); + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** start preProcessRequest *****", isDebugEnabled) + logger.info(" ***** start preProcessRequest *****") String resourceInputStr = execution.getVariable("resourceInput") ResourceInput resourceInput = new ObjectMapper().readValue(resourceInputStr, ResourceInput.class) @@ -54,34 +60,34 @@ public class DeleteVFCNSResource extends AbstractServiceTaskProcessor { execution.setVariable("resourceTemplateId", resourceModeluuid) execution.setVariable("resourceInstanceId", resourceInstanceId) - utils.log("INFO"," ***** end preProcessRequest *****", isDebugEnabled) + logger.info(" ***** end preProcessRequest *****") } public void postProcessRequest (DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** start postProcessRequest *****", isDebugEnabled) + logger.info(" ***** start postProcessRequest *****") - utils.log("INFO"," ***** end postProcessRequest *****", isDebugEnabled) + logger.info(" ***** end postProcessRequest *****") } public void sendSyncResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) + logger.debug( " *** sendSyncResponse *** ") try { String nsInstanceId = execution.getVariable("nsInstanceId") String operationStatus = execution.getVariable("operationStatus") // RESTResponse for main flow String createVFCResourceRestRsp = """{"nsInstanceId":"${nsInstanceId}","operationStatus":"${operationStatus}"}""".trim() - utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + createVFCResourceRestRsp, isDebugEnabled) + logger.debug( " sendSyncResponse to APIH:" + "\n" + createVFCResourceRestRsp) sendWorkflowResponse(execution, 202, createVFCResourceRestRsp) execution.setVariable("sentSyncResponse", true) } catch (Exception ex) { String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) + logger.debug( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) + logger.debug(" ***** Exit sendSyncResopnse *****") } -}
\ No newline at end of file +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy index 682421e806..357ce69d50 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -30,6 +32,8 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils; import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import groovy.json.JsonSlurper @@ -37,7 +41,7 @@ import groovy.json.JsonSlurper public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteVfModuleInfra.class); + private static final Logger logger = LoggerFactory.getLogger( DeleteVfModuleInfra.class); ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() /** @@ -70,7 +74,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { def method = getClass().getSimpleName() + '.preProcessRequest(' + 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable("isVidRequest", "false") initProcessVariables(execution) @@ -79,25 +83,25 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { def incomingRequest = execution.getVariable('bpmnRequest') def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - msoLogger.debug("Incoming Infra Request: " + incomingRequest) + logger.debug("Incoming Infra Request: " + incomingRequest) // check if request is xml or json try { def jsonSlurper = new JsonSlurper() Map reqMap = jsonSlurper.parseText(incomingRequest) - msoLogger.debug(" Request is in JSON format.") + logger.debug(" Request is in JSON format.") def serviceInstanceId = execution.getVariable('serviceInstanceId') - msoLogger.debug("serviceInstanceId is: " + serviceInstanceId) + logger.debug("serviceInstanceId is: " + serviceInstanceId) def vnfId = execution.getVariable('vnfId') - msoLogger.debug("vnfId is: " + vnfId) + logger.debug("vnfId is: " + vnfId) def cloudConfiguration = jsonUtil.getJsonValue(incomingRequest, "requestDetails.cloudConfiguration") execution.setVariable("cloudConfiguration", cloudConfiguration) - msoLogger.debug("CloudConfiguration is: " + cloudConfiguration) + logger.debug("CloudConfiguration is: " + cloudConfiguration) def vfModuleModelInfo = jsonUtil.getJsonValue(incomingRequest, "requestDetails.modelInfo") execution.setVariable("vfModuleModelInfo", vfModuleModelInfo) - msoLogger.debug("VfModuleModelInfo is: " + vfModuleModelInfo) + logger.debug("VfModuleModelInfo is: " + vfModuleModelInfo) // This is aLaCarte flow, so aLaCarte flag is always on execution.setVariable('aLaCarte', true) @@ -106,7 +110,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { String requestInXmlFormat = vidUtils.createXmlVfModuleRequest(execution, reqMap, 'DELETE_VF_MODULE', serviceInstanceId) - msoLogger.debug(" Request in XML format: " + requestInXmlFormat) + logger.debug(" Request in XML format: " + requestInXmlFormat) setBasicDBAuthHeader(execution, isDebugLogEnabled) @@ -116,13 +120,15 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { } catch(groovy.json.JsonException je) { - msoLogger.debug(" Request is not in JSON format.") + logger.debug(" Request is not in JSON format.") exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request") } catch(Exception e) { String restFaultMessage = e.getMessage() - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG,"Caught exception", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception", + "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), + "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request") } @@ -131,7 +137,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { String request = validateRequest(execution) execution.setVariable('DeleteVfModuleRequest', request) - msoLogger.debug("DeleteVfModuleInfra Request: " + request) + logger.debug("DeleteVfModuleInfra Request: " + request) def requestInfo = getRequiredNodeXml(execution, request, 'request-info') execution.setVariable('DELVfModI_requestInfo', requestInfo) @@ -149,11 +155,13 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { def vnfParams = utils.getNodeXml(request, 'vnf-params') execution.setVariable('DELVfModI_vnfParams', vnfParams) - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG,"Caught exception in "+method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Caught exception in " + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) } } @@ -168,7 +176,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def requestInfo = execution.getVariable('DELVfModI_requestInfo') @@ -187,14 +195,16 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { def vfModuleId = execution.getVariable('DELVfModI_vfModuleId') String synchResponse = """{"requestReferences":{"instanceId":"${vfModuleId}","requestId":"${requestId}"}}""".trim() - msoLogger.debug("DeleteVfModuleInfra Synch Response: " + synchResponse) + logger.debug("DeleteVfModuleInfra Synch Response: " + synchResponse) sendWorkflowResponse(execution, 200, synchResponse) - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG,"Caught exception in "+method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Caught exception in " + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) } } @@ -211,15 +221,15 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoDeleteVfModule(): ' + e.getMessage()) } } @@ -234,7 +244,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def requestId = execution.getVariable('DELVfModI_requestId') @@ -260,13 +270,15 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { updateInfraRequest = utils.formatXml(updateInfraRequest) execution.setVariable('DELVfModI_updateInfraRequest', updateInfraRequest) - msoLogger.debug('Request for Update Infra Request:\n' + updateInfraRequest) + logger.debug('Request for Update Infra Request:\n' + updateInfraRequest) - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepInfraRequest(): ' + e.getMessage()) } } @@ -283,7 +295,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { ', resultVar=' + resultVar + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def request = execution.getVariable("DeleteVfModuleRequest") @@ -302,14 +314,16 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { </aetgt:MsoCompletionRequest>""" content = utils.formatXml(content) - msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content) + logger.debug(resultVar + ' = ' + System.lineSeparator() + content) execution.setVariable(resultVar, content) - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') } } @@ -326,7 +340,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { ', resultVar=' + resultVar + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def prefix = execution.getVariable('prefix') @@ -353,14 +367,16 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { </sdncadapterworkflow:FalloutHandlerRequest> """ content = utils.formatXml(content) - msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content) + logger.debug(resultVar + ' = ' + System.lineSeparator() + content) execution.setVariable(resultVar, content) - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy index 8c9ab3fe45..9675e89249 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy @@ -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,6 +41,8 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils @@ -50,7 +54,7 @@ import javax.ws.rs.NotFoundException * This groovy class supports the <class>DeleteVfModuleVolume.bpmn</class> process. */ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteVfModuleVolumeInfraV1.class); + private static final Logger logger = LoggerFactory.getLogger( DeleteVfModuleVolumeInfraV1.class); private XmlParser xmlParser = new XmlParser() /** @@ -107,7 +111,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { try { def jsonSlurper = new JsonSlurper() Map reqMap = jsonSlurper.parseText(createVolumeIncoming) - msoLogger.debug(" Request is in JSON format.") + logger.debug(" Request is in JSON format.") def serviceInstanceId = execution.getVariable('serviceInstanceId') def volumeGroupId = execution.getVariable('volumeGroupId') @@ -116,7 +120,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { execution.setVariable("DELVfModVol_isVidRequest", true) } catch(groovy.json.JsonException je) { - msoLogger.debug(" Request is in XML format.") + logger.debug(" Request is in XML format.") // assume request is in XML format - proceed as usual to process XML request } @@ -145,13 +149,13 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { setBasicDBAuthHeader(execution, isDebugLogEnabled) - msoLogger.debug('Request: ' + createVolumeIncoming) + logger.debug('Request: ' + createVolumeIncoming) } public void sendSyncResponse (DelegateExecution execution, isDebugEnabled) { String volumeRequest = execution.getVariable("DELVfModVol_volumeRequest") - msoLogger.debug(" DELVfModVol_volumeRequest - " + "\n" + volumeRequest) + logger.debug(" DELVfModVol_volumeRequest - " + "\n" + volumeRequest) // RESTResponse (for API Handler (APIH) Reply Task) String deleteVolumeRequest = """<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" statusCode="200"> @@ -214,12 +218,12 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { execution.setVariable("DELVfModVol_isCloudRegionGood", true) } else { - msoLogger.debug("AAI Query Cloud Region Unsuccessful.") + logger.debug("AAI Query Cloud Region Unsuccessful.") execution.setVariable("DELVfModVol_isCloudRegionGood", false) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable("DELVfModVol_queryCloudRegionReturnCode")) } - msoLogger.debug(" is Cloud Region Good: " + execution.getVariable("DELVfModVol_isCloudRegionGood")) + logger.debug(" is Cloud Region Good: " + execution.getVariable("DELVfModVol_isCloudRegionGood")) } /** @@ -248,20 +252,20 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { execution.setVariable('DELVfModVol_volumeGroupHeatStackId', heatStackId) if ( volumeGroupWrapper.getRelationships().isPresent() && !volumeGroupWrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.VF_MODULE).isEmpty()) { - msoLogger.debug('Volume Group ' + volumeGroupId + ' currently in use') + logger.debug('Volume Group ' + volumeGroupId + ' currently in use') exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume Group ${volumeGroupId} currently in use - found vf-module relationship.") } def volumeGroupTenantId = getTenantIdFromVolumeGroup(volumeGroupWrapper) if (volumeGroupTenantId == null) { - msoLogger.debug("Could not find Tenant Id element in Volume Group with Volume Group Id ${volumeGroupId}") + logger.debug("Could not find Tenant Id element in Volume Group with Volume Group Id ${volumeGroupId}") exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Could not find Tenant Id element in Volume Group with Volume Group Id ${volumeGroupId}") } execution.setVariable('DELVfModVol_volumeGroupTenantId', volumeGroupTenantId) - msoLogger.debug('Received Tenant Id ' + volumeGroupTenantId + ' from AAI for Volume Group with Volume Group Id ' + volumeGroupId) + logger.debug('Received Tenant Id ' + volumeGroupTenantId + ' from AAI for Volume Group with Volume Group Id ' + volumeGroupId) } else { - msoLogger.debug("Volume Group ${volumeGroupId} not found in AAI") + logger.debug("Volume Group ${volumeGroupId} not found in AAI") exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume Group ${volumeGroupId} not found in AAI. Response code: 404") } }catch (BpmnError e){ @@ -339,7 +343,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { """ vnfAdapterRestRequest = utils.formatXml(vnfAdapterRestRequest) execution.setVariable('DELVfModVol_deleteVnfARequest', vnfAdapterRestRequest) - msoLogger.debug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest) + logger.debug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest) } @@ -354,7 +358,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { try { AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion, groupId) getAAIClient().delete(uri) - msoLogger.debug("Volume group $groupId deleted.") + logger.debug("Volume group $groupId deleted.") }catch(NotFoundException e){ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume group $groupId not found for delete in AAI Response code: 404") }catch(Exception e1){ @@ -401,7 +405,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { updateInfraRequest = utils.formatXml(updateInfraRequest) execution.setVariable('DELVfModVol_updateInfraRequest', updateInfraRequest) - msoLogger.debug('Request for Update Infra Request:\n' + updateInfraRequest) + logger.debug('Request for Update Infra Request:\n' + updateInfraRequest) } @@ -424,13 +428,13 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) execution.setVariable('DELVfModVol_CompleteMsoProcessRequest', xmlMsoCompletionRequest) - msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + logger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) } - public void prepareFalloutHandler (DelegateExecution execution, isDebugEnabled) { + public void prepareFalloutHandler (DelegateExecution execution) { execution.setVariable("DELVfModVol_Success", false) String requestId = execution.getVariable("DELVfModVol_requestId") @@ -457,11 +461,12 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { // Format Response String xmlHandlerRequest = utils.formatXml(falloutHandlerRequest) - msoLogger.debug(xmlHandlerRequest) + logger.debug(xmlHandlerRequest) execution.setVariable("DELVfModVol_FalloutHandlerRequest", xmlHandlerRequest) - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Overall Error Response going to FalloutHandler", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "\n" + xmlHandlerRequest); - + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Overall Error Response going to FalloutHandler", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "\n" + xmlHandlerRequest); } @@ -480,7 +485,9 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { def String errorMessage = 'TenantId ' + tenantId + ' in incoming request does not match Tenant Id ' + volumeGroupTenantId + ' retrieved from AAI for Volume Group Id ' + volumeGroupId - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Error in DeleteVfModuleVolume: " + "\n" + errorMessage, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Error in DeleteVfModuleVolume: " + "\n" + errorMessage, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue()); ExceptionUtil exceptionUtil = new ExceptionUtil() exceptionUtil.buildWorkflowException(execution, 5000, errorMessage) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy index 9dfb9107b2..f22b11c44a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -30,7 +32,8 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.VidUtils; import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils; -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory /** @@ -40,7 +43,7 @@ import org.onap.so.logger.MsoLogger */ class DeleteVnfInfra extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteVnfInfra.class); + private static final Logger logger = LoggerFactory.getLogger( DeleteVnfInfra.class); String Prefix="DELVI_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -55,7 +58,7 @@ class DeleteVnfInfra extends AbstractServiceTaskProcessor { */ public void preProcessRequest(DelegateExecution execution) { execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED DeleteVnfInfra PreProcessRequest Process") + logger.trace("STARTED DeleteVnfInfra PreProcessRequest Process") execution.setVariable("DELVI_SuccessIndicator", false) execution.setVariable("DELVI_vnfInUse", false) @@ -64,7 +67,7 @@ class DeleteVnfInfra extends AbstractServiceTaskProcessor { // Get Variables String deleteVnfRequest = execution.getVariable("bpmnRequest") execution.setVariable("DELVI_DeleteVnfRequest", deleteVnfRequest) - msoLogger.debug("Incoming DeleteVnfInfra Request is: \n" + deleteVnfRequest) + logger.debug("Incoming DeleteVnfInfra Request is: \n" + deleteVnfRequest) if(deleteVnfRequest != null){ @@ -73,15 +76,15 @@ class DeleteVnfInfra extends AbstractServiceTaskProcessor { String serviceInstanceId = execution.getVariable("serviceInstanceId") execution.setVariable("DELVI_serviceInstanceId", serviceInstanceId) - msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + logger.debug("Incoming Service Instance Id is: " + serviceInstanceId) String vnfId = execution.getVariable("vnfId") execution.setVariable("DELVI_vnfId", vnfId) - msoLogger.debug("Incoming Vnf(Instance) Id is: " + vnfId) + logger.debug("Incoming Vnf(Instance) Id is: " + vnfId) String source = jsonUtil.getJsonValue(deleteVnfRequest, "requestDetails.requestInfo.source") execution.setVariable("DELVI_source", source) - msoLogger.debug("Incoming Source is: " + source) + logger.debug("Incoming Source is: " + source) def cloudConfiguration = jsonUtil.getJsonValue(deleteVnfRequest, "requestDetails.cloudConfiguration") execution.setVariable("DELVI_cloudConfiguration", cloudConfiguration) @@ -92,7 +95,7 @@ class DeleteVnfInfra extends AbstractServiceTaskProcessor { cascadeDelete = cascadeDeleteObj.booleanValue() } execution.setVariable("DELVI_cascadeDelete", cascadeDelete) - msoLogger.debug("Incoming cascadeDelete is: " + cascadeDelete) + logger.debug("Incoming cascadeDelete is: " + cascadeDelete) //For Completion Handler & Fallout Handler String requestInfo = @@ -112,20 +115,20 @@ class DeleteVnfInfra extends AbstractServiceTaskProcessor { } }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") + logger.debug("Rethrowing MSOWorkflowException") throw b }catch(Exception e){ - msoLogger.debug(" Error Occured in DeleteVnfInfra PreProcessRequest method!" + e) + logger.debug(" Error Occured in DeleteVnfInfra PreProcessRequest method!" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVnfInfra PreProcessRequest") } - msoLogger.trace("COMPLETED DeleteVnfInfra PreProcessRequest Process") + logger.trace("COMPLETED DeleteVnfInfra PreProcessRequest Process") } public void sendSyncResponse (DelegateExecution execution) { execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED DeleteVnfInfra SendSyncResponse Process") + logger.trace("STARTED DeleteVnfInfra SendSyncResponse Process") try { String requestId = execution.getVariable("DELVI_requestId") @@ -133,23 +136,23 @@ class DeleteVnfInfra extends AbstractServiceTaskProcessor { String DeleteVnfResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim() - msoLogger.debug("DeleteVnfInfra Sync Response is: \n" + DeleteVnfResponse) + logger.debug("DeleteVnfInfra Sync Response is: \n" + DeleteVnfResponse) execution.setVariable("DELVI_sentSyncResponse", true) sendWorkflowResponse(execution, 202, DeleteVnfResponse) } catch (Exception ex) { - msoLogger.debug("Error Occured in DeleteVnfInfra SendSyncResponse Process " + ex.getMessage()) + logger.debug("Error Occured in DeleteVnfInfra SendSyncResponse Process " + ex.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVnfInfra SendSyncResponse Process") } - msoLogger.trace("COMPLETED DeleteVnfInfra SendSyncResponse Process") + logger.trace("COMPLETED DeleteVnfInfra SendSyncResponse Process") } public void prepareCompletionHandlerRequest(DelegateExecution execution){ execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED DeleteVnfInfra PrepareCompletionHandlerRequest Process") + logger.trace("STARTED DeleteVnfInfra PrepareCompletionHandlerRequest Process") try { String requestInfo = execution.getVariable("DELVI_requestInfo") @@ -166,40 +169,40 @@ class DeleteVnfInfra extends AbstractServiceTaskProcessor { </aetgt:MsoCompletionRequest>""" execution.setVariable("DELVI_completionHandlerRequest", request) - msoLogger.debug("Completion Handler Request is: " + request) + logger.debug("Completion Handler Request is: " + request) execution.setVariable("WorkflowResponse", "Success") // for junits } catch (Exception ex) { - msoLogger.debug("Error Occured in DeleteVnfInfra PrepareCompletionHandlerRequest Process " + ex.getMessage()) + logger.debug("Error Occured in DeleteVnfInfra PrepareCompletionHandlerRequest Process " + ex.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVnfInfra PrepareCompletionHandlerRequest Process") } - msoLogger.trace("COMPLETED DeleteVnfInfra PrepareCompletionHandlerRequest Process") + logger.trace("COMPLETED DeleteVnfInfra PrepareCompletionHandlerRequest Process") } public void sendErrorResponse(DelegateExecution execution){ execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED DeleteVnfInfra sendErrorResponse Process") + logger.trace("STARTED DeleteVnfInfra sendErrorResponse Process") try { def sentSyncResponse = execution.getVariable("DELVI_sentSyncResponse") if(sentSyncResponse == false){ - msoLogger.debug("Sending a Sync Error Response") + logger.debug("Sending a Sync Error Response") WorkflowException wfex = execution.getVariable("WorkflowException") String response = exceptionUtil.buildErrorResponseXml(wfex) - msoLogger.debug(response) + logger.debug(response) sendWorkflowResponse(execution, 500, response) }else{ - msoLogger.debug("A Sync Response has already been sent. Skipping Send Sync Error Response.") + logger.debug("A Sync Response has already been sent. Skipping Send Sync Error Response.") } } catch(Exception ex) { - msoLogger.debug("Error Occured in DeleteVnfInfra sendErrorResponse Process " + ex.getMessage()) + logger.debug("Error Occured in DeleteVnfInfra sendErrorResponse Process " + ex.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVnfInfra sendErrorResponse Process") } - msoLogger.trace("COMPLETED DeleteVnfInfra sendErrorResponse Process") + logger.trace("COMPLETED DeleteVnfInfra sendErrorResponse Process") } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy index 24071d38f6..fff2503308 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 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 @@ -26,6 +28,8 @@ import org.onap.so.bpmn.core.domain.Resource import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.camunda.bpm.engine.delegate.DelegateExecution @@ -48,11 +52,12 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor { String Prefix="DCMPMDV_" ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() + private static final Logger logger = LoggerFactory.getLogger( DoCompareModelVersions.class); public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") String msg = "" - utils.log("INFO"," ***** preProcessRequest *****", isDebugEnabled) + logger.info(" ***** preProcessRequest *****") try { execution.setVariable("prefix", Prefix) @@ -61,58 +66,58 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor { String modelInvariantUuid_target = execution.getVariable("model-invariant-id-target") if (isBlank(modelInvariantUuid_target)) { msg = "Input model-invariant-id-target is null" - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } String modelUuid_target = execution.getVariable("model-version-id-target") if (isBlank(modelUuid_target)) { msg = "Input model-version-id-target is null" - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } String modelInvariantUuid_original = execution.getVariable("model-invariant-id-original") if (isBlank(modelInvariantUuid_original)) { msg = "Input model-invariant-id-original is null" - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } String modelUuid_original = execution.getVariable("model-version-id-original") if (isBlank(modelUuid_original)) { msg = "Input model-version-id-original is null" - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } // Target and original modelInvariantUuid must to be the same if(modelInvariantUuid_target != modelInvariantUuid_original){ msg = "Input model-invariant-id-target and model-invariant-id-original must to be the same" - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } // Target and original modelUuid must not to be the same if(modelUuid_target == modelUuid_original){ msg = "Input model-version-id-target and model-version-id-original must not to be the same" - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) + logger.info(" ***** Exit preProcessRequest *****") } public void prepareDecomposeService_Target(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") try { - utils.log("DEBUG", " ***** Inside prepareDecomposeService_Target of update generic e2e service ***** ", isDebugEnabled) + logger.debug( " ***** Inside prepareDecomposeService_Target of update generic e2e service ***** ") String modelInvariantUuid = execution.getVariable("model-invariant-id-target") String modelUuid = execution.getVariable("model-version-id-target") //here modelVersion is not set, we use modelUuid to decompose the service. @@ -124,7 +129,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor { execution.setVariable("serviceModelInfo_Target", serviceModelInfo) - utils.log("DEBUG", " ***** Completed prepareDecomposeService_Target of update generic e2e service ***** ", isDebugEnabled) + logger.debug( " ***** Completed prepareDecomposeService_Target of update generic e2e service ***** ") } catch (Exception ex) { // try error in method block String exceptionMessage = "Bpmn error encountered in update generic e2e service flow. Unexpected Error from method prepareDecomposeService_Target() - " + ex.getMessage() @@ -135,13 +140,13 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor { public void processDecomposition_Target(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " ***** Inside processDecomposition_Target() of update generic e2e service flow ***** ", isDebugEnabled) + logger.debug( " ***** Inside processDecomposition_Target() of update generic e2e service flow ***** ") try { ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") execution.setVariable("serviceDecomposition_Target", serviceDecomposition) } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in update generic e2e service flow. Unexpected Error from method processDecomposition_Target() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) + logger.debug( exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } } @@ -150,7 +155,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") try { - utils.log("DEBUG", " ***** Inside prepareDecomposeService_Original of update generic e2e service ***** ", isDebugEnabled) + logger.debug( " ***** Inside prepareDecomposeService_Original of update generic e2e service ***** ") String modelInvariantUuid = execution.getVariable("model-invariant-id-original") String modelUuid = execution.getVariable("model-version-id-original") //here modelVersion is not set, we use modelUuid to decompose the service. @@ -162,7 +167,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor { execution.setVariable("serviceModelInfo_Original", serviceModelInfo) - utils.log("DEBUG", " ***** Completed prepareDecomposeService_Original of update generic e2e service ***** ", isDebugEnabled) + logger.debug( " ***** Completed prepareDecomposeService_Original of update generic e2e service ***** ") } catch (Exception ex) { // try error in method block String exceptionMessage = "Bpmn error encountered in update generic e2e service flow. Unexpected Error from method prepareDecomposeService_Original() - " + ex.getMessage() @@ -173,20 +178,20 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor { public void processDecomposition_Original(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " ***** Inside processDecomposition_Original() of update generic e2e service flow ***** ", isDebugEnabled) + logger.debug( " ***** Inside processDecomposition_Original() of update generic e2e service flow ***** ") try { ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") execution.setVariable("serviceDecomposition_Original", serviceDecomposition) } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in update generic e2e service flow. processDecomposition_Original() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) + logger.debug( exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } } public void doCompareModelVersions(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start doCompareModelVersions Process ======== ", isDebugEnabled) + logger.info( "======== Start doCompareModelVersions Process ======== ") ServiceDecomposition serviceDecomposition_Target = execution.getVariable("serviceDecomposition_Target") ServiceDecomposition serviceDecomposition_Original = execution.getVariable("serviceDecomposition_Original") @@ -217,10 +222,10 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor { execution.setVariable("addResourceList", addResourceList) execution.setVariable("delResourceList", delResourceList) - utils.log("INFO", "addResourceList: " + addResourceList, isDebugEnabled) - utils.log("INFO", "delResourceList: " + delResourceList, isDebugEnabled) + logger.info( "addResourceList: " + addResourceList) + logger.info( "delResourceList: " + delResourceList) - utils.log("INFO", "======== COMPLETED doCompareModelVersions Process ======== ", isDebugEnabled) + logger.info( "======== COMPLETED doCompareModelVersions Process ======== ") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy index 589bbe9c4f..7ad929b1c2 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 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 @@ -40,6 +42,8 @@ import org.onap.so.client.aai.AAIResourcesClient 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.slf4j.Logger +import org.slf4j.LoggerFactory import groovy.json.* @@ -62,6 +66,7 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce String Prefix="DCMPMDSI_" private static final String DebugFlag = "isDebugEnabled" + private static final Logger logger = LoggerFactory.getLogger( DeleteNetworkInstance.class); ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() @@ -70,50 +75,50 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO","Entered " + method, isDebugEnabled) + logger.info("Entered " + method) String msg = "" - utils.log("INFO"," ***** Enter DoCompareModelofE2EServiceInstance preProcessRequest *****", isDebugEnabled) + logger.info(" ***** Enter DoCompareModelofE2EServiceInstance preProcessRequest *****") execution.setVariable("prefix", Prefix) //Inputs //subscriberInfo. for AAI GET String globalSubscriberId = execution.getVariable("globalSubscriberId") - utils.log("INFO"," ***** globalSubscriberId *****" + globalSubscriberId, isDebugEnabled) + logger.info(" ***** globalSubscriberId *****" + globalSubscriberId) String serviceType = execution.getVariable("serviceType") - utils.log("INFO"," ***** serviceType *****" + serviceType, isDebugEnabled) + logger.info(" ***** serviceType *****" + serviceType) if (isBlank(globalSubscriberId)) { msg = "Input globalSubscriberId is null" - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(serviceType)) { msg = "Input serviceType is null" - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } String serviceInstanceId = execution.getVariable("serviceInstanceId") if (isBlank(serviceInstanceId)){ msg = "Input serviceInstanceId is null" - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } String modelInvariantUuid = execution.getVariable("modelInvariantIdTarget") if (isBlank(modelInvariantUuid)){ msg = "Input modelInvariantUuid is null" - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } String modelUuid = execution.getVariable("modelVersionIdTarget") if (isBlank(modelUuid)){ msg = "Input modelUuid is null" - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } @@ -122,7 +127,7 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce execution.setVariable("model-version-id-target", modelUuid) - utils.log("INFO", "Exited " + method, isDebugEnabled) + logger.info( "Exited " + method) } /** diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index 2168dab736..aac4b72b06 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -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 @@ -43,6 +45,8 @@ import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils import org.onap.so.bpmn.core.UrnPropertiesReader @@ -73,7 +77,7 @@ import org.onap.so.bpmn.core.UrnPropertiesReader * */ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateE2EServiceInstance.class); + private static final Logger logger = LoggerFactory.getLogger( DoCreateE2EServiceInstance.class); String Prefix="DCRESI_" @@ -82,29 +86,29 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { public void preProcessRequest (DelegateExecution execution) { String msg = "" - msoLogger.trace("preProcessRequest ") + logger.trace("preProcessRequest ") try { execution.setVariable("prefix", Prefix) //Inputs //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId - msoLogger.info(" ***** globalSubscriberId *****" + globalSubscriberId) + logger.info(" ***** globalSubscriberId *****" + globalSubscriberId) //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology String serviceType = execution.getVariable("serviceType") - msoLogger.info(" ***** serviceType *****" + serviceType) + logger.info(" ***** serviceType *****" + serviceType) //requestDetails.requestParameters. for SDNC assignTopology String productFamilyId = execution.getVariable("productFamilyId") //AAI productFamilyId if (isBlank(globalSubscriberId)) { msg = "Input globalSubscriberId is null" - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(serviceType)) { msg = "Input serviceType is null" - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } @@ -115,11 +119,11 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback", execution) if (isBlank(sdncCallbackUrl)) { msg = "URN_mso_workflow_sdncadapter_callback is null" - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - msoLogger.info("SDNC Callback URL: " + sdncCallbackUrl) + logger.info("SDNC Callback URL: " + sdncCallbackUrl) //requestDetails.modelInfo.for AAI PUT servieInstanceData //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData @@ -158,15 +162,15 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit preProcessRequest ") + logger.trace("Exit preProcessRequest ") } public void prepareDecomposeService(DelegateExecution execution) { try { - msoLogger.trace("Inside prepareDecomposeService of create generic e2e service ") + logger.trace("Inside prepareDecomposeService of create generic e2e service ") String modelInvariantUuid = execution.getVariable("modelInvariantUuid") String modelUuid = execution.getVariable("modelUuid") //here modelVersion is not set, we use modelUuid to decompose the service. @@ -177,7 +181,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { }""" execution.setVariable("serviceModelInfo", serviceModelInfo) - msoLogger.trace("Completed prepareDecomposeService of create generic e2e service ") + logger.trace("Completed prepareDecomposeService of create generic e2e service ") } catch (Exception ex) { // try error in method block String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() @@ -186,12 +190,12 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { } public void processDecomposition(DelegateExecution execution) { - msoLogger.trace("Inside processDecomposition() of create generic e2e service flow ") + logger.trace("Inside processDecomposition() of create generic e2e service flow ") try { ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. processDecomposition() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } } @@ -213,23 +217,23 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { } public void postProcessAAIGET(DelegateExecution execution) { - msoLogger.trace("postProcessAAIGET ") + logger.trace("postProcessAAIGET ") String msg = "" try { String serviceInstanceName = execution.getVariable("serviceInstanceName") boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") if(!succInAAI){ - msoLogger.info("Error getting Service-instance from AAI", + serviceInstanceName) + logger.info("Error getting Service-instance from AAI", + serviceInstanceName) WorkflowException workflowException = execution.getVariable("WorkflowException") - msoLogger.debug("workflowException: " + workflowException) + logger.debug("workflowException: " + workflowException) if(workflowException != null){ exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) } else { msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) } } @@ -237,9 +241,9 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { { boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") if(foundInAAI){ - msoLogger.info("Found Service-instance in AAI") + logger.info("Found Service-instance in AAI") msg = "ServiceInstance already exists in AAI:" + serviceInstanceName - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) } } @@ -247,15 +251,15 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { throw e; } catch (Exception ex) { msg = "Exception in DoCreateServiceInstance.postProcessAAIGET. " + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit postProcessAAIGET ") + logger.trace("Exit postProcessAAIGET ") } //TODO use create if not exist public void createServiceInstance(DelegateExecution execution) { - msoLogger.trace("createServiceInstance ") + logger.trace("createServiceInstance ") String msg = "" String serviceInstanceId = execution.getVariable("serviceInstanceId") try { @@ -279,10 +283,10 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("rollbackData", rollbackData) msg = "Exception in DoCreateServiceInstance.createServiceInstance. " + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit createServiceInstance ") + logger.trace("Exit createServiceInstance ") } /** @@ -310,23 +314,23 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { } public void postProcessAAIGET2(DelegateExecution execution) { - msoLogger.trace("postProcessAAIGET2 ") + logger.trace("postProcessAAIGET2 ") String msg = "" try { String serviceInstanceName = execution.getVariable("serviceInstanceName") boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") if(!succInAAI){ - msoLogger.info("Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName) + logger.info("Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName) WorkflowException workflowException = execution.getVariable("WorkflowException") - msoLogger.debug("workflowException: " + workflowException) + logger.debug("workflowException: " + workflowException) if(workflowException != null){ exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) } else { msg = "Failure in postProcessAAIGET2 GENGS_SuccessIndicator:" + succInAAI - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) } } @@ -337,7 +341,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { String aaiService = execution.getVariable("GENGS_service") if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "service-instance-name"))) { execution.setVariable("serviceInstanceName", utils.getNodeText(aaiService, "service-instance-name")) - msoLogger.info("Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName")) + logger.info("Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName")) } } } @@ -345,54 +349,54 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { throw e; } catch (Exception ex) { msg = "Exception in DoCreateServiceInstance.postProcessAAIGET2 " + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit postProcessAAIGET2 ") + logger.trace("Exit postProcessAAIGET2 ") } public void preProcessRollback (DelegateExecution execution) { - msoLogger.trace("preProcessRollback ") + logger.trace("preProcessRollback ") try { Object workflowException = execution.getVariable("WorkflowException"); if (workflowException instanceof WorkflowException) { - msoLogger.info("Prev workflowException: " + workflowException.getErrorMessage()) + logger.info("Prev workflowException: " + workflowException.getErrorMessage()) execution.setVariable("prevWorkflowException", workflowException); //execution.setVariable("WorkflowException", null); } } catch (BpmnError e) { - msoLogger.info("BPMN Error during preProcessRollback") + logger.info("BPMN Error during preProcessRollback") } catch(Exception ex) { String msg = "Exception in preProcessRollback. " + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) } - msoLogger.trace("Exit preProcessRollback ") + logger.trace("Exit preProcessRollback ") } public void postProcessRollback (DelegateExecution execution) { - msoLogger.trace("postProcessRollback ") + logger.trace("postProcessRollback ") String msg = "" try { Object workflowException = execution.getVariable("prevWorkflowException"); if (workflowException instanceof WorkflowException) { - msoLogger.info("Setting prevException to WorkflowException: ") + logger.info("Setting prevException to WorkflowException: ") execution.setVariable("WorkflowException", workflowException); } execution.setVariable("rollbackData", null) } catch (BpmnError b) { - msoLogger.info("BPMN Error during postProcessRollback") + logger.info("BPMN Error during postProcessRollback") throw b; } catch(Exception ex) { msg = "Exception in postProcessRollback. " + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) } - msoLogger.trace("Exit postProcessRollback ") + logger.trace("Exit postProcessRollback ") } public void preInitResourcesOperStatus(DelegateExecution execution){ - msoLogger.trace("STARTED preInitResourcesOperStatus Process ") + logger.trace("STARTED preInitResourcesOperStatus Process ") try{ String serviceId = execution.getVariable("serviceInstanceId") String operationId = execution.getVariable("operationId") @@ -402,7 +406,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { String progress = "0" String reason = "" String operationContent = "Prepare service creation" - msoLogger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType) + logger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType) serviceId = UriUtils.encode(serviceId,"UTF-8") execution.setVariable("serviceInstanceId", serviceId) execution.setVariable("operationId", operationId) @@ -416,7 +420,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.db.endpoint") execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - msoLogger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint) + logger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint) String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" @@ -434,48 +438,50 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { payload = utils.formatXml(payload) execution.setVariable("CVFMI_initResOperStatusRequest", payload) - msoLogger.info("Outgoing initResourceOperationStatus: \n" + payload) - msoLogger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) + logger.info("Outgoing initResourceOperationStatus: \n" + payload) + logger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preInitResourcesOperStatus Process ") + logger.trace("COMPLETED preInitResourcesOperStatus Process ") } // if site location is in local Operator, create all resources in local ONAP; // if site location is in 3rd Operator, only process sp-partner to create all resources in 3rd ONAP public void doProcessSiteLocation(DelegateExecution execution){ - msoLogger.trace("======== Start doProcessSiteLocation Process ======== ") + logger.trace("======== Start doProcessSiteLocation Process ======== ") ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") String uuiRequest = execution.getVariable("uuiRequest") uuiRequest = ServicePluginFactory.getInstance().doProcessSiteLocation(serviceDecomposition, uuiRequest); execution.setVariable("uuiRequest", uuiRequest) execution.setVariable("serviceDecomposition", serviceDecomposition) - msoLogger.trace("======== COMPLETED doProcessSiteLocation Process ======== ") + logger.trace("======== COMPLETED doProcessSiteLocation Process ======== ") } // Allocate cross link TPs(terminal points) for sotn network only public void doTPResourcesAllocation(DelegateExecution execution){ - msoLogger.trace("======== Start doTPResourcesAllocation Process ======== ") + logger.trace("======== Start doTPResourcesAllocation Process ======== ") ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") String uuiRequest = execution.getVariable("uuiRequest") uuiRequest = ServicePluginFactory.getInstance().doTPResourcesAllocation(execution, uuiRequest); execution.setVariable("uuiRequest", uuiRequest) - msoLogger.trace("======== COMPLETED doTPResourcesAllocation Process ======== ") + logger.trace("======== COMPLETED doTPResourcesAllocation Process ======== ") } // prepare input param for using DoCreateResources.bpmn public void preProcessForAddResource(DelegateExecution execution) { - msoLogger.trace("STARTED preProcessForAddResource Process ") + logger.trace("STARTED preProcessForAddResource Process ") ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") List<Resource> addResourceList = serviceDecomposition.getServiceResources() execution.setVariable("addResourceList", addResourceList) - msoLogger.trace("COMPLETED preProcessForAddResource Process ") + logger.trace("COMPLETED preProcessForAddResource Process ") } public void postProcessForAddResource(DelegateExecution execution) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy index 4f00a64ecb..ce9df87799 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy @@ -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 @@ -32,7 +34,8 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.RollbackData import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.onap.so.logger.MessageEnum import org.onap.so.bpmn.common.scripts.ExceptionUtil; import org.onap.so.client.aai.entities.uri.AAIResourceUri @@ -70,20 +73,20 @@ import org.springframework.web.util.UriUtils; */ public class DoCreateE2EServiceInstanceRollback extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateE2EServiceInstanceRollback.class); + private static final Logger logger = LoggerFactory.getLogger( DoCreateE2EServiceInstanceRollback.class); String Prefix="DCRESIRB_" public void preProcessRequest(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) String msg = "" - msoLogger.trace("Start preProcessRequest") + logger.trace("Start preProcessRequest") execution.setVariable("rollbackAAI",false) execution.setVariable("rollbackSDNC",false) try { def rollbackData = execution.getVariable("rollbackData") - msoLogger.debug("RollbackData:" + rollbackData) + logger.debug("RollbackData:" + rollbackData) if (rollbackData != null) { if (rollbackData.hasType("SERVICEINSTANCE")) { @@ -118,8 +121,8 @@ public class DoCreateE2EServiceInstanceRollback extends AbstractServiceTaskProce execution.setVariable("sdncDelete", sdncDelete) def sdncDeactivate = rollbackData.get("SERVICEINSTANCE", "sdncDeactivate") execution.setVariable("sdncDeactivate", sdncDeactivate) - msoLogger.debug("sdncDeactivate:\n" + sdncDeactivate) - msoLogger.debug("sdncDelete:\n" + sdncDelete) + logger.debug("sdncDeactivate:\n" + sdncDeactivate) + logger.debug("sdncDelete:\n" + sdncDelete) } else { execution.setVariable("skipRollback", true) @@ -137,50 +140,50 @@ public class DoCreateE2EServiceInstanceRollback extends AbstractServiceTaskProce throw e; } catch (Exception ex){ msg = "Exception in Create ServiceInstance Rollback preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) //TODO how does this even compile without exceptionUtil being declared } - msoLogger.trace("Exit preProcessRequest ") + logger.trace("Exit preProcessRequest ") } public void validateSDNCResponse(DelegateExecution execution, String response, String method) { - msoLogger.trace("validateSDNCResponse") + logger.trace("validateSDNCResponse") String msg = "" try { WorkflowException workflowException = execution.getVariable("WorkflowException") boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - msoLogger.debug("SDNCResponse: " + response) - msoLogger.debug("workflowException: " + workflowException) + logger.debug("SDNCResponse: " + response) + logger.debug("workflowException: " + workflowException) SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ msg = "SDNC Adapter service-instance rollback successful for " + method - msoLogger.debug(msg) + logger.debug(msg) }else{ execution.setVariable("rolledBack", false) msg = "Error Response from SDNC Adapter service-instance rollback for " + method execution.setVariable("rollbackError", msg) - msoLogger.debug(msg) + logger.debug(msg) throw new BpmnError("MSOWorkflowException") } } catch (BpmnError e) { throw e; } catch (Exception ex){ msg = "Exception in Create ServiceInstance rollback for " + method + " Exception:" + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit validateSDNCResponse ") + logger.trace("Exit validateSDNCResponse ") } /** * Deletes the service instance in aai */ public void deleteServiceInstance(DelegateExecution execution) { - msoLogger.trace("Started Delete Service Instance") + logger.trace("Started Delete Service Instance") try { String globalCustId = execution.getVariable("globalSubscriberId") String serviceType = execution.getVariable("subscriptionServiceType") @@ -190,15 +193,15 @@ public class DoCreateE2EServiceInstanceRollback extends AbstractServiceTaskProce AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId) resourceClient.delete(serviceInstanceUri) - msoLogger.trace("Completed Delete Service Instance") + logger.trace("Completed Delete Service Instance") }catch(Exception e){ - msoLogger.debug("Error occured within deleteServiceInstance method: " + e) + logger.debug("Error occured within deleteServiceInstance method: " + e) } } public void postProcessRequest(DelegateExecution execution) { - msoLogger.trace("postProcessRequest") + logger.trace("postProcessRequest") String msg = "" try { execution.setVariable("rollbackData", null) @@ -215,51 +218,51 @@ public class DoCreateE2EServiceInstanceRollback extends AbstractServiceTaskProce if(!succInAAI){ execution.setVariable("rolledBack", false) //both sdnc and aai must be successful to declare rollback Succesful execution.setVariable("rollbackError", "Error deleting service-instance in AAI for rollback") - msoLogger.debug("Error deleting service-instance in AAI for rollback", + serviceInstanceId) + logger.debug("Error deleting service-instance in AAI for rollback", + serviceInstanceId) } } - msoLogger.trace("Exit postProcessRequest ") + logger.trace("Exit postProcessRequest ") } catch (BpmnError e) { msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + e.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } catch (Exception ex) { msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } } public void processRollbackException(DelegateExecution execution){ - msoLogger.trace("processRollbackException") + logger.trace("processRollbackException") try{ - msoLogger.debug("Caught an Exception in DoCreateServiceInstanceRollback") + logger.debug("Caught an Exception in DoCreateServiceInstanceRollback") execution.setVariable("rollbackData", null) execution.setVariable("rollbackError", "Caught exception in ServiceInstance Create Rollback") execution.setVariable("WorkflowException", null) }catch(BpmnError b){ - msoLogger.debug("BPMN Error during processRollbackExceptions Method: ") + logger.debug("BPMN Error during processRollbackExceptions Method: ") }catch(Exception e){ - msoLogger.debug("Caught Exception during processRollbackExceptions Method: " + e.getMessage()) + logger.debug("Caught Exception during processRollbackExceptions Method: " + e.getMessage()) } - msoLogger.trace(" Exit processRollbackException") + logger.trace(" Exit processRollbackException") } public void processRollbackJavaException(DelegateExecution execution){ - msoLogger.trace("processRollbackJavaException") + logger.trace("processRollbackJavaException") try{ execution.setVariable("rollbackData", null) execution.setVariable("rollbackError", "Caught Java exception in ServiceInstance Create Rollback") - msoLogger.debug("Caught Exception in processRollbackJavaException") + logger.debug("Caught Exception in processRollbackJavaException") }catch(Exception e){ - msoLogger.debug("Caught Exception in processRollbackJavaException " + e.getMessage()) + logger.debug("Caught Exception in processRollbackJavaException " + e.getMessage()) } - msoLogger.trace("Exit processRollbackJavaException") + logger.trace("Exit processRollbackJavaException") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy index 1b64671163..41bae326a5 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy @@ -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 @@ -45,7 +47,8 @@ import org.onap.so.client.aai.entities.AAIResultWrapper import org.onap.so.client.aai.entities.Relationships import org.onap.so.client.graphinventory.entities.uri.Depth import org.onap.so.constants.Defaults -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils import org.w3c.dom.Document import org.w3c.dom.Element @@ -72,7 +75,7 @@ import groovy.xml.XmlUtil * */ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateNetworkInstance.class); + private static final Logger logger = LoggerFactory.getLogger( DoCreateNetworkInstance.class); String Prefix="CRENWKI_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -203,7 +206,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { public void preProcessRequest (DelegateExecution execution) { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside preProcessRequest() of " + className + ".groovy") + logger.trace("Inside preProcessRequest() of " + className + ".groovy") try { // initialize flow variables @@ -217,12 +220,12 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { // JSON format request is sent, create xml try { def prettyJson = JsonOutput.prettyPrint(networkRequest.toString()) - msoLogger.debug(" Incoming message formatted . . . : " + '\n' + prettyJson) + logger.debug(" Incoming message formatted . . . : " + '\n' + prettyJson) networkRequest = vidUtils.createXmlNetworkRequestInfra(execution, networkRequest) } catch (Exception ex) { String dataErrorMessage = " Invalid json format Request - " + ex.getMessage() - msoLogger.debug(dataErrorMessage) + logger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } } else { @@ -236,36 +239,36 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { networkRequest = utils.formatXml(networkRequest) execution.setVariable(Prefix + "networkRequest", networkRequest) - msoLogger.debug(Prefix + "networkRequest - " + '\n' + networkRequest) + logger.debug(Prefix + "networkRequest - " + '\n' + networkRequest) // validate 'backout-on-failure' to override 'mso.rollback' boolean rollbackEnabled = networkUtils.isRollbackEnabled(execution, networkRequest) execution.setVariable(Prefix + "rollbackEnabled", rollbackEnabled) - msoLogger.debug(Prefix + "rollbackEnabled - " + rollbackEnabled) + logger.debug(Prefix + "rollbackEnabled - " + rollbackEnabled) String networkInputs = utils.getNodeXml(networkRequest, "network-inputs", false).replace("tag0:","").replace(":tag0","") execution.setVariable(Prefix + "networkInputs", networkInputs) - msoLogger.debug(Prefix + "networkInputs - " + '\n' + networkInputs) + logger.debug(Prefix + "networkInputs - " + '\n' + networkInputs) // prepare messageId String messageId = execution.getVariable("testMessageId") // for testing if (messageId == null || messageId == "") { messageId = UUID.randomUUID() - msoLogger.debug(Prefix + "messageId, random generated: " + messageId) + logger.debug(Prefix + "messageId, random generated: " + messageId) } else { - msoLogger.debug(Prefix + "messageId, pre-assigned: " + messageId) + logger.debug(Prefix + "messageId, pre-assigned: " + messageId) } execution.setVariable(Prefix + "messageId", messageId) String source = utils.getNodeText(networkRequest, "source") execution.setVariable(Prefix + "source", source) - msoLogger.debug(Prefix + "source - " + source) + logger.debug(Prefix + "source - " + source) // validate cloud region String lcpCloudRegionId = utils.getNodeText(networkRequest, "aic-cloud-region") if ((lcpCloudRegionId == null) || (lcpCloudRegionId == "") || (lcpCloudRegionId == "null")) { String dataErrorMessage = "Missing value/element: 'lcpCloudRegionId' or 'cloudConfiguration' or 'aic-cloud-region'." - msoLogger.debug(" Invalid Request - " + dataErrorMessage) + logger.debug(" Invalid Request - " + dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } @@ -273,7 +276,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String serviceInstanceId = utils.getNodeText(networkRequest, "service-instance-id") if ((serviceInstanceId == null) || (serviceInstanceId == "") || (serviceInstanceId == "null")) { String dataErrorMessage = "Missing value/element: 'serviceInstanceId'." - msoLogger.debug(" Invalid Request - " + dataErrorMessage) + logger.debug(" Invalid Request - " + dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } @@ -288,20 +291,20 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } catch (IOException ex) { String exceptionMessage = "Exception Encountered in DoCreateNetworkInstance, PreProcessRequest() - " String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage() - msoLogger.debug(dataErrorMessage) + logger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } // Set variables for Generic Get Sub Flow use execution.setVariable(Prefix + "serviceInstanceId", serviceInstanceId) - msoLogger.debug(Prefix + "serviceInstanceId - " + serviceInstanceId) + logger.debug(Prefix + "serviceInstanceId - " + serviceInstanceId) execution.setVariable("GENGS_type", "service-instance") - msoLogger.debug("GENGS_type - " + "service-instance") - msoLogger.debug(" Url for SDNC adapter: " + UrnPropertiesReader.getVariable("mso.adapters.sdnc.endpoint",execution)) + logger.debug("GENGS_type - " + "service-instance") + logger.debug(" Url for SDNC adapter: " + UrnPropertiesReader.getVariable("mso.adapters.sdnc.endpoint",execution)) String sdncVersion = execution.getVariable("sdncVersion") - msoLogger.debug("sdncVersion? : " + sdncVersion) + logger.debug("sdncVersion? : " + sdncVersion) // build 'networkOutputs' String networkId = utils.getNodeText(networkRequest, "network-id") @@ -318,7 +321,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { <network-name>${MsoUtils.xmlEscape(networkName)}</network-name> </network-outputs>""" execution.setVariable(Prefix + "networkOutputs", networkOutputs) - msoLogger.debug(Prefix + "networkOutputs - " + '\n' + networkOutputs) + logger.debug(Prefix + "networkOutputs - " + '\n' + networkOutputs) execution.setVariable(Prefix + "networkId", networkId) execution.setVariable(Prefix + "networkName", networkName) @@ -329,7 +332,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { sendSyncError(execution) // caught exception String exceptionMessage = "Exception Encountered in PreProcessRequest() of " + className + ".groovy ***** : " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -358,7 +361,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { throw e; }catch (Exception ex){ String msg = "Exception in getServiceInstance. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } @@ -368,7 +371,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.debug(" ***** Inside callRESTQueryAAINetworkName() of DoCreateNetworkInstance ***** " ) + logger.debug(" ***** Inside callRESTQueryAAINetworkName() of DoCreateNetworkInstance ***** " ) try{ // get variables @@ -383,18 +386,18 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "isAAIqueryNameGood", true) String orchestrationStatus = network.getOrchestrationStatus() execution.setVariable(Prefix + "orchestrationStatus", orchestrationStatus.toUpperCase()) - msoLogger.debug(Prefix + "orchestrationStatus - " + orchestrationStatus.toUpperCase()) + logger.debug(Prefix + "orchestrationStatus - " + orchestrationStatus.toUpperCase()) execution.setVariable("orchestrationStatus", orchestrationStatus) - msoLogger.debug(Prefix + "isAAIqueryNameGood? : " + execution.getVariable(Prefix + "isAAIqueryNameGood")) + logger.debug(Prefix + "isAAIqueryNameGood? : " + execution.getVariable(Prefix + "isAAIqueryNameGood")) } catch (NotFoundException e) { - msoLogger.debug(" QueryAAINetworkName return code = '404' (Not Found). Proceed with the Create !!! ") + logger.debug(" QueryAAINetworkName return code = '404' (Not Found). Proceed with the Create !!! ") } catch (Exception ex) { // try error String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow - callRESTQueryAAINetworkName() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -405,7 +408,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.debug(" ***** Inside callRESTQueryAAICloudRegion() of DoCreateNetworkInstance ***** " ) + logger.debug(" ***** Inside callRESTQueryAAICloudRegion() of DoCreateNetworkInstance ***** " ) try { String networkInputs = execution.getVariable(Prefix + "networkInputs") @@ -429,12 +432,12 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } else { String dataErrorMessage = "QueryAAICloudRegion Unsuccessful. Return Code: " + execution.getVariable(Prefix + "queryCloudRegionReturnCode") - msoLogger.debug(dataErrorMessage) + logger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } - msoLogger.debug(" is Cloud Region Good: " + execution.getVariable(Prefix + "isCloudRegionGood")) + logger.debug(" is Cloud Region Good: " + execution.getVariable(Prefix + "isCloudRegionGood")) } catch (BpmnError e) { throw e; @@ -442,7 +445,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } catch (Exception ex) { // try error String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow - callRESTQueryAAICloudRegion() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -453,7 +456,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.debug(" ***** Inside callRESTQueryAAINetworkId() of DoCreateNetworkInstance ***** " ) + logger.debug(" ***** Inside callRESTQueryAAINetworkId() of DoCreateNetworkInstance ***** " ) try { // get variables @@ -466,7 +469,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { networkId = utils.getNodeText(networkResponseInformation, "instance-id") } catch (Exception ex) { String dataErrorMessage = " SNDC Response network validation for 'instance-id' (network-id) failed: Empty <network-response-information>" - msoLogger.debug(dataErrorMessage) + logger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } @@ -475,10 +478,10 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } if (networkId == null || networkId == "null") { String dataErrorMessage = "SNDC Response did not contains 'instance-id' or 'network-id' element, or the value is null." - msoLogger.debug(dataErrorMessage) + logger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } else { - msoLogger.debug(" SNDC Response network validation for 'instance-id' (network-id)' is good: " + networkId) + logger.debug(" SNDC Response network validation for 'instance-id' (network-id)' is good: " + networkId) } @@ -499,12 +502,12 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } catch (NotFoundException e) { String dataErrorMessage = "Response Error from QueryAAINetworkId is 404 (Not Found)." - msoLogger.debug(" AAI Query Failed. " + dataErrorMessage) + logger.debug(" AAI Query Failed. " + dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTQueryAAINetworkId() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -515,7 +518,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.debug(" ***** Inside callRESTReQueryAAINetworkId() of DoCreateNetworkInstance ***** " ) + logger.debug(" ***** Inside callRESTReQueryAAINetworkId() of DoCreateNetworkInstance ***** " ) try { // get variables @@ -536,17 +539,17 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { <network-name>${MsoUtils.xmlEscape(netName)}</network-name> </network-outputs>""" execution.setVariable(Prefix + "networkOutputs", networkOutputs) - msoLogger.debug(" networkOutputs - " + '\n' + networkOutputs) + logger.debug(" networkOutputs - " + '\n' + networkOutputs) } catch (NotFoundException e) { String dataErrorMessage = "Response Error from ReQueryAAINetworkId is 404 (Not Found)." - msoLogger.debug(" AAI ReQuery Failed. - " + dataErrorMessage) + logger.debug(" AAI ReQuery Failed. - " + dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTReQueryAAINetworkId() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -557,7 +560,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.debug(" ***** Inside callRESTQueryAAINetworkVpnBinding() of DoCreateNetworkInstance ***** " ) + logger.debug(" ***** Inside callRESTQueryAAINetworkVpnBinding() of DoCreateNetworkInstance ***** " ) try { @@ -567,7 +570,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { if(relationships.isPresent()){ List<AAIResourceUri> uris = relationships.get().getRelatedAAIUris(AAIObjectType.VPN_BINDING) - msoLogger.debug(Prefix + "vpnCount - " + uris.size()) + logger.debug(Prefix + "vpnCount - " + uris.size()) if (uris.size() > 0) { String routeTargets = "" @@ -593,7 +596,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } // end loop execution.setVariable(Prefix + "routeCollection", routeTargets) - msoLogger.debug(Prefix + "routeCollection - " + '\n' + routeTargets) + logger.debug(Prefix + "routeCollection - " + '\n' + routeTargets) } else { // reset return code to success @@ -609,17 +612,17 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse) execution.setVariable(Prefix + "queryVpnBindingAAIResponse", aaiStubResponseAsXml) execution.setVariable(Prefix + "routeCollection", "<routeTargets/>") - msoLogger.debug(" No vpnBinding, using this stub as response - " + '\n' + aaiStubResponseAsXml) + logger.debug(" No vpnBinding, using this stub as response - " + '\n' + aaiStubResponseAsXml) } } } catch (NotFoundException e) { - msoLogger.debug("Response Error from AAINetworkVpnBinding is 404 (Not Found).") + logger.debug("Response Error from AAINetworkVpnBinding is 404 (Not Found).") exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Response Error from AAINetworkVpnBinding is 404 (Not Found).") } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTQueryAAINetworkVpnBinding() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -630,7 +633,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.debug(" ***** Inside callRESTQueryAAINetworkPolicy() of DoCreateNetworkInstance ***** " ) + logger.debug(" ***** Inside callRESTQueryAAINetworkPolicy() of DoCreateNetworkInstance ***** " ) try { AAIResourcesClient client = new AAIResourcesClient() @@ -640,7 +643,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { List<AAIResourceUri> uris = relationships.get().getRelatedAAIUris(AAIObjectType.NETWORK_POLICY) execution.setVariable(Prefix + "networkPolicyCount", uris.size()) - msoLogger.debug(Prefix + "networkPolicyCount - " + uris.size()) + logger.debug(Prefix + "networkPolicyCount - " + uris.size()) if (uris.size() > 0) { @@ -658,7 +661,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } // end loop execution.setVariable(Prefix + "networkCollection", networkPolicies) - msoLogger.debug(Prefix + "networkCollection - " + '\n' + networkPolicies) + logger.debug(Prefix + "networkCollection - " + '\n' + networkPolicies) } else { // reset return code to success @@ -674,18 +677,18 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse) execution.setVariable(Prefix + "queryNetworkPolicyAAIResponse", aaiStubResponseAsXml) execution.setVariable(Prefix + "networkCollection", "<policyFqdns/>") - msoLogger.debug(" No net policies, using this stub as response - " + '\n' + aaiStubResponseAsXml) + logger.debug(" No net policies, using this stub as response - " + '\n' + aaiStubResponseAsXml) } } } catch (NotFoundException e) { String dataErrorMessage = "Response Error from QueryAAINetworkPolicy is 404 (Not Found)." - msoLogger.debug(dataErrorMessage) + logger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTQueryAAINetworkPolicy() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -696,7 +699,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.debug(" ***** Inside callRESTQueryAAINetworkTableRef() of DoCreateNetworkInstance ***** " ) + logger.debug(" ***** Inside callRESTQueryAAINetworkTableRef() of DoCreateNetworkInstance ***** " ) try { @@ -707,7 +710,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { List<AAIResourceUri> uris = relationships.get().getRelatedAAIUris(AAIObjectType.ROUTE_TABLE_REFERENCE) execution.setVariable(Prefix + "networkTableRefCount", uris.size()) - msoLogger.debug(Prefix + "networkTableRefCount - " + uris.size()) + logger.debug(Prefix + "networkTableRefCount - " + uris.size()) if (uris.size() > 0) { @@ -725,7 +728,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } // end loop execution.setVariable(Prefix + "tableRefCollection", networkTableRefs) - msoLogger.debug(Prefix + "tableRefCollection - " + '\n' + networkTableRefs) + logger.debug(Prefix + "tableRefCollection - " + '\n' + networkTableRefs) } else { // reset return code to success @@ -741,19 +744,19 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse) execution.setVariable(Prefix + "queryNetworkTableRefAAIResponse", aaiStubResponseAsXml) execution.setVariable(Prefix + "tableRefCollection", "<routeTableFqdns/>") - msoLogger.debug(" No net table references, using this stub as response - " + '\n' + aaiStubResponseAsXml) + logger.debug(" No net table references, using this stub as response - " + '\n' + aaiStubResponseAsXml) } } } catch (NotFoundException e) { String dataErrorMessage = "Response Error from QueryAAINetworkTableRef is 404 (Not Found)." - msoLogger.debug(dataErrorMessage) + logger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTQueryAAINetworkTableRef() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -765,7 +768,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace(" ***** Inside callRESTUpdateContrailAAINetwork() of DoCreateNetworkInstance ***** " ) + logger.trace(" ***** Inside callRESTUpdateContrailAAINetwork() of DoCreateNetworkInstance ***** " ) try { // get variables @@ -797,7 +800,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { l3Network.setOrchestrationStatus("Active") } - msoLogger.debug("Updating l3-network in AAI" ) + logger.debug("Updating l3-network in AAI" ) AAIResourcesClient client = new AAIResourcesClient() AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId) @@ -815,7 +818,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { subnet.setOrchestrationStatus("Active") } - msoLogger.debug("Updating subnet in AAI" ) + logger.debug("Updating subnet in AAI" ) AAIResourceUri subUri = AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, networkId, subnetId) client.update(subUri, subnet) @@ -828,17 +831,17 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } else { execution.setVariable(Prefix + "isPONR", true) } - msoLogger.debug(Prefix + "isPONR" + ": " + execution.getVariable(Prefix + "isPONR")) + logger.debug(Prefix + "isPONR" + ": " + execution.getVariable(Prefix + "isPONR")) } catch (BpmnError e) { throw e; } catch (NotFoundException e) { String dataErrorMessage = " Response Error from UpdateContrailAAINetwork is 404 (Not Found)." - msoLogger.debug(dataErrorMessage) + logger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTUpdateContrailAAINetwork() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } } @@ -847,7 +850,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside prepareCreateNetworkRequest() of DoCreateNetworkInstance") + logger.trace("Inside prepareCreateNetworkRequest() of DoCreateNetworkInstance") try { @@ -874,11 +877,11 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { buildDeleteNetworkRequestAsString = buildDeleteNetworkRequestAsString.replace(":w1aac13n0", "").replace("w1aac13n0:", "") execution.setVariable(Prefix + "createNetworkRequest", buildDeleteNetworkRequestAsString) - msoLogger.debug(Prefix + "createNetworkRequest - " + "\n" + buildDeleteNetworkRequestAsString) + logger.debug(Prefix + "createNetworkRequest - " + "\n" + buildDeleteNetworkRequestAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareCreateNetworkRequest() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -889,7 +892,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside prepareSDNCRequest() of DoCreateNetworkInstance") + logger.trace("Inside prepareSDNCRequest() of DoCreateNetworkInstance") try { // get variables @@ -914,12 +917,12 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) execution.setVariable(Prefix + "assignSDNCRequest", sndcTopologyCreateRequesAsString) - msoLogger.debug(Prefix + "assignSDNCRequest - " + "\n" + sndcTopologyCreateRequesAsString) + logger.debug(Prefix + "assignSDNCRequest - " + "\n" + sndcTopologyCreateRequesAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareSDNCRequest() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -930,7 +933,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside prepareRpcSDNCRequest() of DoCreateNetworkInstance") + logger.trace("Inside prepareRpcSDNCRequest() of DoCreateNetworkInstance") try { // get variables @@ -947,11 +950,11 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) execution.setVariable(Prefix + "assignSDNCRequest", sndcTopologyCreateRequesAsString) - msoLogger.debug(Prefix + "assignSDNCRequest - " + "\n" + sndcTopologyCreateRequesAsString) + logger.debug(Prefix + "assignSDNCRequest - " + "\n" + sndcTopologyCreateRequesAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRpcSDNCRequest() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -962,7 +965,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside prepareRpcSDNCActivateRequest() of DoCreateNetworkInstance") + logger.trace("Inside prepareRpcSDNCActivateRequest() of DoCreateNetworkInstance") try { // get variables @@ -977,12 +980,12 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) execution.setVariable(Prefix + "activateSDNCRequest", sndcTopologyCreateRequesAsString) - msoLogger.debug(Prefix + "activateSDNCRequest - " + "\n" + sndcTopologyCreateRequesAsString) + logger.debug(Prefix + "activateSDNCRequest - " + "\n" + sndcTopologyCreateRequesAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRpcSDNCActivateRequest() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -1000,7 +1003,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside validateNetworkResponse() of DoCreateNetworkInstance") + logger.trace("Inside validateNetworkResponse() of DoCreateNetworkInstance") try { String returnCode = execution.getVariable(Prefix + "networkReturnCode") @@ -1009,13 +1012,13 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { networkResponse="" // reset } - msoLogger.debug(" Network Adapter create responseCode: " + returnCode) + logger.debug(" Network Adapter create responseCode: " + returnCode) String errorMessage = "" if (returnCode == "200") { execution.setVariable(Prefix + "isNetworkRollbackNeeded", true) execution.setVariable(Prefix + "createNetworkResponse", networkResponse) - msoLogger.debug(" Network Adapter create Success Response - " + "\n" + networkResponse) + logger.debug(" Network Adapter create Success Response - " + "\n" + networkResponse) // prepare rollback data String rollbackData = utils.getNodeXml(networkResponse, "rollback", false).replace("tag0:","").replace(":tag0","") @@ -1026,7 +1029,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { </rollbackNetworkRequest>""" String rollbackNetworkXml = utils.formatXml(rollbackNetwork) execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkXml) - msoLogger.debug(" Network Adapter rollback data - " + "\n" + rollbackNetworkXml) + logger.debug(" Network Adapter rollback data - " + "\n" + rollbackNetworkXml) } else { // network error if (returnCode.toInteger() > 399 && returnCode.toInteger() < 600) { //4xx, 5xx @@ -1060,7 +1063,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. validateCreateNetworkResponse() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -1072,7 +1075,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside validateSDNCResponse() of DoCreateNetworkInstance") + logger.trace("Inside validateSDNCResponse() of DoCreateNetworkInstance") String response = execution.getVariable(Prefix + "assignSDNCResponse") boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") @@ -1087,10 +1090,10 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { if (execution.getVariable(Prefix + "sdncResponseSuccess") == true) { // from sdnc util, Prefix+'sdncResponseSuccess' execution.setVariable(Prefix + "isSdncRollbackNeeded", true) - msoLogger.debug("Successfully Validated SDNC Response") + logger.debug("Successfully Validated SDNC Response") } else { - msoLogger.debug("Did NOT Successfully Validated SDNC Response") + logger.debug("Did NOT Successfully Validated SDNC Response") throw new BpmnError("MSOWorkflowException") } @@ -1100,7 +1103,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside validateRpcSDNCActivateResponse() of DoCreateNetworkInstance") + logger.trace("Inside validateRpcSDNCActivateResponse() of DoCreateNetworkInstance") String response = execution.getVariable(Prefix + "activateSDNCResponse") boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") @@ -1115,10 +1118,10 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { if (execution.getVariable(Prefix + "sdncResponseSuccess") == true) { // from sdnc util, Prefix+'sdncResponseSuccess' execution.setVariable(Prefix + "isSdncActivateRollbackNeeded", true) - msoLogger.debug("Successfully Validated Rpc SDNC Activate Response") + logger.debug("Successfully Validated Rpc SDNC Activate Response") } else { - msoLogger.debug("Did NOT Successfully Validated Rpc SDNC Activate Response") + logger.debug("Did NOT Successfully Validated Rpc SDNC Activate Response") throw new BpmnError("MSOWorkflowException") } @@ -1129,7 +1132,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside prepareSDNCRollbackRequest() of DoCreateNetworkInstance") + logger.trace("Inside prepareSDNCRollbackRequest() of DoCreateNetworkInstance") try { // get variables @@ -1145,12 +1148,12 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String sndcTopologyRollbackRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, createNetworkInput, serviceInstanceId, sdncCallback, "rollback", "NetworkActivateRequest", cloudRegionId, networkId, null, null) String sndcTopologyRollbackRequestAsString = utils.formatXml(sndcTopologyRollbackRequest) execution.setVariable(Prefix + "rollbackSDNCRequest", sndcTopologyRollbackRequestAsString) - msoLogger.debug(" Preparing request for SDNC Topology 'rollback-NetworkActivateRequest' rollback . . . - " + "\n" + sndcTopologyRollbackRequestAsString) + logger.debug(" Preparing request for SDNC Topology 'rollback-NetworkActivateRequest' rollback . . . - " + "\n" + sndcTopologyRollbackRequestAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareSDNCRollbackRequest() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) } @@ -1161,7 +1164,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside prepareRpcSDNCRollbackRequest() of DoCreateNetworkInstance") + logger.trace("Inside prepareRpcSDNCRollbackRequest() of DoCreateNetworkInstance") try { // get variables @@ -1177,12 +1180,12 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, createNetworkInput, serviceInstanceId, sdncCallback, "unassign", "DeleteNetworkInstance", cloudRegionId, networkId, null) String sndcTopologyRollbackRpcRequestAsString = utils.formatXml(sndcTopologyRollbackRpcRequest) execution.setVariable(Prefix + "rollbackSDNCRequest", sndcTopologyRollbackRpcRequestAsString) - msoLogger.debug(" Preparing request for SDNC Topology 'unassign-DeleteNetworkInstance' rollback . . . - " + "\n" + sndcTopologyRollbackRpcRequestAsString) + logger.debug(" Preparing request for SDNC Topology 'unassign-DeleteNetworkInstance' rollback . . . - " + "\n" + sndcTopologyRollbackRpcRequestAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRpcSDNCRollbackRequest() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) } @@ -1193,7 +1196,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside prepareRpcSDNCActivateRollback() of DoCreateNetworkInstance") + logger.trace("Inside prepareRpcSDNCActivateRollback() of DoCreateNetworkInstance") try { @@ -1210,12 +1213,12 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, createNetworkInput, serviceInstanceId, sdncCallback, "deactivate", "DeleteNetworkInstance", cloudRegionId, networkId, null) String sndcTopologyRollbackRpcRequestAsString = utils.formatXml(sndcTopologyRollbackRpcRequest) execution.setVariable(Prefix + "rollbackActivateSDNCRequest", sndcTopologyRollbackRpcRequestAsString) - msoLogger.debug(" Preparing request for RPC SDNC Topology 'deactivate-DeleteNetworkInstance' rollback . . . - " + "\n" + sndcTopologyRollbackRpcRequestAsString) + logger.debug(" Preparing request for RPC SDNC Topology 'deactivate-DeleteNetworkInstance' rollback . . . - " + "\n" + sndcTopologyRollbackRpcRequestAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRpcSDNCActivateRollback() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) } @@ -1226,7 +1229,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside prepareRollbackData() of DoCreateNetworkInstance") + logger.trace("Inside prepareRollbackData() of DoCreateNetworkInstance") try { @@ -1250,14 +1253,14 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } } execution.setVariable("rollbackData", rollbackData) - msoLogger.debug("** rollbackData : " + rollbackData) + logger.debug("** rollbackData : " + rollbackData) execution.setVariable("WorkflowException", execution.getVariable(Prefix + "WorkflowException")) - msoLogger.debug("** WorkflowException : " + execution.getVariable("WorkflowException")) + logger.debug("** WorkflowException : " + execution.getVariable("WorkflowException")) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRollbackData() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) } @@ -1268,7 +1271,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside postProcessResponse() of DoCreateNetworkInstance") + logger.trace("Inside postProcessResponse() of DoCreateNetworkInstance") try { @@ -1277,7 +1280,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { // 2. Success: execution.getVariable("WorkflowException") == null (NULL) // 3. WorkflowException: execution.getVariable("WorkflowException") != null (NOT NULL) - msoLogger.debug(" ***** Is Exception Encountered (isException)? : " + execution.getVariable(Prefix + "isException")) + logger.debug(" ***** Is Exception Encountered (isException)? : " + execution.getVariable(Prefix + "isException")) // successful flow if (execution.getVariable(Prefix + "isException") == false) { // set rollback data @@ -1287,14 +1290,14 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { prepareSuccessRollbackData(execution) // populate rollbackData execution.setVariable("WorkflowException", null) execution.setVariable(Prefix + "Success", true) - msoLogger.debug(" ***** postProcessResponse(), GOOD !!!") + logger.debug(" ***** postProcessResponse(), GOOD !!!") } else { // inside sub-flow logic execution.setVariable(Prefix + "Success", false) execution.setVariable("rollbackData", null) String exceptionMessage = " Exception encountered in MSO Bpmn. " if (execution.getVariable("workflowException") != null) { // Output of Rollback flow. - msoLogger.debug(" ***** workflowException: " + execution.getVariable("workflowException")) + logger.debug(" ***** workflowException: " + execution.getVariable("workflowException")) WorkflowException wfex = execution.getVariable("workflowException") exceptionMessage = wfex.getErrorMessage() } else { @@ -1304,18 +1307,18 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } } // going to the Main flow: a-la-carte or macro - msoLogger.debug(" ***** postProcessResponse(), BAD !!!") + logger.debug(" ***** postProcessResponse(), BAD !!!") exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) throw new BpmnError("MSOWorkflowException") } } catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") + logger.debug("Rethrowing MSOWorkflowException") throw b } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. postProcessResponse() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) throw new BpmnError("MSOWorkflowException") @@ -1329,7 +1332,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside prepareSuccessRollbackData() of DoCreateNetworkInstance") + logger.trace("Inside prepareSuccessRollbackData() of DoCreateNetworkInstance") try { @@ -1361,13 +1364,13 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } execution.setVariable("rollbackData", rollbackData) - msoLogger.debug("** 'rollbackData' for Full Rollback : " + rollbackData) + logger.debug("** 'rollbackData' for Full Rollback : " + rollbackData) execution.setVariable("WorkflowException", null) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareSuccessRollbackData() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) } @@ -1378,7 +1381,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside setExceptionFlag() of DoCreateNetworkInstance") + logger.trace("Inside setExceptionFlag() of DoCreateNetworkInstance") try { @@ -1389,11 +1392,11 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } else { execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) } - msoLogger.debug(Prefix + "WorkflowException - " +execution.getVariable(Prefix + "WorkflowException")) + logger.debug(Prefix + "WorkflowException - " +execution.getVariable(Prefix + "WorkflowException")) } catch(Exception ex){ String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. setExceptionFlag(): " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) } @@ -1411,18 +1414,18 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) try{ - msoLogger.debug( "Caught a Java Exception in " + Prefix) - msoLogger.debug("Started processJavaException Method") - msoLogger.debug("Variables List: " + execution.getVariables()) + logger.debug( "Caught a Java Exception in " + Prefix) + logger.debug("Started processJavaException Method") + logger.debug("Variables List: " + execution.getVariables()) execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") }catch(Exception e){ - msoLogger.debug("Caught Exception during processJavaException Method: " + e) + logger.debug("Caught Exception during processJavaException Method: " + e) execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix) } - msoLogger.debug( "Completed processJavaException Method in " + Prefix) + logger.debug( "Completed processJavaException Method in " + Prefix) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy index fd6a4a1cde..c144dc0f46 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy @@ -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 @@ -25,7 +27,8 @@ import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.NetworkUtils @@ -43,7 +46,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution * */ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateNetworkInstanceRollback.class); + private static final Logger logger = LoggerFactory.getLogger( DoCreateNetworkInstanceRollback.class); String Prefix="CRENWKIR_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -96,7 +99,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside preProcessRequest() of " + className + ".groovy") + logger.trace("Inside preProcessRequest() of " + className + ".groovy") try { // initialize flow variables @@ -128,10 +131,10 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkRequest) execution.setVariable(Prefix + "rollbackSDNCRequest", rollbackSDNCRequest) execution.setVariable(Prefix + "rollbackActivateSDNCRequest", rollbackActivateSDNCRequest) - msoLogger.debug("'rollbackData': " + '\n' + execution.getVariable("rollbackData")) + logger.debug("'rollbackData': " + '\n' + execution.getVariable("rollbackData")) String sdncVersion = execution.getVariable("sdncVersion") - msoLogger.debug("sdncVersion? : " + sdncVersion) + logger.debug("sdncVersion? : " + sdncVersion) // PO Authorization Info / headers Authorization= String basicAuthValuePO = UrnPropertiesReader.getVariable("mso.adapters.po.auth",execution) @@ -143,7 +146,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso } catch (IOException ex) { String exceptionMessage = "Exception Encountered in DoCreateNetworkInstance, PreProcessRequest() - " String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage() - msoLogger.debug(dataErrorMessage ) + logger.debug(dataErrorMessage ) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } @@ -152,7 +155,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso } else { execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) } - msoLogger.debug("*** WorkflowException : " + execution.getVariable(Prefix + "WorkflowException")) + logger.debug("*** WorkflowException : " + execution.getVariable(Prefix + "WorkflowException")) if(execution.getVariable(Prefix + "WorkflowException") != null) { // called by: DoCreateNetworkInstance, partial rollback execution.setVariable(Prefix + "fullRollback", false) @@ -162,7 +165,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso execution.setVariable(Prefix + "fullRollback", true) } - msoLogger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback")) + logger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback")) } catch (BpmnError e) { @@ -171,7 +174,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso } catch (Exception ex) { // caught exception String exceptionMessage = "Exception Encountered in PreProcessRequest() of " + className + ".groovy ***** : " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -182,7 +185,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside callPONetworkAdapter() of " + className + "") + logger.trace("Inside callPONetworkAdapter() of " + className + "") try { String poUrl = UrnPropertiesReader.getVariable("mso.adapters.network.rest.endpoint",execution) @@ -192,7 +195,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso String rollbackNetworkRequest = execution.getVariable(Prefix + "rollbackNetworkRequest") String urlRollbackPoNetwork = poUrl+ "/" + networkId + "/rollback" - msoLogger.debug("'urlRollbackPoNetwork': " + urlRollbackPoNetwork) + logger.debug("'urlRollbackPoNetwork': " + urlRollbackPoNetwork) execution.setVariable(Prefix + "urlRollbackPoNetwork", urlRollbackPoNetwork) URL url = new URL(urlRollbackPoNetwork) @@ -202,12 +205,12 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso execution.setVariable(Prefix + "rollbackNetworkReturnCode", response.getStatus()) - msoLogger.debug(" Network Adapter rollback responseCode: " + response.getStatus()) + logger.debug(" Network Adapter rollback responseCode: " + response.getStatus()) } catch (Exception ex) { String exceptionMessage = "Exception Encountered in callPONetworkAdapter() of DoCreateNetworkInstanceRollback flow - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -218,7 +221,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside validateRollbackResponses() of DoCreateNetworkInstanceRollback") + logger.trace("Inside validateRollbackResponses() of DoCreateNetworkInstanceRollback") try { // validate PO network rollback response @@ -226,7 +229,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso String rollbackNetworkReturnCode = "200" if (execution.getVariable(Prefix + "rollbackNetworkRequest") != null) { rollbackNetworkReturnCode = execution.getVariable(Prefix + "rollbackNetworkReturnCode") - msoLogger.debug(" NetworkRollback Code - " + rollbackNetworkReturnCode) + logger.debug(" NetworkRollback Code - " + rollbackNetworkReturnCode) if (rollbackNetworkReturnCode != "200") { rollbackNetworkErrorMessages = " + PO Network rollback failed. " } else { @@ -258,8 +261,8 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso } else { rollbackSdncErrorMessages = " + SDNC assign rollback failed. " } - msoLogger.debug(" SDNC assign rollback Code - " + rollbackSDNCReturnCode) - msoLogger.debug(" SDNC assign rollback Response - " + rollbackSDNCResponse) + logger.debug(" SDNC assign rollback Code - " + rollbackSDNCReturnCode) + logger.debug(" SDNC assign rollback Response - " + rollbackSDNCResponse) } // validate SDNC activate rollback response @@ -285,14 +288,14 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso } else { rollbackActivateSdncErrorMessages = " + SDNC activate rollback failed. " } - msoLogger.debug(" SDNC activate rollback Code - " + rollbackActivateSDNCReturnCode) - msoLogger.debug(" SDNC activate rollback Response - " + rollbackActivateSDNCResponse) + logger.debug(" SDNC activate rollback Code - " + rollbackActivateSDNCReturnCode) + logger.debug(" SDNC activate rollback Response - " + rollbackActivateSDNCResponse) } String statusMessage = "" int errorCode = 7000 - msoLogger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback")) + logger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback")) if (execution.getVariable(Prefix + "fullRollback") == false) { // original WorkflowException, WorkflowException wfe = execution.getVariable(Prefix + "WorkflowException") @@ -316,7 +319,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso } statusMessage = statusMessage + rollbackActivateSdncErrorMessages + rollbackNetworkErrorMessages + rollbackSdncErrorMessages - msoLogger.debug("Final DoCreateNetworkInstanceRollback status message: " + statusMessage) + logger.debug("Final DoCreateNetworkInstanceRollback status message: " + statusMessage) String processKey = getProcessKey(execution); WorkflowException exception = new WorkflowException(processKey, errorCode, statusMessage); execution.setVariable("workflowException", exception); @@ -329,7 +332,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso execution.setVariable("rollbackError", false) } else { String exceptionMessage = "Network Create Rollback was not Successful. " - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) execution.setVariable("rollbackSuccessful", false) execution.setVariable("rollbackError", true) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) @@ -342,7 +345,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso } catch (Exception ex) { String errorMessage = "See Previous Camunda flows for cause of Error: Undetermined Exception." String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstanceRollback flow. validateRollbackResponses() - " + errorMessage + ": " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) } @@ -360,18 +363,18 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso execution.setVariable("prefix",Prefix) try{ - msoLogger.debug("Caught a Java Exception in " + Prefix) - msoLogger.debug("Started processJavaException Method") - msoLogger.debug("Variables List: " + execution.getVariables()) + logger.debug("Caught a Java Exception in " + Prefix) + logger.debug("Started processJavaException Method") + logger.debug("Variables List: " + execution.getVariables()) execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") }catch(Exception e){ - msoLogger.debug("Caught Exception during processJavaException Method: " + e) + logger.debug("Caught Exception during processJavaException Method: " + e) execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix) } - msoLogger.debug("Completed processJavaException Method in " + Prefix) + logger.debug("Completed processJavaException Method in " + Prefix) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy index 6096f16b18..98def612de 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 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 @@ -39,7 +41,8 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.common.resource.ResourceRequestBuilder -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory @@ -61,31 +64,31 @@ import org.onap.so.logger.MsoLogger * @param - WorkflowException */ public class DoCreateResources extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateResources.class); + private static final Logger logger = LoggerFactory.getLogger( DoCreateResources.class); ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create() public void preProcessRequest(DelegateExecution execution) { - msoLogger.trace("preProcessRequest ") + logger.trace("preProcessRequest ") String msg = "" List addResourceList = execution.getVariable("addResourceList") if (addResourceList == null) { msg = "Input addResourceList is null" - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } else if (addResourceList.size() == 0) { msg = "No resource in addResourceList" - msoLogger.info(msg) + logger.info(msg) } - msoLogger.trace("Exit preProcessRequest ") + logger.trace("Exit preProcessRequest ") } public void sequenceResoure(DelegateExecution execution) { - msoLogger.trace("Start sequenceResoure Process ") + logger.trace("Start sequenceResoure Process ") String incomingRequest = execution.getVariable("uuiRequest") String serviceModelUuid = jsonUtil.getJsonValue(incomingRequest,"service.serviceUuid") @@ -105,7 +108,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ // get Sequence from csar(model) if(resourceSequence == null) { resourceSequence = ResourceRequestBuilder.getResourceSequence(serviceModelUuid) - msoLogger.info("Get Sequence from csar : " + resourceSequence) + logger.info("Get Sequence from csar : " + resourceSequence) } if(resourceSequence != null) { @@ -151,13 +154,13 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ execution.setVariable("isContainsWanResource", isContainsWanResource) execution.setVariable("currentResourceIndex", 0) execution.setVariable("sequencedResourceList", sequencedResourceList) - msoLogger.info("sequencedResourceList: " + sequencedResourceList) - msoLogger.trace("COMPLETED sequenceResoure Process ") + logger.info("sequencedResourceList: " + sequencedResourceList) + logger.trace("COMPLETED sequenceResoure Process ") } public prepareServiceTopologyRequest(DelegateExecution execution) { - msoLogger.trace("======== Start prepareServiceTopologyRequest Process ======== ") + logger.trace("======== Start prepareServiceTopologyRequest Process ======== ") String serviceDecompose = execution.getVariable("serviceDecomposition") @@ -172,21 +175,21 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ execution.setVariable("modelUuid", serviceUuid) execution.setVariable("serviceModelName", serviceModelName) - msoLogger.trace("======== End prepareServiceTopologyRequest Process ======== ") + logger.trace("======== End prepareServiceTopologyRequest Process ======== ") } public void getCurrentResoure(DelegateExecution execution){ - msoLogger.trace("Start getCurrentResoure Process ") + logger.trace("Start getCurrentResoure Process ") def currentIndex = execution.getVariable("currentResourceIndex") List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") Resource currentResource = sequencedResourceList.get(currentIndex) execution.setVariable("resourceType", currentResource.getModelInfo().getModelName()) - msoLogger.info("Now we deal with resouce:" + currentResource.getModelInfo().getModelName()) - msoLogger.trace("COMPLETED getCurrentResoure Process ") + logger.info("Now we deal with resouce:" + currentResource.getModelInfo().getModelName()) + logger.trace("COMPLETED getCurrentResoure Process ") } public void parseNextResource(DelegateExecution execution){ - msoLogger.trace("Start parseNextResource Process ") + logger.trace("Start parseNextResource Process ") def currentIndex = execution.getVariable("currentResourceIndex") def nextIndex = currentIndex + 1 execution.setVariable("currentResourceIndex", nextIndex) @@ -196,17 +199,17 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ }else{ execution.setVariable("allResourceFinished", "false") } - msoLogger.trace("COMPLETED parseNextResource Process ") + logger.trace("COMPLETED parseNextResource Process ") } public void prepareResourceRecipeRequest(DelegateExecution execution){ - msoLogger.trace("Start prepareResourceRecipeRequest Process ") + logger.trace("Start prepareResourceRecipeRequest Process ") ResourceInput resourceInput = new ResourceInput() String serviceInstanceName = execution.getVariable("serviceInstanceName") String resourceType = execution.getVariable("resourceType") String resourceInstanceName = resourceType + "_" + serviceInstanceName resourceInput.setResourceInstanceName(resourceInstanceName) - msoLogger.info("Prepare Resource Request resourceInstanceName:" + resourceInstanceName) + logger.info("Prepare Resource Request resourceInstanceName:" + resourceInstanceName) String globalSubscriberId = execution.getVariable("globalSubscriberId") String serviceType = execution.getVariable("serviceType") String serviceInstanceId = execution.getVariable("serviceInstanceId") @@ -234,11 +237,11 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ resourceInput.setRequestsInputs(incomingRequest) execution.setVariable("resourceInput", resourceInput.toString()) execution.setVariable("resourceModelUUID", resourceInput.getResourceModelInfo().getModelUuid()) - msoLogger.trace("COMPLETED prepareResourceRecipeRequest Process ") + logger.trace("COMPLETED prepareResourceRecipeRequest Process ") } public void executeResourceRecipe(DelegateExecution execution){ - msoLogger.trace("Start executeResourceRecipe Process ") + logger.trace("Start executeResourceRecipe Process ") try { String requestId = execution.getVariable("msoRequestId") @@ -261,16 +264,16 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ HttpResponse resp = bpmnRestClient.post(recipeURL, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput, recipeParamXsd) } else { String exceptionMessage = "Resource receipe is not found for resource modeluuid: " + resourceModelUUID - msoLogger.trace(exceptionMessage) + logger.trace(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 500, exceptionMessage) } - msoLogger.trace("======== end executeResourceRecipe Process ======== ") + logger.trace("======== end executeResourceRecipe Process ======== ") }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") + logger.debug("Rethrowing MSOWorkflowException") throw b }catch(Exception e){ - msoLogger.debug("Error occured within DoCreateResources executeResourceRecipe method: " + e) + logger.debug("Error occured within DoCreateResources executeResourceRecipe method: " + e) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured during DoCreateResources executeResourceRecipe Catalog") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy index c04bbd4806..163bd0f583 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy @@ -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 @@ -44,7 +46,8 @@ import org.onap.so.client.aai.AAIResourcesClient import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUri import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory /** * This groovy class supports the <class>DoCreateServiceInstance.bpmn</class> process. @@ -74,7 +77,7 @@ import org.onap.so.logger.MsoLogger */ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateServiceInstance.class); + private static final Logger logger = LoggerFactory.getLogger( DoCreateServiceInstance.class); String Prefix="DCRESI_" ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() @@ -83,7 +86,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") String msg = "" - msoLogger.trace("preProcessRequest") + logger.trace("preProcessRequest") try { String requestId = execution.getVariable("msoRequestId") @@ -108,13 +111,13 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { if (isBlank(globalSubscriberId)) { msg = "Input globalSubscriberId is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(subscriptionServiceType)) { msg = "Input subscriptionServiceType is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } @@ -125,11 +128,11 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) if (isBlank(sdncCallbackUrl)) { msg = "mso.workflow.sdncadapter.callback is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl) + logger.debug("SDNC Callback URL: " + sdncCallbackUrl) //requestDetails.modelInfo.for AAI PUT servieInstanceData & SDNC assignTopology String modelInvariantUuid = "" @@ -146,7 +149,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { if (serviceDecomp != null) { serviceType = serviceDecomp.getServiceType() ?: "" - msoLogger.debug("serviceType:" + serviceType) + logger.debug("serviceType:" + serviceType) serviceRole = serviceDecomp.getServiceRole() ?: "" ServiceInstance serviceInstance = serviceDecomp.getServiceInstance() @@ -169,7 +172,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { else { msg = "Input serviceModelInfo is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } } @@ -182,7 +185,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { String serviceModelInfo = execution.getVariable("serviceModelInfo") if (isBlank(serviceModelInfo)) { msg = "Input serviceModelInfo is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") ?: "" @@ -204,7 +207,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { //alacarte SIs are NOT sent to sdnc. exceptions are listed in config variable String svcTypes = UrnPropertiesReader.getVariable("sdnc.si.svc.types",execution) ?: "" - msoLogger.debug("SDNC SI serviceTypes:" + svcTypes) + logger.debug("SDNC SI serviceTypes:" + svcTypes) List<String> svcList = Arrays.asList(svcTypes.split("\\s*,\\s*")); boolean isSdncService= false for (String listEntry : svcList){ @@ -225,15 +228,15 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { if (isBlank(execution.getVariable("serviceInstanceName" ))) { msg = "Input serviceInstanceName must be provided for alacarte" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } } } - msoLogger.debug("isSdncService: " + isSdncService) - msoLogger.debug("Send To SDNC: " + execution.getVariable("sendToSDNC")) - msoLogger.debug("Service Type: " + execution.getVariable("serviceType")) + logger.debug("isSdncService: " + isSdncService) + logger.debug("Send To SDNC: " + execution.getVariable("sendToSDNC")) + logger.debug("Service Type: " + execution.getVariable("serviceType")) //macro may provide name and alacarte-portm may provide name execution.setVariable("checkAAI", false) @@ -244,7 +247,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { if (isBlank(serviceInstanceId)){ msg = "Input serviceInstanceId is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } @@ -277,10 +280,10 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit preProcessRequest") + logger.trace("Exit preProcessRequest") } public void getAAICustomerById (DelegateExecution execution) { @@ -288,7 +291,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { try { String globalCustomerId = execution.getVariable("globalSubscriberId") //VID to AAI name map - msoLogger.debug(" ***** getAAICustomerById ***** globalCustomerId:" + globalCustomerId) + logger.debug(" ***** getAAICustomerById ***** globalCustomerId:" + globalCustomerId) AAIUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalCustomerId) if(!getAAIClient().exists(uri)){ @@ -299,13 +302,13 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception in getAAICustomerById. " + ex.getMessage()) } - msoLogger.trace("Exit getAAICustomerById") + logger.trace("Exit getAAICustomerById") } public void putServiceInstance(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("putServiceInstance") + logger.trace("putServiceInstance") String msg = "" String serviceInstanceId = execution.getVariable("serviceInstanceId") try { @@ -326,17 +329,17 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { try{ String json = catalogDbUtils.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid ) - msoLogger.debug("JSON IS: "+json) + logger.debug("JSON IS: "+json) environmentContext = jsonUtil.getJsonValue(json, "serviceResources.environmentContext") ?: "" workloadContext = jsonUtil.getJsonValue(json, "serviceResources.workloadContext") ?: "" - msoLogger.debug("Env Context is: "+ environmentContext) - msoLogger.debug("Workload Context is: "+ workloadContext) + logger.debug("Env Context is: "+ environmentContext) + logger.debug("Workload Context is: "+ workloadContext) }catch(BpmnError e){ throw e } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } @@ -371,16 +374,16 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("rollbackData", rollbackData) msg = "Exception in DoCreateServiceInstance.putServiceInstance. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit putServiceInstance") + logger.trace("Exit putServiceInstance") } public void preProcessSDNCAssignRequest(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") String msg = "" - msoLogger.trace("preProcessSDNCAssignRequest") + logger.trace("preProcessSDNCAssignRequest") try { def serviceInstanceId = execution.getVariable("serviceInstanceId") @@ -448,10 +451,10 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { </sdncadapterworkflow:SDNCRequestData> </sdncadapterworkflow:SDNCAdapterWorkflowRequest>""" - msoLogger.debug("sdncAssignRequest:\n" + sdncAssignRequest) + logger.debug("sdncAssignRequest:\n" + sdncAssignRequest) sdncAssignRequest = utils.formatXml(sdncAssignRequest) execution.setVariable("sdncAssignRequest", sdncAssignRequest) - msoLogger.debug("sdncAssignRequest: " + sdncAssignRequest) + logger.debug("sdncAssignRequest: " + sdncAssignRequest) def sdncRequestId2 = UUID.randomUUID().toString() String sdncDelete = sdncAssignRequest.replace(">assign<", ">delete<").replace(">CreateServiceInstance<", ">DeleteServiceInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") @@ -463,36 +466,36 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { rollbackData.put("SERVICEINSTANCE", "sdncDelete", sdncDelete) execution.setVariable("rollbackData", rollbackData) - msoLogger.debug("rollbackData:\n" + rollbackData.toString()) + logger.debug("rollbackData:\n" + rollbackData.toString()) } } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCAssignRequest. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit preProcessSDNCAssignRequest") + logger.trace("Exit preProcessSDNCAssignRequest") } public void postProcessSDNCAssign (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("postProcessSDNCAssign") + logger.trace("postProcessSDNCAssign") try { WorkflowException workflowException = execution.getVariable("WorkflowException") - msoLogger.debug("workflowException: " + workflowException) + logger.debug("workflowException: " + workflowException) boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") String response = execution.getVariable("sdncAdapterResponse") - msoLogger.debug("SDNCResponse: " + response) + logger.debug("SDNCResponse: " + response) SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - msoLogger.debug("Good response from SDNC Adapter for service-instance topology assign: \n" + response) + logger.debug("Good response from SDNC Adapter for service-instance topology assign: \n" + response) def rollbackData = execution.getVariable("rollbackData") if (rollbackData != null) { @@ -501,7 +504,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { } }else{ - msoLogger.debug("Bad Response from SDNC Adapter for service-instance assign") + logger.debug("Bad Response from SDNC Adapter for service-instance assign") throw new BpmnError("MSOWorkflowException") } @@ -509,31 +512,31 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { throw e; } catch(Exception ex) { msg = "Exception in postProcessSDNCAssign. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit postProcessSDNCAssign") + logger.trace("Exit postProcessSDNCAssign") } public void postProcessAAIGET2(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("postProcessAAIGET2") + logger.trace("postProcessAAIGET2") String msg = "" try { String serviceInstanceName = execution.getVariable("serviceInstanceName") boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") if(!succInAAI){ - msoLogger.debug("Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName) + logger.debug("Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName) WorkflowException workflowException = execution.getVariable("WorkflowException") - msoLogger.debug("workflowException: " + workflowException) + logger.debug("workflowException: " + workflowException) if(workflowException != null){ exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) } else { msg = "Failure in postProcessAAIGET2 GENGS_SuccessIndicator:" + succInAAI - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) } } @@ -544,7 +547,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { String aaiService = execution.getVariable("GENGS_service") if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "service-instance-name"))) { execution.setVariable("serviceInstanceName", utils.getNodeText(aaiService, "service-instance-name")) - msoLogger.debug("Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName")) + logger.debug("Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName")) } } } @@ -552,94 +555,94 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { throw e; } catch (Exception ex) { msg = "Exception in DoCreateServiceInstance.postProcessAAIGET2 " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit postProcessAAIGET2") + logger.trace("Exit postProcessAAIGET2") } public void preProcessRollback (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("preProcessRollback") + logger.trace("preProcessRollback") try { Object workflowException = execution.getVariable("WorkflowException"); if (workflowException instanceof WorkflowException) { - msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage()) + logger.debug("Prev workflowException: " + workflowException.getErrorMessage()) execution.setVariable("prevWorkflowException", workflowException); //execution.setVariable("WorkflowException", null); } } catch (BpmnError e) { - msoLogger.debug("BPMN Error during preProcessRollback") + logger.debug("BPMN Error during preProcessRollback") } catch(Exception ex) { String msg = "Exception in preProcessRollback. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } - msoLogger.trace("Exit preProcessRollback") + logger.trace("Exit preProcessRollback") } public void postProcessRollback (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("postProcessRollback") + logger.trace("postProcessRollback") String msg = "" try { Object workflowException = execution.getVariable("prevWorkflowException"); if (workflowException instanceof WorkflowException) { - msoLogger.debug("Setting prevException to WorkflowException: ") + logger.debug("Setting prevException to WorkflowException: ") execution.setVariable("WorkflowException", workflowException); } execution.setVariable("rollbackData", null) } catch (BpmnError b) { - msoLogger.debug("BPMN Error during postProcessRollback") + logger.debug("BPMN Error during postProcessRollback") throw b; } catch(Exception ex) { msg = "Exception in postProcessRollback. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } - msoLogger.trace("Exit postProcessRollback") + logger.trace("Exit postProcessRollback") } public void createProject(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("createProject") + logger.trace("createProject") String bpmnRequest = execution.getVariable("requestJson") String projectName = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.project.projectName") String serviceInstance = execution.getVariable("serviceInstanceId") - msoLogger.debug("BPMN REQUEST IS: "+ bpmnRequest) - msoLogger.debug("PROJECT NAME: " + projectName) - msoLogger.debug("Service Instance: " + serviceInstance) + logger.debug("BPMN REQUEST IS: "+ bpmnRequest) + logger.debug("PROJECT NAME: " + projectName) + logger.debug("Service Instance: " + serviceInstance) if(projectName == null||projectName.equals("")){ - msoLogger.debug("Project Name was not found in input. Skipping task...") + logger.debug("Project Name was not found in input. Skipping task...") }else{ try{ AAICreateResources aaiCR = new AAICreateResources() aaiCR.createAAIProject(projectName, serviceInstance) }catch(Exception ex){ String msg = "Exception in createProject. " + ex.getMessage(); - msoLogger.debug(msg) - msoLogger.error(ex); + logger.debug(msg) + logger.error(ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } - msoLogger.trace("Exit createProject") + logger.trace("Exit createProject") } public void createOwningEntity(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("createOwningEntity") + logger.trace("createOwningEntity") String msg = ""; String bpmnRequest = execution.getVariable("requestJson") String owningEntityId = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.owningEntity.owningEntityId") String owningEntityName = jsonUtil.getJsonValue(bpmnRequest,"requestDetails.owningEntity.owningEntityName"); String serviceInstance = execution.getVariable("serviceInstanceId") - msoLogger.debug("owningEntity: " + owningEntityId) - msoLogger.debug("OwningEntityName: "+ owningEntityName) - msoLogger.debug("Service Instance: " + serviceInstance) + logger.debug("owningEntity: " + owningEntityId) + logger.debug("OwningEntityName: "+ owningEntityName) + logger.debug("Service Instance: " + serviceInstance) try{ AAICreateResources aaiCR = new AAICreateResources() @@ -665,11 +668,11 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { } } }catch(Exception ex){ - msoLogger.debug(msg) - msoLogger.error(ex); + logger.debug(msg) + logger.error(ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit createOwningEntity") + logger.trace("Exit createOwningEntity") } // ******************************* @@ -680,18 +683,18 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") try{ - msoLogger.debug("Caught a Java Exception in DoCreateServiceInstance") - msoLogger.debug("Started processJavaException Method") - msoLogger.debug("Variables List: " + execution.getVariables()) + logger.debug("Caught a Java Exception in DoCreateServiceInstance") + logger.debug("Started processJavaException Method") + logger.debug("Variables List: " + execution.getVariables()) execution.setVariable("UnexpectedError", "Caught a Java Lang Exception in DoCreateServiceInstance") // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception in DoCreateServiceInstance") }catch(Exception e){ - msoLogger.debug("Caught Exception during processJavaException Method: " + e) + logger.debug("Caught Exception during processJavaException Method: " + e) execution.setVariable("UnexpectedError", "Exception in processJavaException") // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method") } - msoLogger.trace("Completed processJavaException Method in DoCreateServiceInstance") + logger.trace("Completed processJavaException Method in DoCreateServiceInstance") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy index e80941e212..a337087105 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -30,8 +32,8 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.RollbackData import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.logger.MsoLogger -import org.onap.so.logger.MessageEnum +import org.slf4j.Logger +import org.slf4j.LoggerFactory import java.util.UUID; @@ -62,7 +64,7 @@ import org.springframework.web.util.UriUtils; * */ public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateServiceInstanceRollback.class); + private static final Logger logger = LoggerFactory.getLogger( DoCreateServiceInstanceRollback.class); String Prefix="DCRESIRB_" @@ -71,13 +73,13 @@ public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcesso def isDebugEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) String msg = "" - msoLogger.trace("preProcessRequest") + logger.trace("preProcessRequest") execution.setVariable("rollbackAAI",false) execution.setVariable("rollbackSDNC",false) try { def rollbackData = execution.getVariable("rollbackData") - msoLogger.debug("RollbackData:" + rollbackData) + logger.debug("RollbackData:" + rollbackData) if (rollbackData != null) { if (rollbackData.hasType("SERVICEINSTANCE")) { @@ -112,8 +114,8 @@ public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcesso execution.setVariable("sdncDelete", sdncDelete) def sdncDeactivate = rollbackData.get("SERVICEINSTANCE", "sdncDeactivate") execution.setVariable("sdncDeactivate", sdncDeactivate) - msoLogger.debug("sdncDeactivate:\n" + sdncDeactivate) - msoLogger.debug("sdncDelete:\n" + sdncDelete) + logger.debug("sdncDeactivate:\n" + sdncDeactivate) + logger.debug("sdncDelete:\n" + sdncDelete) } else { execution.setVariable("skipRollback", true) @@ -131,48 +133,48 @@ public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcesso throw e; } catch (Exception ex){ msg = "Exception in Create ServiceInstance Rollback preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit preProcessRequest") + logger.trace("Exit preProcessRequest") } public void validateSDNCResponse(DelegateExecution execution, String response, String method) { - msoLogger.trace("validateSDNCResponse") + logger.trace("validateSDNCResponse") String msg = "" try { WorkflowException workflowException = execution.getVariable("WorkflowException") boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - msoLogger.debug("SDNCResponse: " + response) - msoLogger.debug("workflowException: " + workflowException) + logger.debug("SDNCResponse: " + response) + logger.debug("workflowException: " + workflowException) SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ msg = "SDNC Adapter service-instance rollback successful for " + method - msoLogger.debug(msg) + logger.debug(msg) }else{ execution.setVariable("rolledBack", false) msg = "Error Response from SDNC Adapter service-instance rollback for " + method execution.setVariable("rollbackError", msg) - msoLogger.debug(msg) + logger.debug(msg) throw new BpmnError("MSOWorkflowException") } } catch (BpmnError e) { throw e; } catch (Exception ex){ msg = "Exception in Create ServiceInstance rollback for " + method + " Exception:" + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit validateSDNCResponse") + logger.trace("Exit validateSDNCResponse") } public void postProcessRequest(DelegateExecution execution) { - msoLogger.trace("postProcessRequest") + logger.trace("postProcessRequest") String msg = "" try { execution.setVariable("rollbackData", null) @@ -189,51 +191,51 @@ public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcesso if(!succInAAI){ execution.setVariable("rolledBack", false) //both sdnc and aai must be successful to declare rollback Succesful execution.setVariable("rollbackError", "Error deleting service-instance in AAI for rollback") - msoLogger.debug("Error deleting service-instance in AAI for rollback", + serviceInstanceId) + logger.debug("Error deleting service-instance in AAI for rollback", + serviceInstanceId) } } - msoLogger.trace("Exit postProcessRequest") + logger.trace("Exit postProcessRequest") } catch (BpmnError e) { msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + e.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } catch (Exception ex) { msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } } public void processRollbackException(DelegateExecution execution){ - msoLogger.trace("processRollbackException") + logger.trace("processRollbackException") try{ - msoLogger.debug("Caught an Exception in DoCreateServiceInstanceRollback") + logger.debug("Caught an Exception in DoCreateServiceInstanceRollback") execution.setVariable("rollbackData", null) execution.setVariable("rollbackError", "Caught exception in ServiceInstance Create Rollback") execution.setVariable("WorkflowException", null) }catch(BpmnError b){ - msoLogger.debug("BPMN Error during processRollbackExceptions Method: ") + logger.debug("BPMN Error during processRollbackExceptions Method: ") }catch(Exception e){ - msoLogger.debug("Caught Exception during processRollbackExceptions Method: " + e.getMessage()) + logger.debug("Caught Exception during processRollbackExceptions Method: " + e.getMessage()) } - msoLogger.debug("Exit processRollbackException") + logger.debug("Exit processRollbackException") } public void processRollbackJavaException(DelegateExecution execution){ - msoLogger.trace("processRollbackJavaException") + logger.trace("processRollbackJavaException") try{ execution.setVariable("rollbackData", null) execution.setVariable("rollbackError", "Caught Java exception in ServiceInstance Create Rollback") - msoLogger.debug("Caught Exception in processRollbackJavaException") + logger.debug("Caught Exception in processRollbackJavaException") }catch(Exception e){ - msoLogger.debug("Caught Exception in processRollbackJavaException " + e.getMessage()) + logger.debug("Caught Exception in processRollbackJavaException " + e.getMessage()) } - msoLogger.trace("Exit processRollbackJavaException") + logger.trace("Exit processRollbackJavaException") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy index 33d0e25d7d..b17b0a37b7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -32,6 +34,8 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.utils.TargetEntity @@ -43,7 +47,7 @@ import javax.ws.rs.core.Response * flow for VFC Network Service Create */ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVFCNetworkServiceInstance.class); + private static final Logger logger = LoggerFactory.getLogger( DoCreateVFCNetworkServiceInstance.class); ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -58,23 +62,23 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces */ public void preProcessRequest (DelegateExecution execution) { String msg = "" - msoLogger.trace("preProcessRequest()") + logger.trace("preProcessRequest()") try { //deal with nsName and Description String nsServiceName = execution.getVariable("nsServiceName") String nsServiceDescription = execution.getVariable("nsServiceDescription") - msoLogger.debug("nsServiceName:" + nsServiceName + " nsServiceDescription:" + nsServiceDescription) + logger.debug("nsServiceName:" + nsServiceName + " nsServiceDescription:" + nsServiceDescription) //deal with operation key String globalSubscriberId = execution.getVariable("globalSubscriberId") - msoLogger.debug("globalSubscriberId:" + globalSubscriberId) + logger.debug("globalSubscriberId:" + globalSubscriberId) String serviceType = execution.getVariable("serviceType") - msoLogger.debug("serviceType:" + serviceType) + logger.debug("serviceType:" + serviceType) String serviceId = execution.getVariable("serviceId") - msoLogger.debug("serviceId:" + serviceId) + logger.debug("serviceId:" + serviceId) String operationId = execution.getVariable("operationId") - msoLogger.debug("serviceType:" + serviceType) + logger.debug("serviceType:" + serviceType) String nodeTemplateUUID = execution.getVariable("resourceUUID") - msoLogger.debug("nodeTemplateUUID:" + nodeTemplateUUID) + logger.debug("nodeTemplateUUID:" + nodeTemplateUUID) /* * segmentInformation needed as a object of segment * { @@ -87,7 +91,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces * } */ String nsParameters = execution.getVariable("resourceParameters") - msoLogger.debug("nsParameters:" + nsParameters) + logger.debug("nsParameters:" + nsParameters) String nsOperationKey = """{ "globalSubscriberId":"${globalSubscriberId}", "serviceType":"${serviceType}", @@ -102,7 +106,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces if (vfcAdapterUrl == null || vfcAdapterUrl.isEmpty()) { msg = getProcessKey(execution) + ': mso:adapters:vfcc:rest:endpoint URN mapping is not defined' - msoLogger.debug(msg) + logger.debug(msg) } while (vfcAdapterUrl.endsWith('/')) { @@ -116,17 +120,17 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit preProcessRequest") + logger.trace("Exit preProcessRequest") } /** * create NS task */ public void createNetworkService(DelegateExecution execution) { - msoLogger.trace("createNetworkService") + logger.trace("createNetworkService") String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl") String nsOperationKey = execution.getVariable("nsOperationKey"); String nsParameters = execution.getVariable("nsParameters"); @@ -146,14 +150,14 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces nsInstanceId = jsonUtil.getJsonValue(aaiResponseAsString, "nsInstanceId") } execution.setVariable("nsInstanceId", nsInstanceId) - msoLogger.trace("Exit createNetworkService") + logger.trace("Exit createNetworkService") } /** * instantiate NS task */ public void instantiateNetworkService(DelegateExecution execution) { - msoLogger.trace("instantiateNetworkService") + logger.trace("instantiateNetworkService") String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl") String nsOperationKey = execution.getVariable("nsOperationKey"); String nsParameters = execution.getVariable("nsParameters"); @@ -175,14 +179,14 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId") } execution.setVariable("jobId", jobId) - msoLogger.trace("Exit instantiateNetworkService") + logger.trace("Exit instantiateNetworkService") } /** * query NS task */ public void queryNSProgress(DelegateExecution execution) { - msoLogger.trace("queryNSProgress") + logger.trace("queryNSProgress") String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl") String jobId = execution.getVariable("jobId") String nsOperationKey = execution.getVariable("nsOperationKey"); @@ -195,7 +199,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces operationStatus = jsonUtil.getJsonValue(aaiResponseAsString, "responseDescriptor.status") } execution.setVariable("operationStatus", operationStatus) - msoLogger.trace("Exit queryNSProgress") + logger.trace("Exit queryNSProgress") } /** @@ -205,7 +209,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces try { Thread.sleep(5000); } catch(InterruptedException e) { - msoLogger.debug("Time Delay exception" + e ) + logger.debug("Time Delay exception" + e ) } } @@ -213,10 +217,10 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces * finish NS task */ public void addNSRelationship(DelegateExecution execution) { - msoLogger.trace("addNSRelationship") + logger.trace("addNSRelationship") String nsInstanceId = execution.getVariable("nsInstanceId") if(nsInstanceId == null || nsInstanceId == ""){ - msoLogger.debug(" create NS failed, so do not need to add relationship") + logger.debug(" create NS failed, so do not need to add relationship") return } String globalSubscriberId = execution.getVariable("globalSubscriberId") @@ -228,9 +232,11 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces try{ getAAIClient().connect(nsUri,relatedServiceUri) - msoLogger.info("NS relationship to Service added successfully") + logger.info("NS relationship to Service added successfully") }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Put Call", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception occured while executing AAI Put Call", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); throw new BpmnError("MSOWorkflowException") } } @@ -241,8 +247,8 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces * requestBody: the body of the request */ private Response postRequest(DelegateExecution execution, String urlString, String requestBody){ - msoLogger.trace("Started Execute VFC adapter Post Process") - msoLogger.debug("url:"+urlString +"\nrequestBody:"+ requestBody) + logger.trace("Started Execute VFC adapter Post Process") + logger.debug("url:"+urlString +"\nrequestBody:"+ requestBody) Response apiResponse = null try{ @@ -257,10 +263,10 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces apiResponse = httpClient.post(requestBody) - msoLogger.debug("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class)) - msoLogger.trace("Completed Execute VF-C adapter Post Process") + logger.debug("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class)) + logger.trace("Completed Execute VF-C adapter Post Process") }catch(Exception e){ - msoLogger.error("Exception occured while executing VFC Adapter Post Call" + e.getMessage ()); + logger.error("Exception occured while executing VFC Adapter Post Call" + e.getMessage ()); throw new BpmnError("MSOWorkflowException") } return apiResponse diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy index 53e3525036..9ee8ff8b67 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy @@ -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 @@ -61,6 +63,8 @@ import org.onap.so.constants.Defaults import org.onap.so.db.catalog.beans.HomingInstance import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.onap.so.utils.TargetEntity import org.w3c.dom.Document @@ -75,7 +79,7 @@ import com.fasterxml.jackson.databind.ObjectMapper public class DoCreateVfModule extends VfModuleBase { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVfModule.class); + private static final Logger logger = LoggerFactory.getLogger( DoCreateVfModule.class); String Prefix="DCVFM_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -95,7 +99,7 @@ public class DoCreateVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable('prefix', Prefix) try{ @@ -116,9 +120,9 @@ public class DoCreateVfModule extends VfModuleBase { String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo") def serviceModelInfo = execution.getVariable("serviceModelInfo") - msoLogger.debug("serviceModelInfo: " + serviceModelInfo) + logger.debug("serviceModelInfo: " + serviceModelInfo) String modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") - msoLogger.debug("modelInvariantUuid: " + modelInvariantUuid) + logger.debug("modelInvariantUuid: " + modelInvariantUuid) def vnfModelInfo = execution.getVariable("vnfModelInfo") @@ -136,66 +140,66 @@ public class DoCreateVfModule extends VfModuleBase { def cloudSiteId = execution.getVariable("lcpCloudRegionId") execution.setVariable("DCVFM_cloudSiteId", cloudSiteId) rollbackData.put("VFMODULE", "aiccloudregion", cloudSiteId) - msoLogger.debug("cloudSiteId: " + cloudSiteId) + logger.debug("cloudSiteId: " + cloudSiteId) //cloudOwner def cloudOwner = execution.getVariable("cloudOwner") execution.setVariable("DCVFM_cloudOwner", cloudOwner) rollbackData.put("VFMODULE", "cloudOwner", cloudOwner) - msoLogger.debug("cloudOwner: " + cloudOwner) + logger.debug("cloudOwner: " + cloudOwner) //vnfType def vnfType = execution.getVariable("vnfType") execution.setVariable("DCVFM_vnfType", vnfType) rollbackData.put("VFMODULE", "vnftype", vnfType) - msoLogger.debug("vnfType: " + vnfType) + logger.debug("vnfType: " + vnfType) //vnfName def vnfName = execution.getVariable("vnfName") execution.setVariable("DCVFM_vnfName", vnfName) rollbackData.put("VFMODULE", "vnfname", vnfName) - msoLogger.debug("vnfName: " + vnfName) + logger.debug("vnfName: " + vnfName) //vnfId def vnfId = execution.getVariable("vnfId") execution.setVariable("DCVFM_vnfId", vnfId) rollbackData.put("VFMODULE", "vnfid", vnfId) - msoLogger.debug("vnfId: " + vnfId) + logger.debug("vnfId: " + vnfId) //vfModuleName def vfModuleName = execution.getVariable("vfModuleName") execution.setVariable("DCVFM_vfModuleName", vfModuleName) rollbackData.put("VFMODULE", "vfmodulename", vfModuleName) - msoLogger.debug("vfModuleName: " + vfModuleName) + logger.debug("vfModuleName: " + vfModuleName) //vfModuleModelName def vfModuleModelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName") execution.setVariable("DCVFM_vfModuleModelName", vfModuleModelName) rollbackData.put("VFMODULE", "vfmodulemodelname", vfModuleModelName) - msoLogger.debug("vfModuleModelName: " + vfModuleModelName) + logger.debug("vfModuleModelName: " + vfModuleModelName) //modelCustomizationUuid def modelCustomizationUuid = jsonUtil.getJsonValue(vfModuleModelInfo, "modelCustomizationUuid") execution.setVariable("DCVFM_modelCustomizationUuid", modelCustomizationUuid) rollbackData.put("VFMODULE", "modelcustomizationuuid", modelCustomizationUuid) - msoLogger.debug("modelCustomizationUuid: " + modelCustomizationUuid) + logger.debug("modelCustomizationUuid: " + modelCustomizationUuid) //vfModuleId def vfModuleId = execution.getVariable("vfModuleId") execution.setVariable("DCVFM_vfModuleId", vfModuleId) - msoLogger.debug("vfModuleId: " + vfModuleId) + logger.debug("vfModuleId: " + vfModuleId) def requestId = execution.getVariable("msoRequestId") execution.setVariable("DCVFM_requestId", requestId) - msoLogger.debug("requestId: " + requestId) + logger.debug("requestId: " + requestId) rollbackData.put("VFMODULE", "msorequestid", requestId) // Set mso-request-id to request-id for VNF Adapter interface execution.setVariable("mso-request-id", requestId) //serviceId def serviceId = execution.getVariable("serviceId") execution.setVariable("DCVFM_serviceId", serviceId) - msoLogger.debug("serviceId: " + serviceId) + logger.debug("serviceId: " + serviceId) //serviceInstanceId def serviceInstanceId = execution.getVariable("serviceInstanceId") execution.setVariable("DCVFM_serviceInstanceId", serviceInstanceId) rollbackData.put("VFMODULE", "serviceInstanceId", serviceInstanceId) - msoLogger.debug("serviceInstanceId: " + serviceInstanceId) + logger.debug("serviceInstanceId: " + serviceInstanceId) //source - HARDCODED def source = "VID" execution.setVariable("DCVFM_source", source) rollbackData.put("VFMODULE", "source", source) - msoLogger.debug("source: " + source) + logger.debug("source: " + source) //backoutOnFailure def disableRollback = execution.getVariable("disableRollback") def backoutOnFailure = true @@ -203,15 +207,15 @@ public class DoCreateVfModule extends VfModuleBase { backoutOnFailure = false } execution.setVariable("DCVFM_backoutOnFailure", backoutOnFailure) - msoLogger.debug("backoutOnFailure: " + backoutOnFailure) + logger.debug("backoutOnFailure: " + backoutOnFailure) //isBaseVfModule def isBaseVfModule = execution.getVariable("isBaseVfModule") execution.setVariable("DCVFM_isBaseVfModule", isBaseVfModule) - msoLogger.debug("isBaseVfModule: " + isBaseVfModule) + logger.debug("isBaseVfModule: " + isBaseVfModule) //asdcServiceModelVersion def asdcServiceModelVersion = execution.getVariable("asdcServiceModelVersion") execution.setVariable("DCVFM_asdcServiceModelVersion", asdcServiceModelVersion) - msoLogger.debug("asdcServiceModelVersion: " + asdcServiceModelVersion) + logger.debug("asdcServiceModelVersion: " + asdcServiceModelVersion) //personaModelId execution.setVariable("DCVFM_personaModelId", jsonUtil.getJsonValue(vfModuleModelInfo, "modelInvariantUuid")) //personaModelVersion @@ -220,15 +224,15 @@ public class DoCreateVfModule extends VfModuleBase { def vfModuleLabel = execution.getVariable("vfModuleLabel") if (vfModuleLabel != null) { execution.setVariable("DCVFM_vfModuleLabel", vfModuleLabel) - msoLogger.debug("vfModuleLabel: " + vfModuleLabel) + logger.debug("vfModuleLabel: " + vfModuleLabel) } //Get or Generate UUID String uuid = execution.getVariable("DCVFM_uuid") if(uuid == null){ uuid = UUID.randomUUID() - msoLogger.debug("Generated messageId (UUID) is: " + uuid) + logger.debug("Generated messageId (UUID) is: " + uuid) }else{ - msoLogger.debug("Found messageId (UUID) is: " + uuid) + logger.debug("Found messageId (UUID) is: " + uuid) } //isVidRequest String isVidRequest = execution.getVariable("isVidRequest") @@ -239,7 +243,7 @@ public class DoCreateVfModule extends VfModuleBase { //globalSubscriberId String globalSubscriberId = execution.getVariable("globalSubscriberId") execution.setVariable("DCVFM_globalSubscriberId", globalSubscriberId) - msoLogger.debug("globalSubsrciberId: " + globalSubscriberId) + logger.debug("globalSubsrciberId: " + globalSubscriberId) // Set Homing Info String oofDirectives = null @@ -248,26 +252,26 @@ public class DoCreateVfModule extends VfModuleBase { if (homingInstance != null) { execution.setVariable("DCVFM_cloudSiteId", homingInstance.getCloudRegionId()) rollbackData.put("VFMODULE", "aiccloudregion", homingInstance.getCloudRegionId()) - msoLogger.debug("Overwriting cloudSiteId with homing cloudSiteId: " + + logger.debug("Overwriting cloudSiteId with homing cloudSiteId: " + homingInstance.getCloudRegionId()) execution.setVariable("DCVFM_cloudOwner", homingInstance.getCloudOwner()) rollbackData.put("VFMODULE", "cloudOwner", homingInstance.getCloudOwner()) - msoLogger.debug("Overwriting cloudOwner with homing cloudOwner: " + + logger.debug("Overwriting cloudOwner with homing cloudOwner: " + homingInstance.getCloudOwner()) oofDirectives = homingInstance.getOofDirectives() execution.setVariable("DCVFM_oofDirectives", oofDirectives) } } catch (Exception exception) { - msoLogger.debug("Could not find homing information for service instance: " + serviceInstanceId + + logger.debug("Could not find homing information for service instance: " + serviceInstanceId + "... continuing") - msoLogger.debug("Could not find homing information for service instance error: " + exception) + logger.debug("Could not find homing information for service instance error: " + exception) } //OofDirectives to Input Params Map<String,String> vfModuleInputParams = execution.getVariable("vfModuleInputParams") if (oofDirectives != null && vfModuleInputParams != null) { vfModuleInputParams.put("oof_directives", oofDirectives) vfModuleInputParams.put("sdnc_directives", "{}") - msoLogger.debug("OofDirectives are: " + oofDirectives) + logger.debug("OofDirectives are: " + oofDirectives) } else if (vfModuleInputParams != null) { vfModuleInputParams.put("oof_directives", "{}") vfModuleInputParams.put("sdnc_directives", "{}") @@ -279,11 +283,11 @@ public class DoCreateVfModule extends VfModuleBase { //usePreload def usePreload = execution.getVariable("usePreload") execution.setVariable("DCVFM_usePreload", usePreload) - msoLogger.debug("usePreload: " + usePreload) + logger.debug("usePreload: " + usePreload) //aLaCarte def aLaCarte = execution.getVariable("aLaCarte") execution.setVariable("DCVFM_aLaCarte", aLaCarte) - msoLogger.debug("aLaCarte: " + aLaCarte) + logger.debug("aLaCarte: " + aLaCarte) //get workload and environment context from parent SI String environmentContext = "" @@ -297,7 +301,7 @@ public class DoCreateVfModule extends VfModuleBase { throw e } catch (Exception ex){ String msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } @@ -310,7 +314,7 @@ public class DoCreateVfModule extends VfModuleBase { workloadContext = aaiJson.getOrDefault("workload-context","") }catch (Exception ex) { - msoLogger.debug("Error retreiving parent service instance information") + logger.debug("Error retreiving parent service instance information") } execution.setVariable("DCVFM_environmentContext",environmentContext) @@ -319,7 +323,7 @@ public class DoCreateVfModule extends VfModuleBase { } else { // The info is inside the request - DEAD CODE - msoLogger.debug("DoCreateVfModule request: " + request) + logger.debug("DoCreateVfModule request: " + request) //tenantId def tenantId = "" @@ -347,7 +351,7 @@ public class DoCreateVfModule extends VfModuleBase { } execution.setVariable("DCVFM_cloudSiteId", cloudSiteId) rollbackData.put("VFMODULE", "aiccloudregion", cloudSiteId) - msoLogger.debug("cloudSiteId: " + cloudSiteId) + logger.debug("cloudSiteId: " + cloudSiteId) //vnfType def vnfType = "" if (utils.nodeExists(request, "vnf-type")) { @@ -355,7 +359,7 @@ public class DoCreateVfModule extends VfModuleBase { } execution.setVariable("DCVFM_vnfType", vnfType) rollbackData.put("VFMODULE", "vnftype", vnfType) - msoLogger.debug("vnfType: " + vnfType) + logger.debug("vnfType: " + vnfType) //vnfName def vnfName = "" if (utils.nodeExists(request, "vnf-name")) { @@ -363,7 +367,7 @@ public class DoCreateVfModule extends VfModuleBase { } execution.setVariable("DCVFM_vnfName", vnfName) rollbackData.put("VFMODULE", "vnfname", vnfName) - msoLogger.debug("vnfName: " + vnfName) + logger.debug("vnfName: " + vnfName) //vnfId def vnfId = "" if (utils.nodeExists(request, "vnf-id")) { @@ -371,7 +375,7 @@ public class DoCreateVfModule extends VfModuleBase { } execution.setVariable("DCVFM_vnfId", vnfId) rollbackData.put("VFMODULE", "vnfid", vnfId) - msoLogger.debug("vnfId: " + vnfId) + logger.debug("vnfId: " + vnfId) //vfModuleName def vfModuleName = "" if (utils.nodeExists(request, "vf-module-name")) { @@ -379,7 +383,7 @@ public class DoCreateVfModule extends VfModuleBase { } execution.setVariable("DCVFM_vfModuleName", vfModuleName) rollbackData.put("VFMODULE", "vfmodulename", vfModuleName) - msoLogger.debug("vfModuleName: " + vfModuleName) + logger.debug("vfModuleName: " + vfModuleName) //vfModuleModelName def vfModuleModelName = "" if (utils.nodeExists(request, "vf-module-model-name")) { @@ -387,7 +391,7 @@ public class DoCreateVfModule extends VfModuleBase { } execution.setVariable("DCVFM_vfModuleModelName", vfModuleModelName) rollbackData.put("VFMODULE", "vfmodulemodelname", vfModuleModelName) - msoLogger.debug("vfModuleModelName: " + vfModuleModelName) + logger.debug("vfModuleModelName: " + vfModuleModelName) //modelCustomizationUuid def modelCustomizationUuid = "" if (utils.nodeExists(request, "model-customization-id")) { @@ -395,27 +399,27 @@ public class DoCreateVfModule extends VfModuleBase { } execution.setVariable("DCVFM_modelCustomizationUuid", modelCustomizationUuid) rollbackData.put("VFMODULE", "modelcustomizationuuid", modelCustomizationUuid) - msoLogger.debug("modelCustomizationUuid: " + modelCustomizationUuid) + logger.debug("modelCustomizationUuid: " + modelCustomizationUuid) //vfModuleId def vfModuleId = "" if (utils.nodeExists(request, "vf-module-id")) { vfModuleId = utils.getNodeText(request, "vf-module-id") } execution.setVariable("DCVFM_vfModuleId", vfModuleId) - msoLogger.debug("vfModuleId: " + vfModuleId) + logger.debug("vfModuleId: " + vfModuleId) def requestId = "" if (utils.nodeExists(request, "request-id")) { requestId = utils.getNodeText(request, "request-id") } execution.setVariable("DCVFM_requestId", requestId) - msoLogger.debug("requestId: " + requestId) + logger.debug("requestId: " + requestId) //serviceId def serviceId = "" if (utils.nodeExists(request, "service-id")) { serviceId = utils.getNodeText(request, "service-id") } execution.setVariable("DCVFM_serviceId", serviceId) - msoLogger.debug("serviceId: " + serviceId) + logger.debug("serviceId: " + serviceId) //serviceInstanceId def serviceInstanceId = "" if (utils.nodeExists(request, "service-instance-id")) { @@ -423,7 +427,7 @@ public class DoCreateVfModule extends VfModuleBase { } execution.setVariable("DCVFM_serviceInstanceId", serviceInstanceId) rollbackData.put("VFMODULE", "serviceInstanceId", serviceInstanceId) - msoLogger.debug("serviceInstanceId: " + serviceInstanceId) + logger.debug("serviceInstanceId: " + serviceInstanceId) //source def source = "" if (utils.nodeExists(request, "source")) { @@ -431,26 +435,26 @@ public class DoCreateVfModule extends VfModuleBase { } execution.setVariable("DCVFM_source", source) rollbackData.put("VFMODULE", "source", source) - msoLogger.debug("source: " + source) + logger.debug("source: " + source) //backoutOnFailure NetworkUtils networkUtils = new NetworkUtils() def backoutOnFailure = networkUtils.isRollbackEnabled(execution,request) execution.setVariable("DCVFM_backoutOnFailure", backoutOnFailure) - msoLogger.debug("backoutOnFailure: " + backoutOnFailure) + logger.debug("backoutOnFailure: " + backoutOnFailure) //isBaseVfModule def isBaseVfModule = "false" if (utils.nodeExists(request, "is-base-vf-module")) { isBaseVfModule = utils.getNodeText(request, "is-base-vf-module") } execution.setVariable("DCVFM_isBaseVfModule", isBaseVfModule) - msoLogger.debug("isBaseVfModule: " + isBaseVfModule) + logger.debug("isBaseVfModule: " + isBaseVfModule) //asdcServiceModelVersion def asdcServiceModelVersion = "" if (utils.nodeExists(request, "asdc-service-model-version")) { asdcServiceModelVersion = utils.getNodeText(request, "asdc-service-model-version") } execution.setVariable("DCVFM_asdcServiceModelVersion", asdcServiceModelVersion) - msoLogger.debug("asdcServiceModelVersion: " + asdcServiceModelVersion) + logger.debug("asdcServiceModelVersion: " + asdcServiceModelVersion) //personaModelId def personaModelId = "" @@ -458,7 +462,7 @@ public class DoCreateVfModule extends VfModuleBase { personaModelId = utils.getNodeText(request, "persona-model-id") } execution.setVariable("DCVFM_personaModelId", personaModelId) - msoLogger.debug("personaModelId: " + personaModelId) + logger.debug("personaModelId: " + personaModelId) //personaModelVersion def personaModelVersion = "" @@ -466,15 +470,15 @@ public class DoCreateVfModule extends VfModuleBase { personaModelVersion = utils.getNodeText(request, "persona-model-version") } execution.setVariable("DCVFM_personaModelVersion", personaModelVersion) - msoLogger.debug("personaModelVersion: " + personaModelVersion) + logger.debug("personaModelVersion: " + personaModelVersion) // Process the parameters String vnfParamsChildNodes = utils.getChildNodes(request, "vnf-params") if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){ - msoLogger.debug("Request contains NO VNF Params") + logger.debug("Request contains NO VNF Params") }else{ - msoLogger.debug("Request does contain VNF Params") + logger.debug("Request does contain VNF Params") execution.setVariable("DCVFM_vnfParamsExistFlag", true) InputSource xmlSource = new InputSource(new StringReader(request)); @@ -503,24 +507,24 @@ public class DoCreateVfModule extends VfModuleBase { if (homingInstance != null) { execution.setVariable("DCVFM_cloudSiteId", homingInstance.getCloudRegionId()) rollbackData.put("VFMODULE", "aiccloudregion", homingInstance.getCloudRegionId()) - msoLogger.debug("Overwriting cloudSiteId with homing cloudSiteId: " + + logger.debug("Overwriting cloudSiteId with homing cloudSiteId: " + homingInstance.getCloudRegionId()) execution.setVariable("DCVFM_cloudOwner", homingInstance.getCloudOwner()) rollbackData.put("VFMODULE", "cloudOwner", homingInstance.getCloudOwner()) - msoLogger.debug("Overwriting cloudOwner with homing cloudOwner: " + + logger.debug("Overwriting cloudOwner with homing cloudOwner: " + homingInstance.getCloudOwner()) oofDirectives = homingInstance.getOofDirectives() execution.setVariable("DCVFM_oofDirectives", oofDirectives) } } catch (Exception exception) { - msoLogger.debug("Could not find homing information for service instance: " + serviceInstanceId + + logger.debug("Could not find homing information for service instance: " + serviceInstanceId + "... continuing") - msoLogger.debug("Could not find homing information for service instance error: " + exception) + logger.debug("Could not find homing information for service instance error: " + exception) } if (oofDirectives != null) { Map<String, String> paramsMap = execution.getVariable("DCVFM_vnfParamsMap") paramsMap.put("oofDirectives", oofDirectives) - msoLogger.debug("OofDirectives are: " + oofDirectives) + logger.debug("OofDirectives are: " + oofDirectives) execution.setVariable("DCVFM_vnfParamsMap", paramsMap) } } @@ -530,16 +534,16 @@ public class DoCreateVfModule extends VfModuleBase { String uuid = execution.getVariable("DCVFM_uuid") if(uuid == null){ uuid = UUID.randomUUID() - msoLogger.debug("Generated messageId (UUID) is: " + uuid) + logger.debug("Generated messageId (UUID) is: " + uuid) }else{ - msoLogger.debug("Found messageId (UUID) is: " + uuid) + logger.debug("Found messageId (UUID) is: " + uuid) } // Get sdncVersion, default to empty String sdncVersion = execution.getVariable("sdncVersion") if (sdncVersion == null) { sdncVersion = "" } - msoLogger.debug("sdncVersion: " + sdncVersion) + logger.debug("sdncVersion: " + sdncVersion) execution.setVariable("DCVFM_sdncVersion", sdncVersion) execution.setVariable("DCVFM_uuid", uuid) @@ -564,24 +568,25 @@ public class DoCreateVfModule extends VfModuleBase { String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, msg); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } execution.setVariable("DCVFM_sdncCallbackUrl", sdncCallbackUrl) - msoLogger.debug("SDNC Callback URL is: " + sdncCallbackUrl) + logger.debug("SDNC Callback URL is: " + sdncCallbackUrl) execution.setVariable("rollbackData", rollbackData) }catch(BpmnError b){ - msoLogger.error(b); + logger.error(b); throw b }catch(Exception e){ - msoLogger.error(e); + logger.error(e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!") } - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } /** @@ -607,15 +612,17 @@ public class DoCreateVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { sendWorkflowResponse(execution, 200, "") - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Internal Error') } @@ -633,28 +640,28 @@ public class DoCreateVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def createResponse = execution.getVariable('DCVFM_createVfModuleResponse') - msoLogger.debug("createVfModule Response: " + createResponse) + logger.debug("createVfModule Response: " + createResponse) def rollbackData = execution.getVariable("rollbackData") String vnfName = utils.getNodeText(createResponse, 'vnf-name') if (vnfName != null) { execution.setVariable('DCVFM_vnfName', vnfName) - msoLogger.debug("vnfName retrieved from AAI is: " + vnfName) + logger.debug("vnfName retrieved from AAI is: " + vnfName) rollbackData.put("VFMODULE", "vnfname", vnfName) } String vnfId = utils.getNodeText(createResponse, 'vnf-id') execution.setVariable('DCVFM_vnfId', vnfId) - msoLogger.debug("vnfId is: " + vnfId) + logger.debug("vnfId is: " + vnfId) String vfModuleId = utils.getNodeText(createResponse, 'vf-module-id') execution.setVariable('DCVFM_vfModuleId', vfModuleId) - msoLogger.debug("vfModuleId is: " + vfModuleId) + logger.debug("vfModuleId is: " + vfModuleId) String vfModuleIndex= utils.getNodeText(createResponse, 'vf-module-index') execution.setVariable('DCVFM_vfModuleIndex', vfModuleIndex) - msoLogger.debug("vfModuleIndex is: " + vfModuleIndex) + logger.debug("vfModuleIndex is: " + vfModuleIndex) rollbackData.put("VFMODULE", "vnfid", vnfId) rollbackData.put("VFMODULE", "vfmoduleid", vfModuleId) rollbackData.put("VFMODULE", "rollbackCreateAAIVfModule", "true") @@ -662,10 +669,10 @@ public class DoCreateVfModule extends VfModuleBase { execution.setVariable("rollbackData", rollbackData) } catch (Exception ex) { ex.printStackTrace() - msoLogger.debug('Exception occurred while postProcessing CreateAAIVfModule request:' + ex.getMessage()) + logger.debug('Exception occurred while postProcessing CreateAAIVfModule request:' + ex.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Bad response from CreateAAIVfModule' + ex.getMessage()) } - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } @@ -680,7 +687,7 @@ public class DoCreateVfModule extends VfModuleBase { def method = getClass().getSimpleName() + '.getVfModule(' + 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def vnfId = execution.getVariable('DCVFM_vnfId') @@ -697,22 +704,22 @@ public class DoCreateVfModule extends VfModuleBase { client.addAdditionalHeader('Content-Type', MediaType.APPLICATION_XML) client.addAdditionalHeader('Accept', MediaType.APPLICATION_XML) - msoLogger.debug('sending GET to AAI endpoint \'' + endPoint + '\'') + logger.debug('sending GET to AAI endpoint \'' + endPoint + '\'') Response response = client.get() String responseData = response.readEntity(String.class) if (responseData != null) { - msoLogger.debug("Received generic VNF data: " + responseData) + logger.debug("Received generic VNF data: " + responseData) } execution.setVariable('DCVFM_queryAAIVfModuleResponseCode', response.getStatus()) execution.setVariable('DCVFM_queryAAIVfModuleResponse', responseData) - msoLogger.debug('Response code:' + response.getStatus()) - msoLogger.debug('Response:' + System.lineSeparator() + responseData) + logger.debug('Response code:' + response.getStatus()) + logger.debug('Response:' + System.lineSeparator() + responseData) if (response.getStatus() == 200) { // Parse the VNF record from A&AI to find base module info - msoLogger.debug('Parsing the VNF data to find base module info') + logger.debug('Parsing the VNF data to find base module info') if (responseData != null) { def vfModulesText = utils.getNodeXml(responseData, "vf-modules") def xmlVfModules= new XmlSlurper().parseText(vfModulesText) @@ -725,24 +732,26 @@ public class DoCreateVfModule extends VfModuleBase { if (isBaseVfModule == "true") { String baseModuleId = utils.getNodeText(vfModuleXml, "vf-module-id") execution.setVariable("DCVFM_baseVfModuleId", baseModuleId) - msoLogger.debug('Received baseVfModuleId: ' + baseModuleId) + logger.debug('Received baseVfModuleId: ' + baseModuleId) String baseModuleHeatStackId = utils.getNodeText(vfModuleXml, "heat-stack-id") execution.setVariable("DCVFM_baseVfModuleHeatStackId", baseModuleHeatStackId) - msoLogger.debug('Received baseVfModuleHeatStackId: ' + baseModuleHeatStackId) + logger.debug('Received baseVfModuleHeatStackId: ' + baseModuleHeatStackId) } } } } } catch (Exception ex) { ex.printStackTrace() - msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) } - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) } } @@ -761,7 +770,7 @@ public class DoCreateVfModule extends VfModuleBase { def method = getClass().getSimpleName() + '.queryAAIVfModuleForStatus(' + 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable('DCVFM_orchestrationStatus', '') @@ -782,24 +791,24 @@ public class DoCreateVfModule extends VfModuleBase { try { def responseData = '' - msoLogger.debug('sending GET to AAI endpoint \'' + endPoint + '\'') + logger.debug('sending GET to AAI endpoint \'' + endPoint + '\'') Response response = client.get() - msoLogger.debug("createVfModule - invoking httpGet() to AAI") + logger.debug("createVfModule - invoking httpGet() to AAI") responseData = response.readEntity(String.class) if (responseData != null) { - msoLogger.debug("Received generic VNF data: " + responseData) + logger.debug("Received generic VNF data: " + responseData) } execution.setVariable('DCVFM_queryAAIVfModuleForStatusResponseCode', response.getStatus()) execution.setVariable('DCVFM_queryAAIVfModuleForStatusResponse', responseData) - msoLogger.debug('Response code:' + response.getStatus()) - msoLogger.debug('Response:' + System.lineSeparator() + responseData) + logger.debug('Response code:' + response.getStatus()) + logger.debug('Response:' + System.lineSeparator() + responseData) // Retrieve VF Module info and its orchestration status; if not found, do nothing if (response.getStatus() == 200) { // Parse the VNF record from A&AI to find base module info - msoLogger.debug('Parsing the VNF data to find orchestration status') + logger.debug('Parsing the VNF data to find orchestration status') if (responseData != null) { def vfModuleText = utils.getNodeXml(responseData, "vf-module") //def xmlVfModule= new XmlSlurper().parseText(vfModuleText) @@ -808,20 +817,22 @@ public class DoCreateVfModule extends VfModuleBase { // Also retrieve vfModuleId def vfModuleId = utils.getNodeText(vfModuleText, "vf-module-id") execution.setVariable("DCVFM_vfModuleId", vfModuleId) - msoLogger.debug("Received orchestration status from A&AI: " + orchestrationStatus) + logger.debug("Received orchestration status from A&AI: " + orchestrationStatus) } } } catch (Exception ex) { ex.printStackTrace() - msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) } - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage()) } } @@ -830,11 +841,11 @@ public class DoCreateVfModule extends VfModuleBase { public void preProcessSDNCAssignRequest(DelegateExecution execution){ execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED preProcessSDNCAssignRequest") + logger.trace("STARTED preProcessSDNCAssignRequest") def vnfId = execution.getVariable("DCVFM_vnfId") def vfModuleId = execution.getVariable("DCVFM_vfModuleId") def serviceInstanceId = execution.getVariable("DCVFM_serviceInstanceId") - msoLogger.debug("NEW VNF ID: " + vnfId) + logger.debug("NEW VNF ID: " + vnfId) try{ @@ -852,20 +863,22 @@ public class DoCreateVfModule extends VfModuleBase { assignSDNCRequest = utils.formatXml(assignSDNCRequest) execution.setVariable("DCVFM_assignSDNCRequest", assignSDNCRequest) - msoLogger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest) + logger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preProcessSDNCAssignRequest") + logger.trace("COMPLETED preProcessSDNCAssignRequest") } public void preProcessSDNCGetRequest(DelegateExecution execution, String element){ String sdncVersion = execution.getVariable("DCVFM_sdncVersion") execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED preProcessSDNCGetRequest Process") + logger.trace("STARTED preProcessSDNCGetRequest Process") try{ def serviceInstanceId = execution.getVariable('DCVFM_serviceInstanceId') @@ -875,7 +888,7 @@ public class DoCreateVfModule extends VfModuleBase { } def callbackUrl = execution.getVariable("DCVFM_sdncCallbackUrl") - msoLogger.debug("callbackUrl:" + callbackUrl) + logger.debug("callbackUrl:" + callbackUrl) def vfModuleId = execution.getVariable('DCVFM_vfModuleId') @@ -907,21 +920,21 @@ public class DoCreateVfModule extends VfModuleBase { Optional<GenericVnf> vnf = wrapper.asBean(GenericVnf.class) serviceOperation = vnf.get().getSelflink() - msoLogger.debug("VNF - service operation: " + serviceOperation) + logger.debug("VNF - service operation: " + serviceOperation) } else if (element.equals("vfmodule")) { String response = execution.getVariable("DCVFM_assignSDNCAdapterResponse") - msoLogger.debug("DCVFM_assignSDNCAdapterResponse is: \n" + response) + logger.debug("DCVFM_assignSDNCAdapterResponse is: \n" + response) if (!sdncVersion.equals("1707")) { serviceOperation = "/VNF-API:vnfs/vnf-list/" + vfModuleId - msoLogger.debug("VF Module with sdncVersion before 1707 - service operation: " + serviceOperation) + logger.debug("VF Module with sdncVersion before 1707 - service operation: " + serviceOperation) } else { String data = utils.getNodeXml(response, "response-data") - msoLogger.debug("responseData: " + data) + logger.debug("responseData: " + data) serviceOperation = utils.getNodeText(data, "object-path") - msoLogger.debug("VF Module with sdncVersion of 1707 - service operation: " + serviceOperation) + logger.debug("VF Module with sdncVersion of 1707 - service operation: " + serviceOperation) } } @@ -944,13 +957,15 @@ public class DoCreateVfModule extends VfModuleBase { </sdncadapterworkflow:SDNCAdapterWorkflowRequest>""" execution.setVariable("DCVFM_getSDNCRequest", SDNCGetRequest) - msoLogger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest) + logger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occurred Processing preProcessSDNCGetRequest", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preProcessSDNCGetRequest Process") + logger.trace("COMPLETED preProcessSDNCGetRequest Process") } @@ -959,10 +974,10 @@ public class DoCreateVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) //def xml = execution.getVariable("DoCreateVfModuleRequest") - //msoLogger.debug('VNF REQUEST is: ' + xml) + //logger.debug('VNF REQUEST is: ' + xml) //Get variables //cloudSiteId @@ -1007,8 +1022,8 @@ public class DoCreateVfModule extends VfModuleBase { String environmentContext = execution.getVariable("DCVFM_environmentContext") //workloadContext String workloadContext = execution.getVariable("DCVFM_workloadContext") - msoLogger.debug("workloadContext: " + workloadContext) - msoLogger.debug("environmentContext: " + environmentContext) + logger.debug("workloadContext: " + workloadContext) + logger.debug("environmentContext: " + environmentContext) def messageId = execution.getVariable('mso-request-id') + '-' + System.currentTimeMillis() @@ -1016,8 +1031,8 @@ public class DoCreateVfModule extends VfModuleBase { def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution) - msoLogger.debug("notificationUrl: " + notificationUrl) - msoLogger.debug("QualifiedHostName: " + useQualifiedHostName) + logger.debug("notificationUrl: " + notificationUrl) + logger.debug("QualifiedHostName: " + useQualifiedHostName) if ('true'.equals(useQualifiedHostName)) { notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) @@ -1027,7 +1042,7 @@ public class DoCreateVfModule extends VfModuleBase { String vfModuleParams = "" //Get SDNC Response Data for VF Module Topology String vfModuleSdncGetResponse = execution.getVariable('DCVFM_getSDNCAdapterResponse') - msoLogger.debug("sdncGetResponse: " + vfModuleSdncGetResponse) + logger.debug("sdncGetResponse: " + vfModuleSdncGetResponse) def sdncVersion = execution.getVariable("sdncVersion") if (!sdncVersion.equals("1707")) { @@ -1038,7 +1053,7 @@ public class DoCreateVfModule extends VfModuleBase { else { //Get SDNC Response Data for Vnf Topology String vnfSdncGetResponse = execution.getVariable('DCVFM_getVnfSDNCAdapterResponse') - msoLogger.debug("vnfSdncGetResponse: " + vnfSdncGetResponse) + logger.debug("vnfSdncGetResponse: " + vnfSdncGetResponse) vfModuleParams = buildVfModuleParamsFromCombinedTopologies(vnfParamsMap, vnfSdncGetResponse, vfModuleSdncGetResponse, vnfId, vnfName, vfModuleId, vfModuleName, vfModuleIndex, environmentContext, workloadContext) @@ -1083,7 +1098,7 @@ public class DoCreateVfModule extends VfModuleBase { <notificationUrl>${MsoUtils.xmlEscape(notificationUrl)}</notificationUrl> </createVfModuleRequest>""" - msoLogger.debug("Create VfModule Request to VNF Adapter: " + createVnfARequest) + logger.debug("Create VfModule Request to VNF Adapter: " + createVnfARequest) execution.setVariable("DCVFM_createVnfARequest", createVnfARequest) } @@ -1099,7 +1114,7 @@ public class DoCreateVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) String processKey = getProcessKey(execution); def prefix = execution.getVariable("prefix") @@ -1126,7 +1141,7 @@ public class DoCreateVfModule extends VfModuleBase { if (request == null) { exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request is null") } - msoLogger.debug("DoCreateVfModule Request: " + request) + logger.debug("DoCreateVfModule Request: " + request) /* @@ -1144,13 +1159,15 @@ public class DoCreateVfModule extends VfModuleBase { utils.logContext(requestId, serviceInstanceId) */ - msoLogger.debug('Incoming message: ' + System.lineSeparator() + request) - msoLogger.trace('Exited ' + method) + logger.debug('Incoming message: ' + System.lineSeparator() + request) + logger.trace('Exited ' + method) return request } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message") } } @@ -1161,16 +1178,16 @@ public class DoCreateVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) def request = execution.getVariable('DoCreateVfModuleRequest') String volumeGroupId = utils.getNodeText(request, "volume-group-id") if (volumeGroupId == null || volumeGroupId.isEmpty()) { - msoLogger.debug('No volume group id is present') + logger.debug('No volume group id is present') return false } else { - msoLogger.debug('Volume group id is present') + logger.debug('Volume group id is present') return true } @@ -1182,16 +1199,16 @@ public class DoCreateVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) def request = execution.getVariable('DoCreateVfModuleRequest') String volumeGroupName = utils.getNodeText(request, "volume-group-name") if (volumeGroupName == null || volumeGroupName.isEmpty()) { - msoLogger.debug('No volume group name is present') + logger.debug('No volume group name is present') return false } else { - msoLogger.debug('Volume group name is present') + logger.debug('Volume group name is present') return true } @@ -1386,7 +1403,7 @@ public class DoCreateVfModule extends VfModuleBase { } - msoLogger.debug("sdncRequest: " + sdncRequest) + logger.debug("sdncRequest: " + sdncRequest) return sdncRequest } @@ -1396,9 +1413,9 @@ public class DoCreateVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED preProcessSDNCActivateRequest Process") + logger.trace("STARTED preProcessSDNCActivateRequest Process") try{ String vnfId = execution.getVariable("DCVFM_vnfId") String vfModuleId = execution.getVariable("DCVFM_vfModuleId") @@ -1414,13 +1431,13 @@ public class DoCreateVfModule extends VfModuleBase { String activateSDNCRequest = buildSDNCRequest(execution, svcInstId, "activate") execution.setVariable("DCVFM_activateSDNCRequest", activateSDNCRequest) - msoLogger.debug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest) + logger.debug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest) }catch(Exception e){ - msoLogger.debug("Exception Occured Processing preProcessSDNCActivateRequest. Exception is:\n" + e) + logger.debug("Exception Occured Processing preProcessSDNCActivateRequest. Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preProcessSDNCActivateRequest Process") + logger.trace("COMPLETED preProcessSDNCActivateRequest Process") } public void postProcessVNFAdapterRequest(DelegateExecution execution) { @@ -1428,23 +1445,23 @@ public class DoCreateVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable("prefix",Prefix) try{ - msoLogger.debug("STARTED postProcessVNFAdapterRequest Process") + logger.debug("STARTED postProcessVNFAdapterRequest Process") String vnfResponse = execution.getVariable("DCVFM_createVnfAResponse") - msoLogger.debug("VNF Adapter Response is: " + vnfResponse) + logger.debug("VNF Adapter Response is: " + vnfResponse) RollbackData rollbackData = execution.getVariable("rollbackData") if(vnfResponse != null){ if(vnfResponse.contains("createVfModuleResponse")){ - msoLogger.debug("Received a Good Response from VNF Adapter for CREATE_VF_MODULE Call.") + logger.debug("Received a Good Response from VNF Adapter for CREATE_VF_MODULE Call.") execution.setVariable("DCVFM_vnfVfModuleCreateCompleted", true) String heatStackId = utils.getNodeText(vnfResponse, "vfModuleStackId") execution.setVariable("DCVFM_heatStackId", heatStackId) - msoLogger.debug("Received heat stack id from VNF Adapter: " + heatStackId) + logger.debug("Received heat stack id from VNF Adapter: " + heatStackId) rollbackData.put("VFMODULE", "heatstackid", heatStackId) // Parse vnfOutputs for network_fqdn if (vnfResponse.contains("vfModuleOutputs")) { @@ -1464,22 +1481,22 @@ public class DoCreateVfModule extends VfModuleBase { String key = element.getElementsByTagNameNS("*", "key").item(0).getTextContent() if (key.equals("contrail-service-instance-fqdn")) { String contrailServiceInstanceFqdn = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() - msoLogger.debug("Obtained contrailServiceInstanceFqdn: " + contrailServiceInstanceFqdn) + logger.debug("Obtained contrailServiceInstanceFqdn: " + contrailServiceInstanceFqdn) execution.setVariable("DCVFM_contrailServiceInstanceFqdn", contrailServiceInstanceFqdn) } else if (key.endsWith("contrail_network_policy_fqdn")) { String contrailNetworkPolicyFqdn = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() - msoLogger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn) + logger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn) contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn) } else if (key.equals("oam_management_v4_address")) { String oamManagementV4Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() - msoLogger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address) + logger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address) execution.setVariable("DCVFM_oamManagementV4Address", oamManagementV4Address) } else if (key.equals("oam_management_v6_address")) { String oamManagementV6Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() - msoLogger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address) + logger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address) execution.setVariable("DCVFM_oamManagementV6Address", oamManagementV6Address) } @@ -1490,11 +1507,11 @@ public class DoCreateVfModule extends VfModuleBase { } } }else{ - msoLogger.debug("Received a BAD Response from VNF Adapter for CREATE_VF_MODULE Call.") + logger.debug("Received a BAD Response from VNF Adapter for CREATE_VF_MODULE Call.") exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error") } }else{ - msoLogger.debug("Response from VNF Adapter is Null for CREATE_VF_MODULE Call.") + logger.debug("Response from VNF Adapter is Null for CREATE_VF_MODULE Call.") exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Empty response from VNF Adapter") } @@ -1504,10 +1521,10 @@ public class DoCreateVfModule extends VfModuleBase { }catch(BpmnError b){ throw b }catch(Exception e){ - msoLogger.debug("Internal Error Occured in PostProcess Method") + logger.debug("Internal Error Occured in PostProcess Method") exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Internal Error Occured in PostProcess Method") } - msoLogger.trace("COMPLETED postProcessVnfAdapterResponse Process") + logger.trace("COMPLETED postProcessVnfAdapterResponse Process") } @@ -1516,9 +1533,9 @@ public class DoCreateVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED preProcessUpdateAAIVfModuleRequestOrch") + logger.trace("STARTED preProcessUpdateAAIVfModuleRequestOrch") try{ @@ -1535,13 +1552,15 @@ public class DoCreateVfModule extends VfModuleBase { updateAAIVfModuleRequest = utils.formatXml(updateAAIVfModuleRequest) execution.setVariable("DCVFM_updateAAIVfModuleRequest", updateAAIVfModuleRequest) - msoLogger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest) + logger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessUpdateAAIVfModuleRequestOrch", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing preProcessUpdateAAIVfModuleRequestOrch", "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleRequestOrch Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preProcessUpdateAAIVfModuleRequestOrch") + logger.trace("COMPLETED preProcessUpdateAAIVfModuleRequestOrch") } @@ -1550,9 +1569,9 @@ public class DoCreateVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED preProcessUpdateAAIVfModuleStatus") + logger.trace("STARTED preProcessUpdateAAIVfModuleStatus") try{ @@ -1563,13 +1582,15 @@ public class DoCreateVfModule extends VfModuleBase { updateAAIVfModuleRequest = utils.formatXml(updateAAIVfModuleRequest) execution.setVariable("DCVFM_updateAAIVfModuleRequest", updateAAIVfModuleRequest) - msoLogger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest) + logger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessUpdateAAIVfModuleStatus", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing preProcessUpdateAAIVfModuleStatus", "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleStatus Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preProcessUpdateAAIVfModuleStatus") + logger.trace("COMPLETED preProcessUpdateAAIVfModuleStatus") } @@ -1579,9 +1600,9 @@ public class DoCreateVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED preProcessUpdateAAIVfModuleRequestGroup") + logger.trace("STARTED preProcessUpdateAAIVfModuleRequestGroup") try{ @@ -1591,32 +1612,34 @@ public class DoCreateVfModule extends VfModuleBase { updateAAIVfModuleRequest = utils.formatXml(updateAAIVfModuleRequest) execution.setVariable("DCVFM_updateAAIVfModuleRequest", updateAAIVfModuleRequest) - msoLogger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest) + logger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessUpdateAAIVfModuleRequestGroup", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing preProcessUpdateAAIVfModuleRequestGroup", "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleRequestGroup Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preProcessUpdateAAIVfModuleRequestGroup") + logger.trace("COMPLETED preProcessUpdateAAIVfModuleRequestGroup") } public void validateSDNCResponse(DelegateExecution execution, String response, String method){ execution.setVariable("prefix",Prefix) - msoLogger.debug("STARTED ValidateSDNCResponse Process") + logger.debug("STARTED ValidateSDNCResponse Process") WorkflowException workflowException = execution.getVariable("WorkflowException") boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - msoLogger.debug("workflowException: " + workflowException) + logger.debug("workflowException: " + workflowException) SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) String sdncResponse = response if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse) + logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse) RollbackData rollbackData = execution.getVariable("rollbackData") if(method.equals("assign")){ @@ -1628,19 +1651,19 @@ public class DoCreateVfModule extends VfModuleBase { } execution.setVariable("rollbackData", rollbackData) }else{ - msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") + logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") throw new BpmnError("MSOWorkflowException") } - msoLogger.trace("COMPLETED ValidateSDNCResponse Process") + logger.trace("COMPLETED ValidateSDNCResponse Process") } public void preProcessUpdateAfterCreateRequest(DelegateExecution execution){ execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED preProcessRequest Process") + logger.trace("STARTED preProcessRequest Process") try{ String response = execution.getVariable("DCVFM_assignSDNCAdapterResponse") - msoLogger.debug("DCVFM_assignSDNCAdapterResponse: " + response) + logger.debug("DCVFM_assignSDNCAdapterResponse: " + response) String data = utils.getNodeXml(response, "response-data") String vnfId = utils.getNodeText(data, "vnf-id") @@ -1652,7 +1675,7 @@ public class DoCreateVfModule extends VfModuleBase { String serviceOperation = "/VNF-API:vnfs/vnf-list/" + vnfId def callbackUrl = execution.getVariable("DCVFM_sdncCallbackUrl") - msoLogger.debug("callbackUrl: " + callbackUrl) + logger.debug("callbackUrl: " + callbackUrl) String SDNCGetRequest = """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1" @@ -1669,13 +1692,15 @@ public class DoCreateVfModule extends VfModuleBase { </sdncadapterworkflow:SDNCAdapterWorkflowRequest>""" execution.setVariable("DCVFM_getSDNCRequest", SDNCGetRequest) - msoLogger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest) + logger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessSDNCGetRequest", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing preProcessSDNCGetRequest", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preProcessSDNCGetRequest Process") + logger.trace("COMPLETED preProcessSDNCGetRequest Process") } public String buildUpdateAAIVfModuleRequest(DelegateExecution execution, boolean updateVolumeGroupId, @@ -1712,7 +1737,7 @@ public class DoCreateVfModule extends VfModuleBase { ${contrailFqdnString} </UpdateAAIVfModuleRequest>""" - msoLogger.trace("updateAAIVfModule Request: " + updateAAIVfModuleRequest) + logger.trace("updateAAIVfModule Request: " + updateAAIVfModuleRequest) return updateAAIVfModuleRequest } @@ -1761,7 +1786,7 @@ public class DoCreateVfModule extends VfModuleBase { public void queryCloudRegion (DelegateExecution execution) { execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED queryCloudRegion") + logger.trace("STARTED queryCloudRegion") try { String cloudRegion = execution.getVariable("DCVFM_cloudSiteId") @@ -1785,19 +1810,23 @@ public class DoCreateVfModule extends VfModuleBase { execution.setVariable("DCVFM_isCloudRegionGood", true) } else { String errorMessage = "AAI Query Cloud Region Unsuccessful. AAI Response Code: " + execution.getVariable("DCVFM_queryCloudRegionReturnCode") - msoLogger.debug(errorMessage) + logger.debug(errorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) execution.setVariable("DCVFM_isCloudRegionGood", false) } - msoLogger.debug(" is Cloud Region Good: " + execution.getVariable("DCVFM_isCloudRegionGood")) + logger.debug(" is Cloud Region Good: " + execution.getVariable("DCVFM_isCloudRegionGood")) } catch(BpmnError b){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + b.getMessage()); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + b.getMessage()); throw b }catch (Exception ex) { // try error String errorMessage = "Bpmn error encountered in CreateVfModule flow. Unexpected Response from AAI - " + ex.getMessage() - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "AAI Query Cloud Region Failed "+errorMessage, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "AAI Query Cloud Region Failed " + errorMessage, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during queryCloudRegion method") } } @@ -1812,17 +1841,17 @@ public class DoCreateVfModule extends VfModuleBase { execution.setVariable("prefix",Prefix) try{ - msoLogger.debug("Caught a BPMN Exception") - msoLogger.debug("Started processBPMNException Method") - msoLogger.debug("Variables List: " + execution.getVariables()) + logger.debug("Caught a BPMN Exception") + logger.debug("Started processBPMNException Method") + logger.debug("Variables List: " + execution.getVariables()) if(execution.getVariable("WorkflowException") == null){ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during DoCreateVfModule Sub Process") } }catch(Exception e){ - msoLogger.debug("Caught Exception during processBPMNException Method: " + e) + logger.debug("Caught Exception during processBPMNException Method: " + e) } - msoLogger.debug("Completed processBPMNException Method") + logger.debug("Completed processBPMNException Method") } public void prepareCreateAAIVfModuleVolumeGroupRequest(DelegateExecution execution) { @@ -1830,9 +1859,9 @@ public class DoCreateVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED prepareCreateAAIVfModuleVolumeGroupRequest") + logger.trace("STARTED prepareCreateAAIVfModuleVolumeGroupRequest") try{ @@ -1855,13 +1884,15 @@ public class DoCreateVfModule extends VfModuleBase { createAAIVfModuleVolumeGroupRequest = utils.formatXml(createAAIVfModuleVolumeGroupRequest) execution.setVariable("DCVFM_createAAIVfModuleVolumeGroupRequest", createAAIVfModuleVolumeGroupRequest) - msoLogger.debug("Outgoing CreateAAIVfModuleVolumeGroupRequest is: \n" + createAAIVfModuleVolumeGroupRequest) + logger.debug("Outgoing CreateAAIVfModuleVolumeGroupRequest is: \n" + createAAIVfModuleVolumeGroupRequest) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Exception Occured Processing prepareCreateAAIVfModuleVolumeGroupRequest', "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Exception Occured Processing prepareCreateAAIVfModuleVolumeGroupRequest', "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareCreateAAIVfModuleVolumeGroupRequest Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED prepareCreateAAIVfModuleVolumeGroupRequest") + logger.trace("COMPLETED prepareCreateAAIVfModuleVolumeGroupRequest") } @@ -1870,9 +1901,9 @@ public class DoCreateVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED createNetworkPoliciesInAAI") + logger.trace("STARTED createNetworkPoliciesInAAI") try { // get variables @@ -1881,7 +1912,7 @@ public class DoCreateVfModule extends VfModuleBase { def rollbackData = execution.getVariable("rollbackData") execution.setVariable("DCVFM_networkPolicyFqdnCount", fqdnCount) - msoLogger.debug("DCVFM_networkPolicyFqdnCount - " + fqdnCount) + logger.debug("DCVFM_networkPolicyFqdnCount - " + fqdnCount) AaiUtil aaiUriUtil = new AaiUtil(this) @@ -1902,14 +1933,14 @@ public class DoCreateVfModule extends VfModuleBase { if (resourceClient.exists(uri)) { - msoLogger.debug(" QueryAAINetworkPolicyByFQDN Success REST Response, , NetworkPolicy #" + counting) + logger.debug(" QueryAAINetworkPolicyByFQDN Success REST Response, , NetworkPolicy #" + counting) } else { // This network policy FQDN is not in AAI yet. Add it now - msoLogger.debug("This network policy FQDN is not in AAI yet: " + fqdn) + logger.debug("This network policy FQDN is not in AAI yet: " + fqdn) // Add the network policy with this FQDN to AAI def networkPolicyId = UUID.randomUUID().toString() - msoLogger.debug("Adding network-policy with network-policy-id " + networkPolicyId) + logger.debug("Adding network-policy with network-policy-id " + networkPolicyId) NetworkPolicy policy = new NetworkPolicy() policy.setNetworkPolicyId(networkPolicyId) @@ -1928,7 +1959,7 @@ public class DoCreateVfModule extends VfModuleBase { } else { - msoLogger.debug("No contrail network policies to query/create") + logger.debug("No contrail network policies to query/create") } @@ -1936,7 +1967,7 @@ public class DoCreateVfModule extends VfModuleBase { throw e; } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in DoCreateVfModule flow. createNetworkPoliciesInAAI() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -1952,7 +1983,7 @@ public class DoCreateVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def rollbackData = execution.getVariable("rollbackData") @@ -1982,14 +2013,16 @@ public class DoCreateVfModule extends VfModuleBase { """ updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest) execution.setVariable('DCVM_updateAAIGenericVnfRequest', updateAAIGenericVnfRequest) - msoLogger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest) + logger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest) - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered in " + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Encountered in " + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) } @@ -2005,7 +2038,7 @@ public class DoCreateVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def rollbackData = execution.getVariable("rollbackData") @@ -2028,11 +2061,13 @@ public class DoCreateVfModule extends VfModuleBase { execution.setVariable("rollbackData", rollbackData) - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in postProcessUpdateAAIGenericVnf(): ' + e.getMessage()) } } @@ -2040,22 +2075,22 @@ public class DoCreateVfModule extends VfModuleBase { public void queryCatalogDB (DelegateExecution execution) { String msg = "" - msoLogger.trace("queryCatalogDB ") + logger.trace("queryCatalogDB ") try { boolean twoPhaseDesign = false // check for input String vfModuleModelName = execution.getVariable("DCVFM_vfModuleModelName") - msoLogger.debug("vfModuleModelName: " + vfModuleModelName) + logger.debug("vfModuleModelName: " + vfModuleModelName) def vnfModelInfo = execution.getVariable("vnfModelInfo") def vnfModelCustomizationUuid = jsonUtil.getJsonValue(vnfModelInfo, "modelCustomizationUuid") - msoLogger.debug("vnfModelCustomizationUuid: " + vnfModelCustomizationUuid) + logger.debug("vnfModelCustomizationUuid: " + vnfModelCustomizationUuid) JSONArray vnfs = catalogDbUtils.getAllVnfsByVnfModelCustomizationUuid(execution, vnfModelCustomizationUuid, "v2") - msoLogger.debug("Incoming Query Catalog DB for Vnf Response is: " + vnfModelCustomizationUuid) + logger.debug("Incoming Query Catalog DB for Vnf Response is: " + vnfModelCustomizationUuid) // Only one match here if (vnfs != null) { JSONObject vnfObject = vnfs.get(0) @@ -2068,7 +2103,7 @@ public class DoCreateVfModule extends VfModuleBase { // Get multiStageDesign flag String multiStageDesignValue = vnf.getMultiStageDesign() - msoLogger.debug("multiStageDesign value from Catalog DB is: " + multiStageDesignValue) + logger.debug("multiStageDesign value from Catalog DB is: " + multiStageDesignValue) if (multiStageDesignValue != null) { if (multiStageDesignValue.equalsIgnoreCase("true")) { twoPhaseDesign = true @@ -2077,13 +2112,15 @@ public class DoCreateVfModule extends VfModuleBase { } } - msoLogger.debug("setting twoPhaseDesign flag to: " + twoPhaseDesign) + logger.debug("setting twoPhaseDesign flag to: " + twoPhaseDesign) execution.setVariable("DCVFM_twoPhaseDesign", twoPhaseDesign) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in queryCatalogDB', "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in queryCatalogDB', "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryCatalogDB(): ' + e.getMessage()) } } @@ -2091,44 +2128,44 @@ public class DoCreateVfModule extends VfModuleBase { public void preProcessRollback (DelegateExecution execution) { - msoLogger.trace("preProcessRollback") + logger.trace("preProcessRollback") try { Object workflowException = execution.getVariable("WorkflowException"); if (workflowException instanceof WorkflowException) { - msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage()) + logger.debug("Prev workflowException: " + workflowException.getErrorMessage()) execution.setVariable("prevWorkflowException", workflowException); //execution.setVariable("WorkflowException", null); } } catch (BpmnError e) { - msoLogger.debug("BPMN Error during preProcessRollback") + logger.debug("BPMN Error during preProcessRollback") } catch(Exception ex) { String msg = "Exception in preProcessRollback. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } - msoLogger.trace("Exit preProcessRollback") + logger.trace("Exit preProcessRollback") } public void postProcessRollback (DelegateExecution execution) { - msoLogger.trace("postProcessRollback") + logger.trace("postProcessRollback") String msg = "" try { Object workflowException = execution.getVariable("prevWorkflowException"); if (workflowException instanceof WorkflowException) { - msoLogger.debug("Setting prevException to WorkflowException: ") + logger.debug("Setting prevException to WorkflowException: ") execution.setVariable("WorkflowException", workflowException); } execution.setVariable("rollbackData", null) } catch (BpmnError b) { - msoLogger.debug("BPMN Error during postProcessRollback") + logger.debug("BPMN Error during postProcessRollback") throw b; } catch(Exception ex) { msg = "Exception in postProcessRollback. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } - msoLogger.trace("Exit postProcessRollback") + logger.trace("Exit postProcessRollback") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy index 55a84575f4..d9989606e0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy @@ -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 @@ -36,6 +38,8 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils @@ -43,7 +47,7 @@ import javax.ws.rs.NotFoundException public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVfModuleRollback.class); + private static final Logger logger = LoggerFactory.getLogger( DoCreateVfModuleRollback.class); def Prefix="DCVFMR_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -65,7 +69,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ execution.setVariable("rollbackError", null) def rollbackData = execution.getVariable("rollbackData") - msoLogger.debug("RollbackData:" + rollbackData) + logger.debug("RollbackData:" + rollbackData) if (rollbackData != null) { String vnfId = rollbackData.get("VFMODULE", "vnfid") @@ -104,7 +108,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ break } createdNetworkPolicyFqdnList.add(fqdn) - msoLogger.debug("got fqdn # " + i + ": " + fqdn) + logger.debug("got fqdn # " + i + ": " + fqdn) i = i + 1 } @@ -131,7 +135,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ <vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id> <orchestration-status>pending-delete</orchestration-status> </PrepareUpdateAAIVfModuleRequest>""" as String - msoLogger.debug("PrepareUpdateAAIVfModuleRequest :" + request) + logger.debug("PrepareUpdateAAIVfModuleRequest :" + request) execution.setVariable("PrepareUpdateAAIVfModuleRequest", request) } else { execution.setVariable("skipRollback", true) @@ -145,7 +149,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ throw e; } catch (Exception ex){ def msg = "Exception in DoCreateVfModuleRollback preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } @@ -238,14 +242,14 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ </sdncadapterworkflow:SDNCRequestData> </sdncadapterworkflow:SDNCAdapterWorkflowRequest>""" - msoLogger.debug("sdncAdapterWorkflowRequest: " + request) + logger.debug("sdncAdapterWorkflowRequest: " + request) execution.setVariable("sdncAdapterWorkflowRequest", request) } public void preProcessSDNCDeactivateRequest(DelegateExecution execution){ execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED preProcessSDNCDeactivateRequest") + logger.trace("STARTED preProcessSDNCDeactivateRequest") def serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId") @@ -256,13 +260,15 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest) execution.setVariable("DCVFMR_deactivateSDNCRequest", deactivateSDNCRequest) - msoLogger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) + logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessSDNCDeactivateRequest.", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing preProcessSDNCDeactivateRequest.", "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preProcessSDNCDeactivateRequest") + logger.trace("COMPLETED preProcessSDNCDeactivateRequest") } public void preProcessSDNCUnassignRequest(DelegateExecution execution) { @@ -270,22 +276,22 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ 'execution=' + execution.getId() + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED preProcessSDNCUnassignRequest Process") + logger.trace("STARTED preProcessSDNCUnassignRequest Process") try{ String serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId") String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign") execution.setVariable("DCVFMR_unassignSDNCRequest", unassignSDNCRequest) - msoLogger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest) + logger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest) }catch(Exception e){ - msoLogger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e) + logger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preProcessSDNCUnassignRequest Process") + logger.trace("COMPLETED preProcessSDNCUnassignRequest Process") } public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ @@ -342,7 +348,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ </sdncadapterworkflow:SDNCRequestData> </sdncadapterworkflow:SDNCAdapterWorkflowRequest>""" - msoLogger.debug("sdncRequest: " + sdncRequest) + logger.debug("sdncRequest: " + sdncRequest) return sdncRequest } @@ -383,7 +389,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ </deleteVfModuleRequest> """ as String - msoLogger.debug("vnfAdapterRestV1Request: " + request) + logger.debug("vnfAdapterRestV1Request: " + request) execution.setVariable("vnfAdapterRestV1Request", request) } @@ -400,7 +406,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ <heat-stack-id>DELETE</heat-stack-id> <orchestration-status>deleted</orchestration-status> </UpdateAAIVfModuleRequest>""" as String - msoLogger.debug("UpdateAAIVfModuleRequest :" + request) + logger.debug("UpdateAAIVfModuleRequest :" + request) execution.setVariable("UpdateAAIVfModuleRequest", request) } @@ -417,7 +423,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ <heat-stack-id></heat-stack-id> <orchestration-status>Assigned</orchestration-status> </UpdateAAIVfModuleRequest>""" as String - msoLogger.debug("UpdateAAIVfModuleRequest :" + request) + logger.debug("UpdateAAIVfModuleRequest :" + request) execution.setVariable("UpdateAAIVfModuleRequest", request) } @@ -432,7 +438,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ <vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id> <vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id> </DeleteAAIVfModuleRequest>""" as String - msoLogger.debug("DeleteAAIVfModuleRequest :" + request) + logger.debug("DeleteAAIVfModuleRequest :" + request) execution.setVariable("DeleteAAIVfModuleRequest", request) } @@ -440,7 +446,9 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ // - public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "AAI error occurred deleting the Generic Vnf"+ execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "AAI error occurred deleting the Generic Vnf" + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), + "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue()); String processKey = getProcessKey(execution); exceptionUtil.buildWorkflowException(execution, 5000, "Failure in DoDeleteVfModule") @@ -457,7 +465,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - msoLogger.debug("Successfully Validated SDNC Response") + logger.debug("Successfully Validated SDNC Response") }else{ throw new BpmnError("MSOWorkflowException") } @@ -468,21 +476,21 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ 'execution=' + execution.getId() + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED deleteNetworkPoliciesFromAAI") + logger.trace("STARTED deleteNetworkPoliciesFromAAI") try { // get variables List fqdnList = execution.getVariable(Prefix + "createdNetworkPolicyFqdnList") if (fqdnList == null) { - msoLogger.debug("No network policies to delete") + logger.debug("No network policies to delete") return } int fqdnCount = fqdnList.size() execution.setVariable(Prefix + "networkPolicyFqdnCount", fqdnCount) - msoLogger.debug("networkPolicyFqdnCount - " + fqdnCount) + logger.debug("networkPolicyFqdnCount - " + fqdnCount) AaiUtil aaiUriUtil = new AaiUtil(this) @@ -507,24 +515,24 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicy.getNetworkPolicyId()) getAAIClient().delete(delUri) execution.setVariable(Prefix + "aaiDeleteNetworkPolicyReturnCode", 200) - msoLogger.debug("AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + 200) - msoLogger.debug("The return code from deleting network policy is: " + 200) + logger.debug("AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + 200) + logger.debug("The return code from deleting network policy is: " + 200) // This network policy was deleted from AAI successfully - msoLogger.debug(" DelAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : ") + logger.debug(" DelAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : ") }catch(NotFoundException ne){ // This network policy FQDN is not in AAI. No need to delete. execution.setVariable(Prefix + "aaiDeleteNetworkPolicyReturnCode", 404) - msoLogger.debug("The return code is: " + 404) - msoLogger.debug("This network policy FQDN is not in AAI: " + fqdn) + logger.debug("The return code is: " + 404) + logger.debug("This network policy FQDN is not in AAI: " + fqdn) }catch(Exception e){ // aai all errors String delErrorMessage = "Unable to delete network-policy to AAI deleteNetworkPoliciesFromAAI - " + e.getMessage() - msoLogger.debug(delErrorMessage) + logger.debug(delErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, delErrorMessage) } } else { // This network policy FQDN is not in AAI. No need to delete. - msoLogger.debug("This network policy FQDN is not in AAI: " + fqdn) + logger.debug("This network policy FQDN is not in AAI: " + fqdn) } }catch (BpmnError e){ throw e @@ -532,14 +540,14 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ catch (Exception e) { // aai all errors String dataErrorMessage = "Unexpected Response from deleteNetworkPoliciesFromAAI - " + e.getMessage() - msoLogger.debug(dataErrorMessage) + logger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } } // end loop } else { - msoLogger.debug("No contrail network policies to query/create") + logger.debug("No contrail network policies to query/create") } @@ -548,7 +556,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in DoCreateVfModuleRollback flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -565,7 +573,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ 'execution=' + execution.getId() + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def vnfId = execution.getVariable('DCVFMR_vnfId') @@ -592,14 +600,16 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ """ updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest) execution.setVariable(Prefix + 'updateAAIGenericVnfRequest', updateAAIGenericVnfRequest) - msoLogger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest) + logger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest) - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessUpdateAAIGenericVnf((): ' + e.getMessage()) } } @@ -607,7 +617,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ public void setSuccessfulRollbackStatus (DelegateExecution execution){ execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED setSuccessfulRollbackStatus") + logger.trace("STARTED setSuccessfulRollbackStatus") try{ // Set rolledBack to true, rollbackError to null @@ -615,16 +625,18 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ execution.setVariable("rollbackError", null) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing setSuccessfulRollbackStatus.", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing setSuccessfulRollbackStatus.", "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED setSuccessfulRollbackStatus") + logger.trace("COMPLETED setSuccessfulRollbackStatus") } public void setFailedRollbackStatus (DelegateExecution execution){ execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED setFailedRollbackStatus") + logger.trace("STARTED setFailedRollbackStatus") try{ // Set rolledBack to false, rollbackError to actual value, rollbackData to null @@ -633,9 +645,11 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ execution.setVariable("rollbackData", null) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing setFailedRollbackStatus.", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing setFailedRollbackStatus.", "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setFailedRollbackStatus Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED setFailedRollbackStatus") + logger.trace("COMPLETED setFailedRollbackStatus") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy index f61d2b98e3..a233a0a02e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy @@ -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,12 +35,13 @@ import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import javax.ws.rs.NotFoundException public class DoCreateVfModuleVolumeRollback extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVfModuleVolumeRollback.class); + private static final Logger logger = LoggerFactory.getLogger( DoCreateVfModuleVolumeRollback.class); String Prefix="DCVFMODVOLRBK_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -171,18 +174,18 @@ public class DoCreateVfModuleVolumeRollback extends AbstractServiceTaskProcessor execution.setVariable("prefix",Prefix) try{ - msoLogger.debug("Caught a Java Exception in " + Prefix) - msoLogger.debug("Started processJavaException Method") - msoLogger.debug("Variables List: " + execution.getVariables()) + logger.debug("Caught a Java Exception in " + Prefix) + logger.debug("Started processJavaException Method") + logger.debug("Variables List: " + execution.getVariables()) execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") }catch(Exception e){ - msoLogger.debug("Caught Exception during processJavaException Method: " + e) + logger.debug("Caught Exception during processJavaException Method: " + e) execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix) } - msoLogger.debug("Completed processJavaException Method in " + Prefix) + logger.debug("Completed processJavaException Method in " + Prefix) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy index 87f598db5d..b2006c45d7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy @@ -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 @@ -40,13 +42,14 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults import org.onap.so.db.catalog.beans.OrchestrationStatus -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import javax.ws.rs.NotFoundException class DoCreateVfModuleVolumeV2 extends VfModuleBase { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVfModuleVolumeV2.class) + private static final Logger logger = LoggerFactory.getLogger( DoCreateVfModuleVolumeV2.class); String prefix='DCVFMODVOLV2_' JsonUtils jsonUtil = new JsonUtils() private ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -94,12 +97,12 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { //modelCustomizationUuid def modelCustomizationUuid = jsonUtil.getJsonValue(vfModuleModelInfo, "modelCustomizationUuid") execution.setVariable("modelCustomizationId", modelCustomizationUuid) - msoLogger.debug("modelCustomizationId: " + modelCustomizationUuid) + logger.debug("modelCustomizationId: " + modelCustomizationUuid) //modelName def modelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName") execution.setVariable("modelName", modelName) - msoLogger.debug("modelName: " + modelName) + logger.debug("modelName: " + modelName) // The following is used on the get Generic Service Instance call execution.setVariable('GENGS_type', 'service-instance') @@ -116,11 +119,11 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { 'vnfId', 'vnfName', 'tenantId', 'volumeGroupId', 'volumeGroupName', 'lcpCloudRegionId', 'vnfType', 'vfModuleModelInfo', 'asdcServiceModelVersion', 'test-volume-group-name', 'test-volume-group-id', 'vfModuleInputParams'] - msoLogger.debug('Begin input: ') + logger.debug('Begin input: ') input.each { - msoLogger.debug(it + ': ' + execution.getVariable(it)) + logger.debug(it + ': ' + execution.getVariable(it)) } - msoLogger.debug('End input.') + logger.debug('End input.') } @@ -158,7 +161,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { throw e }catch (Exception ex){ String msg = "Exception in getServiceInstance. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, msg) } } @@ -171,7 +174,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { public void callRESTQueryAAICloudRegion (DelegateExecution execution, isDebugEnabled) { def cloudRegion = execution.getVariable("lcpCloudRegionId") - msoLogger.debug('Request cloud region is: ' + cloudRegion) + logger.debug('Request cloud region is: ' + cloudRegion) AaiUtil aaiUtil = new AaiUtil(this) @@ -183,20 +186,20 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { def aaiCloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "AAI", cloudRegion) if ((aaiCloudRegion != "ERROR")) { execution.setVariable("lcpCloudRegionId", aaiCloudRegion) - msoLogger.debug("AIC Cloud Region for AAI: " + aaiCloudRegion) + logger.debug("AIC Cloud Region for AAI: " + aaiCloudRegion) } else { String errorMessage = "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable(prefix+"queryCloudRegionReturnCode") - msoLogger.debug(errorMessage) + logger.debug(errorMessage) (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, errorMessage) } def poCloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion) if ((poCloudRegion != "ERROR")) { execution.setVariable("poLcpCloudRegionId", poCloudRegion) - msoLogger.debug("AIC Cloud Region for PO: " + poCloudRegion) + logger.debug("AIC Cloud Region for PO: " + poCloudRegion) } else { String errorMessage = "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable(prefix+"queryCloudRegionReturnCode") - msoLogger.debug(errorMessage) + logger.debug(errorMessage) (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, errorMessage) } @@ -222,7 +225,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { VolumeGroup volumeGroup = volumeGroups.get().getVolumeGroup().get(0); execution.setVariable(prefix+'AaiReturnCode', 200) execution.setVariable("queriedVolumeGroupId",volumeGroup.getVolumeGroupId()) - msoLogger.debug("Volume Group Name $volumeGroupName exists in AAI.") + logger.debug("Volume Group Name $volumeGroupName exists in AAI.") }else{ execution.setVariable(prefix+'AaiReturnCode', 404) exceptionUtil.buildAndThrowWorkflowException(execution,25000, "Volume Group Name $volumeGroupName does not exist in AAI.") @@ -241,8 +244,8 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { * @param execution * @param isDebugEnabled */ - public void buildWorkflowException(DelegateExecution execution, int errorCode, errorMessage, isDebugEnabled) { - msoLogger.debug(errorMessage) + public void buildWorkflowException(DelegateExecution execution, int errorCode, errorMessage) { + logger.debug(errorMessage) (new ExceptionUtil()).buildWorkflowException(execution, 2500, errorMessage) } @@ -279,7 +282,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { def testGroupId = execution.getVariable('test-volume-group-id') if (testGroupId != null && testGroupId.trim() != '') { - msoLogger.debug("test volumeGroupId is present: " + testGroupId) + logger.debug("test volumeGroupId is present: " + testGroupId) volumeGroupId = testGroupId execution.setVariable("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-0") } @@ -291,7 +294,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { volumeGroup.setOrchestrationStatus(OrchestrationStatus.PENDING.toString()) volumeGroup.setModelCustomizationId(modelCustomizationId) - msoLogger.debug("volumeGroupId to be used: " + volumeGroupId) + logger.debug("volumeGroupId to be used: " + volumeGroupId) AAIResourceUri volumeGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwner, cloudRegion, volumeGroupId) AAIResourceUri tenantUri = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudOwner, cloudRegion, tenantId) @@ -336,14 +339,14 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { def modelCustomizationId = execution.getVariable("modelCustomizationId") // for testing - msoLogger.debug("volumeGroupId: " + volumeGroupId) + logger.debug("volumeGroupId: " + volumeGroupId) def testGroupId = execution.getVariable('test-volume-group-id') if (testGroupId != null && testGroupId.trim() != '') { - msoLogger.debug("test volumeGroupId is present: " + testGroupId) + logger.debug("test volumeGroupId is present: " + testGroupId) volumeGroupId = testGroupId execution.setVariable("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-0") } - msoLogger.debug("volumeGroupId to be used: " + volumeGroupId) + logger.debug("volumeGroupId to be used: " + volumeGroupId) // volume group parameters @@ -364,10 +367,10 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { } volumeGroupParams = sbParams.toString() - msoLogger.debug("volumeGroupParams: "+ volumeGroupParams) + logger.debug("volumeGroupParams: "+ volumeGroupParams) def backoutOnFailure = execution.getVariable(prefix+"backoutOnFailure") - msoLogger.debug("backoutOnFailure: "+ backoutOnFailure) + logger.debug("backoutOnFailure: "+ backoutOnFailure) def failIfExists = execution.getVariable("failIfExists") if(failIfExists == null) { @@ -375,14 +378,14 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { } String messageId = UUID.randomUUID() - msoLogger.debug("messageId to be used is generated: " + messageId) + logger.debug("messageId to be used is generated: " + messageId) def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution) if ('true'.equals(useQualifiedHostName)) { notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) } - msoLogger.debug("CreateVfModuleVolume - notificationUrl: "+ notificationUrl) + logger.debug("CreateVfModuleVolume - notificationUrl: "+ notificationUrl) // build request String vnfSubCreateWorkflowRequest = @@ -430,14 +433,14 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { """ String vnfSubCreateWorkflowRequestAsString = utils.formatXml(vnfSubCreateWorkflowRequest) - msoLogger.debug(vnfSubCreateWorkflowRequestAsString) - msoLogger.debug(vnfSubCreateWorkflowRequestAsString) + logger.debug(vnfSubCreateWorkflowRequestAsString) + logger.debug(vnfSubCreateWorkflowRequestAsString) execution.setVariable(prefix+"createVnfARequest", vnfSubCreateWorkflowRequestAsString) // build rollback request for use later if needed String vnfSubRollbackWorkflowRequest = buildRollbackVolumeGroupRequestXml(volumeGroupId, cloudSiteId, tenantId, requestId, serviceId, messageId, notificationUrl) - msoLogger.debug("Sub Vnf flow rollback request: vnfSubRollbackWorkflowRequest " + "\n" + vnfSubRollbackWorkflowRequest) + logger.debug("Sub Vnf flow rollback request: vnfSubRollbackWorkflowRequest " + "\n" + vnfSubRollbackWorkflowRequest) String vnfSubRollbackWorkflowRequestAsString = utils.formatXml(vnfSubRollbackWorkflowRequest) execution.setVariable(prefix+"rollbackVnfARequest", vnfSubRollbackWorkflowRequestAsString) @@ -478,13 +481,13 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { */ public void validateVnfResponse(DelegateExecution execution, isDebugEnabled) { def vnfSuccess = execution.getVariable('VNFREST_SuccessIndicator') - msoLogger.debug("vnfAdapterSuccessIndicator: "+ vnfSuccess) + logger.debug("vnfAdapterSuccessIndicator: "+ vnfSuccess) if(vnfSuccess==true) { String createVnfAResponse = execution.getVariable(prefix+"createVnfAResponse") String heatStackID = utils.getNodeText(createVnfAResponse, "volumeGroupStackId") String vnfRollbackRequest = execution.getVariable(prefix+"rollbackVnfARequest") String updatedVnfRollbackRequest = updateRollbackVolumeGroupRequestXml(vnfRollbackRequest, heatStackID) - msoLogger.debug("vnfAdapter rollback request: "+ updatedVnfRollbackRequest) + logger.debug("vnfAdapter rollback request: "+ updatedVnfRollbackRequest) RollbackData rollbackData = execution.getVariable("rollbackData") rollbackData.put("DCVFMODULEVOL", "rollbackVnfARequest", updatedVnfRollbackRequest) rollbackData.put("DCVFMODULEVOL", "isCreateVnfRollbackNeeded", "true") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy index deb0bffaf9..2c433863aa 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy @@ -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 @@ -41,6 +43,8 @@ import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.AAIResourcesClient import org.onap.so.client.aai.entities.AAIResultWrapper @@ -58,7 +62,7 @@ import org.json.JSONObject */ class DoCreateVnf extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVnf.class); + private static final Logger logger = LoggerFactory.getLogger( DoCreateVnf.class); String Prefix="DoCVNF_" ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() @@ -76,7 +80,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { public void preProcessRequest(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) - msoLogger.debug("STARTED DoCreateVnf PreProcessRequest Process") + logger.debug("STARTED DoCreateVnf PreProcessRequest Process") // DISABLE SDNC INTERACTION FOR NOW execution.setVariable("SDNCInteractionEnabled", false) @@ -97,16 +101,16 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { String requestId = execution.getVariable("msoRequestId") execution.setVariable("DoCVNF_requestId", requestId) execution.setVariable("mso-request-id", requestId) - msoLogger.debug("Incoming Request Id is: " + requestId) + logger.debug("Incoming Request Id is: " + requestId) String serviceInstanceId = execution.getVariable("serviceInstanceId") execution.setVariable("DoCVNF_serviceInstanceId", serviceInstanceId) rollbackData.put("VNF", "serviceInstanceId", serviceInstanceId) - msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + logger.debug("Incoming Service Instance Id is: " + serviceInstanceId) String vnfType = execution.getVariable("vnfType") execution.setVariable("DoCVNF_vnfType", vnfType) - msoLogger.debug("Incoming Vnf Type is: " + vnfType) + logger.debug("Incoming Vnf Type is: " + vnfType) String vnfName = execution.getVariable("vnfName") if (vnfName.equals("") || vnfName.equals("null")) { @@ -119,70 +123,70 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { } execution.setVariable("DoCVNF_vnfName", vnfName) - msoLogger.debug("Incoming Vnf Name is: " + vnfName) + logger.debug("Incoming Vnf Name is: " + vnfName) String serviceId = execution.getVariable("productFamilyId") execution.setVariable("DoCVNF_serviceId", serviceId) - msoLogger.debug("Incoming Service Id is: " + serviceId) + logger.debug("Incoming Service Id is: " + serviceId) String source = "VID" execution.setVariable("DoCVNF_source", source) rollbackData.put("VNF", "source", source) - msoLogger.debug("Incoming Source is: " + source) + logger.debug("Incoming Source is: " + source) String suppressRollback = execution.getVariable("disableRollback") execution.setVariable("DoCVNF_suppressRollback", suppressRollback) - msoLogger.debug("Incoming Suppress Rollback is: " + suppressRollback) + logger.debug("Incoming Suppress Rollback is: " + suppressRollback) String modelInvariantId = jsonUtil.getJsonValue(vnfModelInfo, "modelInvariantUuid") execution.setVariable("DoCVNF_modelInvariantId", modelInvariantId) - msoLogger.debug("Incoming Invariant Id is: " + modelInvariantId) + logger.debug("Incoming Invariant Id is: " + modelInvariantId) String modelVersionId = jsonUtil.getJsonValue(vnfModelInfo, "modelUuid") if (modelVersionId == null) { modelVersionId = "" } execution.setVariable("DoCVNF_modelVersionId", modelVersionId) - msoLogger.debug("Incoming Version Id is: " + modelVersionId) + logger.debug("Incoming Version Id is: " + modelVersionId) String modelVersion = jsonUtil.getJsonValue(vnfModelInfo, "modelVersion") execution.setVariable("DoCVNF_modelVersion", modelVersion) - msoLogger.debug("Incoming Model Version is: " + modelVersion) + logger.debug("Incoming Model Version is: " + modelVersion) String modelName = jsonUtil.getJsonValue(vnfModelInfo, "modelName") execution.setVariable("DoCVNF_modelName", modelName) - msoLogger.debug("Incoming Model Name is: " + modelName) + logger.debug("Incoming Model Name is: " + modelName) String modelCustomizationId = jsonUtil.getJsonValue(vnfModelInfo, "modelCustomizationUuid") if (modelCustomizationId == null) { modelCustomizationId = "" } execution.setVariable("DoCVNF_modelCustomizationId", modelCustomizationId) - msoLogger.debug("Incoming Model Customization Id is: " + modelCustomizationId) + logger.debug("Incoming Model Customization Id is: " + modelCustomizationId) String cloudSiteId = execution.getVariable("lcpCloudRegionId") execution.setVariable("DoCVNF_cloudSiteId", cloudSiteId) rollbackData.put("VNF", "cloudSiteId", cloudSiteId) - msoLogger.debug("Incoming Cloud Site Id is: " + cloudSiteId) + logger.debug("Incoming Cloud Site Id is: " + cloudSiteId) String tenantId = execution.getVariable("tenantId") execution.setVariable("DoCVNF_tenantId", tenantId) rollbackData.put("VNF", "tenantId", tenantId) - msoLogger.debug("Incoming Tenant Id is: " + tenantId) + logger.debug("Incoming Tenant Id is: " + tenantId) String globalSubscriberId = execution.getVariable("globalSubscriberId") if (globalSubscriberId == null) { globalSubscriberId = "" } execution.setVariable("DoCVNF_globalSubscriberId", globalSubscriberId) - msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + logger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) String sdncVersion = execution.getVariable("sdncVersion") if (sdncVersion == null) { sdncVersion = "1702" } execution.setVariable("DoCVNF_sdncVersion", sdncVersion) - msoLogger.debug("Incoming Sdnc Version is: " + sdncVersion) + logger.debug("Incoming Sdnc Version is: " + sdncVersion) //For Completion Handler & Fallout Handler String requestInfo = @@ -205,7 +209,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { vnfId = execution.getVariable("vnfId") if (isBlank(vnfId)) { vnfId = UUID.randomUUID().toString() - msoLogger.debug("Generated Vnf Id is: " + vnfId) + logger.debug("Generated Vnf Id is: " + vnfId) } } execution.setVariable("DoCVNF_vnfId", vnfId) @@ -217,30 +221,31 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } execution.setVariable("DoCVNF_sdncCallbackUrl", sdncCallbackUrl) rollbackData.put("VNF", "sdncCallbackUrl", sdncCallbackUrl) - msoLogger.debug("SDNC Callback URL is: " + sdncCallbackUrl) + logger.debug("SDNC Callback URL is: " + sdncCallbackUrl) VnfResource vnfResource = (VnfResource) execution.getVariable((String)"vnfResourceDecomposition") String nfRole = vnfResource.getNfRole() execution.setVariable("DoCVNF_nfRole", nfRole) - msoLogger.debug("NF Role is: " + nfRole) + logger.debug("NF Role is: " + nfRole) String nfNamingCode = vnfResource.getNfNamingCode() execution.setVariable("DoCVNF_nfNamingCode", nfNamingCode) - msoLogger.debug("NF Naming Code is: " + nfNamingCode) + logger.debug("NF Naming Code is: " + nfNamingCode) String nfType = vnfResource.getNfType() execution.setVariable("DoCVNF_nfType", nfType) - msoLogger.debug("NF Type is: " + nfType) + logger.debug("NF Type is: " + nfType) String nfFunction = vnfResource.getNfFunction() execution.setVariable("DoCVNF_nfFunction", nfFunction) - msoLogger.debug("NF Function is: " + nfFunction) + logger.debug("NF Function is: " + nfFunction) // Set Homing Info try { @@ -248,13 +253,13 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { if (homingInstance != null) { execution.setVariable("DoCVNF_cloudSiteId", homingInstance.getCloudRegionId()) rollbackData.put("VNF", "cloudSiteId", homingInstance.getCloudRegionId()) - msoLogger.debug("Overwriting cloudSiteId with homing cloudSiteId: " + + logger.debug("Overwriting cloudSiteId with homing cloudSiteId: " + homingInstance.getCloudRegionId()) } } catch (Exception exception) { - msoLogger.debug("Could not find homing information for service instance: " + serviceInstanceId + + logger.debug("Could not find homing information for service instance: " + serviceInstanceId + "... continuing") - msoLogger.debug("Could not find homing information for service instance error: " + exception) + logger.debug("Could not find homing information for service instance error: " + exception) } rollbackData.put("VNF", "rollbackSDNCAssign", "false") @@ -264,14 +269,14 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { execution.setVariable("rollbackData", rollbackData) }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") + logger.debug("Rethrowing MSOWorkflowException") throw b }catch(Exception e){ - msoLogger.debug(" Error Occured in DoCreateVnf PreProcessRequest method!" + e.getMessage()) + logger.debug(" Error Occured in DoCreateVnf PreProcessRequest method!" + e.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf PreProcessRequest") } - msoLogger.trace("COMPLETED DoCreateVnf PreProcessRequest Process") + logger.trace("COMPLETED DoCreateVnf PreProcessRequest Process") } /** @@ -298,7 +303,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { throw e; }catch(Exception ex) { String msg = "Exception in getServiceInstance. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } @@ -313,14 +318,14 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { public void createGenericVnf (DelegateExecution execution) { execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED DoCreateVnf CreateGenericVnf Process") + logger.trace("STARTED DoCreateVnf CreateGenericVnf Process") try { //Get Vnf Info String vnfId = getVariableEnforced(execution, "DoCVNF_vnfId") String vnfName = getVariableEnforced(execution, "DoCVNF_vnfName") if (vnfName == null) { vnfName = "sdncGenerated" - msoLogger.debug("Sending a dummy VNF name to AAI - the name will be generated by SDNC: " + vnfName) + logger.debug("Sending a dummy VNF name to AAI - the name will be generated by SDNC: " + vnfName) } String vnfType = getVariableEnforced(execution, "DoCVNF_vnfType") String serviceId = getVariableEnforced(execution, "DoCVNF_serviceId") @@ -363,17 +368,17 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { resourceClient.connect(uri, siUri) }catch(Exception ex) { - msoLogger.debug("Error Occured in DoCreateVnf CreateGenericVnf Process ", ex) + logger.debug("Error Occured in DoCreateVnf CreateGenericVnf Process ", ex) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf CreateGenericVnf Process") } - msoLogger.trace("COMPLETED DoCreateVnf CreateGenericVnf Process") + logger.trace("COMPLETED DoCreateVnf CreateGenericVnf Process") } public void postProcessCreateGenericVnf (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED DoCreateVnf PostProcessCreateGenericVnf Process") + logger.trace("STARTED DoCreateVnf PostProcessCreateGenericVnf Process") try { //Get Vnf Info String vnfId = execution.getVariable("DoCVNF_vnfId") @@ -382,20 +387,20 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { rollbackData.put("VNF", "rollbackVnfCreate", "true") execution.setVariable("rollbackData", rollbackData) }catch(Exception ex) { - msoLogger.debug("Error Occured in DoCreateVnf PostProcessCreateGenericVnf Process " + ex.getMessage()) + logger.debug("Error Occured in DoCreateVnf PostProcessCreateGenericVnf Process " + ex.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf PostProcessCreateGenericVnf Process") } - msoLogger.trace("COMPLETED DoCreateVnf PostProcessCreateGenericVnf Process") + logger.trace("COMPLETED DoCreateVnf PostProcessCreateGenericVnf Process") } public void preProcessSDNCAssignRequest(DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED preProcessSDNCAssignRequest") + logger.trace("STARTED preProcessSDNCAssignRequest") def vnfId = execution.getVariable("DoCVNF_vnfId") def serviceInstanceId = execution.getVariable("DoCVNF_serviceInstanceId") - msoLogger.debug("NEW VNF ID: " + vnfId) + logger.debug("NEW VNF ID: " + vnfId) try{ //Build SDNC Request @@ -404,13 +409,15 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { assignSDNCRequest = utils.formatXml(assignSDNCRequest) execution.setVariable("DoCVNF_assignSDNCRequest", assignSDNCRequest) - msoLogger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest) + logger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessSDNCAssignRequest" , "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e) + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing preProcessSDNCAssignRequest", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCAssignRequest Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preProcessSDNCAssignRequest") + logger.trace("COMPLETED preProcessSDNCAssignRequest") } public void preProcessSDNCActivateRequest(DelegateExecution execution) { @@ -418,9 +425,9 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED preProcessSDNCActivateRequest Process") + logger.trace("STARTED preProcessSDNCActivateRequest Process") try{ String vnfId = execution.getVariable("DoCVNF_vnfId") String serviceInstanceId = execution.getVariable("DoCVNF_serviceInstanceId") @@ -428,13 +435,13 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { String activateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "activate") execution.setVariable("DoCVNF_activateSDNCRequest", activateSDNCRequest) - msoLogger.debug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest) + logger.debug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest) }catch(Exception e){ - msoLogger.debug("Exception Occured Processing preProcessSDNCActivateRequest. Exception is:\n" + e) + logger.debug("Exception Occured Processing preProcessSDNCActivateRequest. Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preProcessSDNCActivateRequest Process") + logger.trace("COMPLETED preProcessSDNCActivateRequest Process") } public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ @@ -515,34 +522,34 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { </sdncadapterworkflow:SDNCRequestData> </sdncadapterworkflow:SDNCAdapterWorkflowRequest>""" - msoLogger.debug("sdncRequest: " + sdncRequest) + logger.debug("sdncRequest: " + sdncRequest) return sdncRequest } public void validateSDNCResponse(DelegateExecution execution, String response, String method){ def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) - msoLogger.debug("STARTED ValidateSDNCResponse Process") + logger.debug("STARTED ValidateSDNCResponse Process") WorkflowException workflowException = execution.getVariable("WorkflowException") boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - msoLogger.debug("workflowException: " + workflowException) + logger.debug("workflowException: " + workflowException) SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - msoLogger.debug("SDNCResponse: " + response) + logger.debug("SDNCResponse: " + response) String sdncResponse = response if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse) + logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse) if(method.equals("get")){ String topologyGetResponse = execution.getVariable("DoCVNF_getSDNCAdapterResponse") String data = utils.getNodeXml(topologyGetResponse, "response-data") - msoLogger.debug("topologyGetResponseData: " + data) + logger.debug("topologyGetResponseData: " + data) String vnfName = utils.getNodeText(data, "vnf-name") - msoLogger.debug("vnfName received from SDNC: " + vnfName) + logger.debug("vnfName received from SDNC: " + vnfName) execution.setVariable("vnfName", vnfName) execution.setVariable("DoCVNF_vnfName", vnfName) } @@ -557,16 +564,16 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { }else{ - msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") + logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") throw new BpmnError("MSOWorkflowException") } - msoLogger.debug("COMPLETED ValidateSDNCResponse Process") + logger.debug("COMPLETED ValidateSDNCResponse Process") } public void preProcessSDNCGetRequest(DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED preProcessSDNCGetRequest Process") + logger.trace("STARTED preProcessSDNCGetRequest Process") try{ def serviceInstanceId = execution.getVariable('DoCVNF_serviceInstanceId') @@ -576,7 +583,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { } def callbackUrl = execution.getVariable("DoCVFM_sdncCallbackUrl") - msoLogger.debug("callbackUrl:" + callbackUrl) + logger.debug("callbackUrl:" + callbackUrl) def vnfId = execution.getVariable('DCVFM_vnfId') @@ -590,14 +597,14 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { // serviceOperation will be retrieved from "object-path" element // in SDNC Assign Response for VNF String response = execution.getVariable("DoCVNF_assignSDNCAdapterResponse") - msoLogger.debug("DoCVNF_assignSDNCAdapterResponse is: \n" + response) + logger.debug("DoCVNF_assignSDNCAdapterResponse is: \n" + response) String serviceOperation = "" String data = utils.getNodeXml(response, "response-data") - msoLogger.debug("responseData: " + data) + logger.debug("responseData: " + data) serviceOperation = utils.getNodeText(data, "object-path") - msoLogger.debug("VNF with sdncVersion of 1707 or later - service operation: " + serviceOperation) + logger.debug("VNF with sdncVersion of 1707 or later - service operation: " + serviceOperation) //!!!! TEMPORARY WORKAROUND FOR SDNC REPLICATION ISSUE @@ -620,13 +627,15 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { execution.setVariable("DoCVNF_getSDNCRequest", SDNCGetRequest) - msoLogger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest) + logger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest. ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occurred Processing preProcessSDNCGetRequest. ", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preProcessSDNCGetRequest Process") + logger.trace("COMPLETED preProcessSDNCGetRequest Process") } /** @@ -639,11 +648,11 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def vnfId = execution.getVariable('DoCVNF_vnfId') - msoLogger.debug("VNF ID: " + vnfId) + logger.debug("VNF ID: " + vnfId) String updateAAIGenericVnfRequest = """ <UpdateAAIGenericVnfRequest> @@ -653,14 +662,16 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { """ updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest) execution.setVariable('DoCVNF_updateAAIGenericVnfRequest', updateAAIGenericVnfRequest) - msoLogger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest) + logger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest) - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Caught exception in " + method , "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Caught exception in " + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy index 88e7b34dcd..4730462ac6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy @@ -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,6 +41,8 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources; import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.onap.so.logger.MessageEnum import static org.apache.commons.lang3.StringUtils.*; @@ -51,7 +55,7 @@ import static org.apache.commons.lang3.StringUtils.*; */ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVnfAndModules.class); + private static final Logger logger = LoggerFactory.getLogger( DoCreateVnfAndModules.class); String Prefix="DCVAM_" ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() @@ -67,7 +71,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { public void preProcessRequest(DelegateExecution execution) { execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED DoCreateVnfAndModules PreProcessRequest Process") + logger.trace("STARTED DoCreateVnfAndModules PreProcessRequest Process") def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') setBasicDBAuthHeader(execution, isDebugLogEnabled) @@ -81,46 +85,46 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { String requestId = execution.getVariable("msoRequestId") execution.setVariable("requestId", requestId) execution.setVariable("mso-request-id", requestId) - msoLogger.debug("Incoming Request Id is: " + requestId) + logger.debug("Incoming Request Id is: " + requestId) String serviceInstanceId = execution.getVariable("serviceInstanceId") - msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + logger.debug("Incoming Service Instance Id is: " + serviceInstanceId) String vnfName = execution.getVariable("vnfName") execution.setVariable("CREVI_vnfName", vnfName) - msoLogger.debug("Incoming Vnf Name is: " + vnfName) + logger.debug("Incoming Vnf Name is: " + vnfName) String productFamilyId = execution.getVariable("productFamilyId") - msoLogger.debug("Incoming Product Family Id is: " + productFamilyId) + logger.debug("Incoming Product Family Id is: " + productFamilyId) String source = "VID" execution.setVariable("source", source) - msoLogger.debug("Incoming Source is: " + source) + logger.debug("Incoming Source is: " + source) String lcpCloudRegionId = execution.getVariable("lcpCloudRegionId") - msoLogger.debug("Incoming LCP Cloud Region Id is: " + lcpCloudRegionId) + logger.debug("Incoming LCP Cloud Region Id is: " + lcpCloudRegionId) String tenantId = execution.getVariable("tenantId") - msoLogger.debug("Incoming Tenant Id is: " + tenantId) + logger.debug("Incoming Tenant Id is: " + tenantId) String disableRollback = execution.getVariable("disableRollback") - msoLogger.debug("Incoming Disable Rollback is: " + disableRollback) + logger.debug("Incoming Disable Rollback is: " + disableRollback) String asdcServiceModelVersion = execution.getVariable("asdcServiceModelVersion") - msoLogger.debug("Incoming asdcServiceModelVersion: " + asdcServiceModelVersion) + logger.debug("Incoming asdcServiceModelVersion: " + asdcServiceModelVersion) String vnfId = execution.getVariable("testVnfId") // for junits if(isBlank(vnfId)){ vnfId = execution.getVariable("vnfId") if (isBlank(vnfId)) { vnfId = UUID.randomUUID().toString() - msoLogger.debug("Generated Vnf Id is: " + vnfId) + logger.debug("Generated Vnf Id is: " + vnfId) } } execution.setVariable("vnfId", vnfId) Map<String,String> vfModuleNames = execution.getVariable("vfModuleNames") - msoLogger.debug("Incoming vfModuleNames: " + vfModuleNames) + logger.debug("Incoming vfModuleNames: " + vfModuleNames) // Set aLaCarte to false execution.setVariable("aLaCarte", false) @@ -148,72 +152,72 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { } if (longDelayMS > 0) { - msoLogger.debug("Delaying workflow " + longDelayMS + "ms"); + logger.debug("Delaying workflow " + longDelayMS + "ms"); sleep(longDelayMS) } }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") + logger.debug("Rethrowing MSOWorkflowException") throw b }catch(Exception e){ - msoLogger.debug(" Error Occured in DoCreateVnfAndModules PreProcessRequest method!" + e.getMessage()) + logger.debug(" Error Occured in DoCreateVnfAndModules PreProcessRequest method!" + e.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf PreProcessRequest") } - msoLogger.trace("COMPLETED DoCreateVnfAndModules PreProcessRequest Process") + logger.trace("COMPLETED DoCreateVnfAndModules PreProcessRequest Process") } public void queryCatalogDB (DelegateExecution execution) { execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED DoCreateVnfAndModules QueryCatalogDB Process") + logger.trace("STARTED DoCreateVnfAndModules QueryCatalogDB Process") try { VnfResource vnf = null // if serviceDecomposition is specified, get info from serviceDecomposition ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") if (serviceDecomposition != null) { - msoLogger.debug("Getting Catalog DB data from ServiceDecomposition object: " + serviceDecomposition.toJsonString()) + logger.debug("Getting Catalog DB data from ServiceDecomposition object: " + serviceDecomposition.toJsonString()) List<VnfResource> vnfs = serviceDecomposition.getVnfResources() - msoLogger.debug("Read vnfs") + logger.debug("Read vnfs") if (vnfs == null) { - msoLogger.debug("Error - vnfs are empty in serviceDecomposition object") + logger.debug("Error - vnfs are empty in serviceDecomposition object") exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf queryCatalogDB, vnfs are empty") } vnf = vnfs[0] String serviceModelName = serviceDecomposition.getModelInfo().getModelName() vnf.constructVnfType(serviceModelName) String vnfType = vnf.getVnfType() - msoLogger.debug("Incoming Vnf Type is: " + vnfType) + logger.debug("Incoming Vnf Type is: " + vnfType) execution.setVariable("vnfType", vnfType) } else { //Get Vnf Info String vnfModelInfo = execution.getVariable("vnfModelInfo") - msoLogger.debug("vnfModelInfo: " + vnfModelInfo) + logger.debug("vnfModelInfo: " + vnfModelInfo) String vnfModelCustomizationUuid = jsonUtil.getJsonValueForKey(vnfModelInfo, "modelCustomizationUuid") if (vnfModelCustomizationUuid == null) { vnfModelCustomizationUuid = "" } - msoLogger.debug("querying Catalog DB by vnfModelCustomizationUuid: " + vnfModelCustomizationUuid) + logger.debug("querying Catalog DB by vnfModelCustomizationUuid: " + vnfModelCustomizationUuid) JSONArray vnfs = catalogDbUtils.getAllVnfsByVnfModelCustomizationUuid(execution, vnfModelCustomizationUuid, "v1") - msoLogger.debug("obtained VNF list") + logger.debug("obtained VNF list") // Only one match here JSONObject vnfObject = vnfs[0] vnf = DecomposeJsonUtil.jsonToVnfResource(vnfObject.toString()) } - msoLogger.debug("Read vnfResource") + logger.debug("Read vnfResource") if (vnf == null) { - msoLogger.debug("Error - vnf is empty in serviceDecomposition object") + logger.debug("Error - vnf is empty in serviceDecomposition object") exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf queryCatalogDB, vnf is null") } execution.setVariable("vnfResourceDecomposition", vnf) List<ModuleResource> vfModules = vnf.getAllVfModuleObjects() - msoLogger.debug("Read vfModules") + logger.debug("Read vfModules") if (vfModules == null) { - msoLogger.debug("Error - vfModules are empty in serviceDecomposition object") + logger.debug("Error - vfModules are empty in serviceDecomposition object") exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf queryCatalogDB, vf modules are empty") } @@ -221,7 +225,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { Map<String,String> vfModuleNames = execution.getVariable("vfModuleNames") for (int i = 0; i < vfModules.size; i++) { - msoLogger.debug("handling VF Module ") + logger.debug("handling VF Module ") ModuleResource vfModule = vfModules[i] boolean isBase = vfModule.getIsBase() if (isBase) { @@ -254,7 +258,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { execution.setVariable("addOnModulesDeployed", 0) }catch(Exception ex) { - msoLogger.debug("Error Occured in DoCreateVnfAndModules QueryCatalogDB Process " + ex.getMessage()) + logger.debug("Error Occured in DoCreateVnfAndModules QueryCatalogDB Process " + ex.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnfAndModules QueryCatalogDB Process") } @@ -267,13 +271,13 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { execution.setVariable("vnfId", "skask") } - msoLogger.trace("COMPLETED DoCreateVnfAndModules QueryCatalogDB Process") + logger.trace("COMPLETED DoCreateVnfAndModules QueryCatalogDB Process") } public void preProcessAddOnModule(DelegateExecution execution){ execution.setVariable("prefix", Prefix) - msoLogger.debug("STARTED preProcessAddOnModule") + logger.debug("STARTED preProcessAddOnModule") try { List<ModuleResource>addOnModules = execution.getVariable("addOnModules") @@ -281,7 +285,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { ModuleResource addOnModule = addOnModules[addOnIndex] - msoLogger.debug("Got addon module") + logger.debug("Got addon module") def newVfModuleId = UUID.randomUUID().toString() execution.setVariable("addOnVfModuleId", newVfModuleId) @@ -304,32 +308,36 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessAddOnModule ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing preProcessAddOnModule ", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preProcessAddOnModule") + logger.trace("COMPLETED preProcessAddOnModule") } public void postProcessAddOnModule(DelegateExecution execution){ execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED postProcessAddOnModule") + logger.trace("STARTED postProcessAddOnModule") try { int addOnModulesDeployed = execution.getVariable("addOnModulesDeployed") execution.setVariable("addOnModulesDeployed", addOnModulesDeployed + 1) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing postProcessAddOnModule ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing postProcessAddOnModule ", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during postProcessAddOnModule Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED postProcessAddOnModule") + logger.trace("COMPLETED postProcessAddOnModule") } public void validateBaseModule(DelegateExecution execution){ execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED validateBaseModule") + logger.trace("STARTED validateBaseModule") try { def baseRollbackData = execution.getVariable("DCVAM_baseRollbackData") @@ -338,26 +346,28 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { def baseModuleMap = baseRollbackData.get("VFMODULE") baseModuleMap.each{ k, v -> rollbackData.put("VFMODULE_BASE", "${k}","${v}") } execution.setVariable("rollbackData", rollbackData) - msoLogger.debug("addOnModulesDeployed: " + execution.getVariable("addOnModulesDeployed")) - msoLogger.debug("addOnModulesToDeploy: " + execution.getVariable("addOnModulesToDeploy")) + logger.debug("addOnModulesDeployed: " + execution.getVariable("addOnModulesDeployed")) + logger.debug("addOnModulesToDeploy: " + execution.getVariable("addOnModulesToDeploy")) if (execution.getVariable("addOnModulesDeployed") < execution.getVariable("addOnModulesToDeploy")) { - msoLogger.debug("More add on modules to deploy") + logger.debug("More add on modules to deploy") } else { - msoLogger.debug("No more add on modules to deploy") + logger.debug("No more add on modules to deploy") } }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing validateBaseModule ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing validateBaseModule ", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during validateBaseModule Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED validateBaseModule") + logger.trace("COMPLETED validateBaseModule") } public void validateAddOnModule(DelegateExecution execution){ execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED validateAddOnModule") + logger.trace("STARTED validateAddOnModule") try { int instancesOfThisModuleDeployed = execution.getVariable("instancesOfThisModuleDeployed") @@ -377,102 +387,104 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "${numOfCreatedAddOnModules}") execution.setVariable("rollbackData", rollbackData) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessAddOnModule ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing preProcessAddOnModule ", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED validateAddOnModule") + logger.trace("COMPLETED validateAddOnModule") } public void preProcessRollback (DelegateExecution execution) { - msoLogger.trace("preProcessRollback") + logger.trace("preProcessRollback") try { Object workflowException = execution.getVariable("WorkflowException"); if (workflowException instanceof WorkflowException) { - msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage()) + logger.debug("Prev workflowException: " + workflowException.getErrorMessage()) execution.setVariable("prevWorkflowException", workflowException); //execution.setVariable("WorkflowException", null); } } catch (BpmnError e) { - msoLogger.debug("BPMN Error during preProcessRollback") + logger.debug("BPMN Error during preProcessRollback") } catch(Exception ex) { String msg = "Exception in preProcessRollback. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } - msoLogger.trace("Exit preProcessRollback") + logger.trace("Exit preProcessRollback") } public void postProcessRollback (DelegateExecution execution) { - msoLogger.trace("postProcessRollback") + logger.trace("postProcessRollback") String msg = "" try { Object workflowException = execution.getVariable("prevWorkflowException"); if (workflowException instanceof WorkflowException) { - msoLogger.debug("Setting prevException to WorkflowException: ") + logger.debug("Setting prevException to WorkflowException: ") execution.setVariable("WorkflowException", workflowException); } execution.setVariable("rollbackData", null) } catch (BpmnError b) { - msoLogger.debug("BPMN Error during postProcessRollback") + logger.debug("BPMN Error during postProcessRollback") throw b; } catch(Exception ex) { msg = "Exception in postProcessRollback. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } - msoLogger.trace("Exit postProcessRollback") + logger.trace("Exit postProcessRollback") } public void createPlatform (DelegateExecution execution) { - msoLogger.trace("START createPlatform") + logger.trace("START createPlatform") String platformName = execution.getVariable("platformName") String vnfId = execution.getVariable("vnfId") - msoLogger.debug("Platform NAME: " + platformName) - msoLogger.debug("VnfID: " + vnfId) + logger.debug("Platform NAME: " + platformName) + logger.debug("VnfID: " + vnfId) if(isBlank(platformName)){ - msoLogger.debug("platformName was not found. Continuing on with flow...") + logger.debug("platformName was not found. Continuing on with flow...") }else{ - msoLogger.debug("platformName was found.") + logger.debug("platformName was found.") try{ AAICreateResources aaiCR = new AAICreateResources() aaiCR.createAAIPlatform(platformName, vnfId) }catch(Exception ex){ String msg = "Exception in createPlatform. " + ex.getMessage(); - msoLogger.debug(msg) + logger.debug(msg) } } - msoLogger.trace("Exit createPlatform") + logger.trace("Exit createPlatform") } public void createLineOfBusiness (DelegateExecution execution) { - msoLogger.trace("START createLineOfBusiness") + logger.trace("START createLineOfBusiness") String lineOfBusiness = execution.getVariable("lineOfBusiness") String vnfId = execution.getVariable("vnfId") - msoLogger.debug("LineOfBusiness NAME: " + lineOfBusiness) - msoLogger.debug("VnfID: " + vnfId) + logger.debug("LineOfBusiness NAME: " + lineOfBusiness) + logger.debug("VnfID: " + vnfId) if(isBlank(lineOfBusiness)){ - msoLogger.debug("LineOfBusiness was not found. Continuing on with flow...") + logger.debug("LineOfBusiness was not found. Continuing on with flow...") }else{ - msoLogger.debug("LineOfBusiness was found.") + logger.debug("LineOfBusiness was found.") try{ AAICreateResources aaiCR = new AAICreateResources() aaiCR.createAAILineOfBusiness(lineOfBusiness, vnfId) }catch(Exception ex){ String msg = "Exception in LineOfBusiness. " + ex.getMessage(); - msoLogger.debug(msg) + logger.debug(msg) } } - msoLogger.trace("Exit createLineOfBusiness") + logger.trace("Exit createLineOfBusiness") } public String getPredefinedVfModuleName(DelegateExecution execution, String vfModuleModelInvariantUuid) { @@ -485,7 +497,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { String vfModuleName = vfModuleNames.get(vfModuleModelInvariantUuid) if (vfModuleName != null) { - msoLogger.debug("Using vfModuleName='" + vfModuleName + "' for vfModuleModelInvariantUuid=" + vfModuleModelInvariantUuid) + logger.debug("Using vfModuleName='" + vfModuleName + "' for vfModuleModelInvariantUuid=" + vfModuleModelInvariantUuid) } return vfModuleName diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy index eafc39b1dd..2de7314a98 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -33,6 +35,8 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory /** * This class supports the macro VID Flow @@ -40,7 +44,7 @@ import org.onap.so.logger.MsoLogger */ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVnfAndModulesRollback.class); + private static final Logger logger = LoggerFactory.getLogger( DoCreateVnfAndModulesRollback.class); String Prefix="DCVAMR_" ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() @@ -56,13 +60,13 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { public void preProcessRequest(DelegateExecution execution) { execution.setVariable("prefix",Prefix) - msoLogger.debug("STARTED DoCreateVnfAndModulesRollback PreProcessRequest Process") + logger.debug("STARTED DoCreateVnfAndModulesRollback PreProcessRequest Process") try{ // Get Rollback Variables def rollbackData = execution.getVariable("rollbackData") - msoLogger.debug("Incoming RollbackData is: " + rollbackData.toString()) + logger.debug("Incoming RollbackData is: " + rollbackData.toString()) execution.setVariable("rolledBack", null) execution.setVariable("rollbackError", null) @@ -72,7 +76,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { } String vnfId = rollbackData.get("VNF", "vnfId") - msoLogger.debug("Rollback vnfId is: " + vnfId) + logger.debug("Rollback vnfId is: " + vnfId) execution.setVariable("DCVAMR_vnfId", vnfId) execution.setVariable("mso-request-id", execution.getVariable("msoRequestId")) @@ -82,23 +86,23 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { execution.setVariable("DCVAMR_rollbackVnfCreate", rollbackData.get("VNF", "rollbackVnfCreate")) String sdncCallbackUrl = rollbackData.get("VNF", "sdncCallbackUrl") - msoLogger.debug("Rollback sdncCallbackUrl is: " + sdncCallbackUrl) + logger.debug("Rollback sdncCallbackUrl is: " + sdncCallbackUrl) execution.setVariable("DCVAMR_sdncCallbackUrl", sdncCallbackUrl) String tenantId= rollbackData.get("VNF", "tenantId") - msoLogger.debug("Rollback tenantId is: " + tenantId) + logger.debug("Rollback tenantId is: " + tenantId) execution.setVariable("DCVAMR_tenantId", tenantId) String source= rollbackData.get("VNF", "source") - msoLogger.debug("Rollback source is: " + source) + logger.debug("Rollback source is: " + source) execution.setVariable("DCVAMR_source", source) String serviceInstanceId = rollbackData.get("VNF", "serviceInstanceId") - msoLogger.debug("Rollback serviceInstanceId is: " + serviceInstanceId) + logger.debug("Rollback serviceInstanceId is: " + serviceInstanceId) execution.setVariable("DCVAMR_serviceInstanceId", serviceInstanceId) String cloudSiteId = rollbackData.get("VNF", "cloudSiteId") - msoLogger.debug("Rollback cloudSiteId is: " + cloudSiteId) + logger.debug("Rollback cloudSiteId is: " + cloudSiteId) execution.setVariable("DCVAMR_cloudSiteId", cloudSiteId) def numOfAddOnModulesString = rollbackData.get("VNFANDMODULES", "numOfCreatedAddOnModules") @@ -121,14 +125,14 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { execution.setVariable("DCVAMR_aLaCarte", false) }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") + logger.debug("Rethrowing MSOWorkflowException") throw b }catch(Exception e){ - msoLogger.debug(" Error Occured in DoCreateVnfAndModulesRollback PreProcessRequest method!" + e.getMessage()) + logger.debug(" Error Occured in DoCreateVnfAndModulesRollback PreProcessRequest method!" + e.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnfAndModulesRollback PreProcessRequest") } - msoLogger.trace("COMPLETED DoCreateVnfAndModulesRollback PreProcessRequest Process") + logger.trace("COMPLETED DoCreateVnfAndModulesRollback PreProcessRequest Process") } @@ -136,7 +140,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { public void preProcessCreateVfModuleRollback(DelegateExecution execution){ execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED preProcessCreateVfModuleRollback") + logger.trace("STARTED preProcessCreateVfModuleRollback") try { @@ -145,33 +149,35 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { def vfModuleRollbackData = new RollbackData() def numOfModulesToDelete = execution.getVariable("DCVAMR_numOfModulesToDelete") - msoLogger.debug("numOfModulesToDelete: " + numOfModulesToDelete) + logger.debug("numOfModulesToDelete: " + numOfModulesToDelete) def moduleMap = null if (numOfModulesToDelete > 1) { int addOnModuleIndex = numOfModulesToDelete - 1 moduleMap = rollbackData.get("VFMODULE_ADDON_" + addOnModuleIndex) - msoLogger.debug("Removing ADDON VF module # " + addOnModuleIndex) + logger.debug("Removing ADDON VF module # " + addOnModuleIndex) } else { moduleMap = rollbackData.get("VFMODULE_BASE") - msoLogger.debug("Removing BASE VF module") + logger.debug("Removing BASE VF module") } moduleMap.each{ k, v -> vfModuleRollbackData.put("VFMODULE", "${k}","${v}") } execution.setVariable("DCVAMR_RollbackData", vfModuleRollbackData) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessCreateVfModuleRollback ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing preProcessCreateVfModuleRollback ", "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessCreateVfModuleRollback Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preProcessCreateVfModuleRollback") + logger.trace("COMPLETED preProcessCreateVfModuleRollback") } public void postProcessCreateVfModuleRollback(DelegateExecution execution){ execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED postProcessCreateVfModuleRollback") + logger.trace("STARTED postProcessCreateVfModuleRollback") def rolledBack = false try { @@ -179,22 +185,26 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { def numOfModulesToDelete = execution.getVariable("DCVAMR_numOfModulesToDelete") execution.setVariable("DCVAMR_numOfModulesToDelete", numOfModulesToDelete - 1) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing postProcessCreateVfModuleRollback ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing postProcessCreateVfModuleRollback ", "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during postProcessCreateVfModuleRollback Method:\n" + e.getMessage()) } if (rolledBack == false) { - msoLogger.debug("Failure on DoCreateVfModuleRollback") - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Unsuccessful rollback of DoCreateVfModule ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError); + logger.debug("Failure on DoCreateVfModuleRollback") + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Unsuccessful rollback of DoCreateVfModule ", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during rollback of DoCreateVfModule") } - msoLogger.trace("COMPLETED postProcessCreateVfModuleRollback") + logger.trace("COMPLETED postProcessCreateVfModuleRollback") } public void preProcessSDNCDeactivateRequest(DelegateExecution execution){ execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED preProcessSDNCDeactivateRequest") + logger.trace("STARTED preProcessSDNCDeactivateRequest") def vnfId = execution.getVariable("vnfId") def serviceInstanceId = execution.getVariable("serviceInstanceId") @@ -205,13 +215,15 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest) execution.setVariable(Prefix + "deactivateSDNCRequest", deactivateSDNCRequest) - msoLogger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) + logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessSDNCDeactivateRequest ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing preProcessSDNCDeactivateRequest ", "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preProcessSDNCDeactivateRequest") + logger.trace("COMPLETED preProcessSDNCDeactivateRequest") } public void preProcessSDNCUnassignRequest(DelegateExecution execution) { @@ -219,9 +231,9 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED preProcessSDNCUnassignRequest Process") + logger.trace("STARTED preProcessSDNCUnassignRequest Process") try{ String vnfId = execution.getVariable("vnfId") String serviceInstanceId = execution.getVariable("serviceInstanceId") @@ -229,13 +241,13 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign") execution.setVariable(Prefix + "unassignSDNCRequest", unassignSDNCRequest) - msoLogger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest) + logger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest) }catch(Exception e){ - msoLogger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e) + logger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preProcessSDNCUnassignRequest Process") + logger.trace("COMPLETED preProcessSDNCUnassignRequest Process") } public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ @@ -291,37 +303,37 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { </sdncadapterworkflow:SDNCRequestData> </sdncadapterworkflow:SDNCAdapterWorkflowRequest>""" - msoLogger.debug("sdncRequest: " + sdncRequest) + logger.debug("sdncRequest: " + sdncRequest) return sdncRequest } public void validateSDNCResponse(DelegateExecution execution, String response, String method){ execution.setVariable("prefix",Prefix) - msoLogger.debug("STARTED ValidateSDNCResponse Process") + logger.debug("STARTED ValidateSDNCResponse Process") WorkflowException workflowException = execution.getVariable("WorkflowException") boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - msoLogger.debug("workflowException: " + workflowException) + logger.debug("workflowException: " + workflowException) SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) String sdncResponse = response if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse) + logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse) }else{ - msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") + logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") throw new BpmnError("MSOWorkflowException") } - msoLogger.debug("COMPLETED ValidateSDNCResponse Process") + logger.debug("COMPLETED ValidateSDNCResponse Process") } public void setSuccessfulRollbackStatus (DelegateExecution execution){ execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED setSuccessfulRollbackStatus") + logger.trace("STARTED setSuccessfulRollbackStatus") try{ // Set rolledBack to true, rollbackError to null @@ -329,16 +341,16 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { execution.setVariable("rollbackError", null) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing setSuccessfulRollbackStatus ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing setSuccessfulRollbackStatus ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED setSuccessfulRollbackStatus") + logger.trace("COMPLETED setSuccessfulRollbackStatus") } public void setFailedRollbackStatus (DelegateExecution execution){ execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED setFailedRollbackStatus") + logger.trace("STARTED setFailedRollbackStatus") try{ // Set rolledBack to false, rollbackError to actual value, rollbackData to null @@ -350,10 +362,10 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { execution.setVariable("rollbackData", null) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing setFailedRollbackStatus. ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing setFailedRollbackStatus. ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setFailedRollbackStatus Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED setFailedRollbackStatus") + logger.trace("COMPLETED setFailedRollbackStatus") } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy index b30929d6bd..5b83ca6641 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy @@ -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 @@ -38,6 +40,8 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils; import org.w3c.dom.Document import org.w3c.dom.Element @@ -73,7 +77,7 @@ import groovy.json.* * Rollback - Deferred */ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCustomDeleteE2EServiceInstance.class); + private static final Logger logger = LoggerFactory.getLogger( DoCustomDeleteE2EServiceInstance.class); String Prefix="DDELSI_" @@ -81,7 +85,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess JsonUtils jsonUtil = new JsonUtils() public void preProcessRequest (DelegateExecution execution) { - msoLogger.trace("preProcessRequest ") + logger.trace("preProcessRequest ") String msg = "" try { @@ -107,18 +111,18 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess String serviceInstanceId = execution.getVariable("serviceInstanceId") if (isBlank(serviceInstanceId)){ msg = "Input serviceInstanceId is null" - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } String sdncCallbackUrl = UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback',execution) if (isBlank(sdncCallbackUrl)) { msg = "URN_mso_workflow_sdncadapter_callback is null" - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - msoLogger.info("SDNC Callback URL: " + sdncCallbackUrl) + logger.info("SDNC Callback URL: " + sdncCallbackUrl) StringBuilder sbParams = new StringBuilder() Map<String, String> paramsMap = execution.getVariable("serviceInputParams") @@ -148,10 +152,10 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit preProcessRequest ") + logger.trace("Exit preProcessRequest ") } @@ -162,7 +166,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess } public void preProcessSDNCDelete (DelegateExecution execution) { - msoLogger.trace("preProcessSDNCDelete ") + logger.trace("preProcessSDNCDelete ") String msg = "" try { @@ -261,52 +265,52 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") execution.setVariable("sdncDelete", sdncDelete) execution.setVariable("sdncDeactivate", sdncDeactivate) - msoLogger.info("sdncDeactivate:\n" + sdncDeactivate) - msoLogger.info("sdncDelete:\n" + sdncDelete) + logger.info("sdncDeactivate:\n" + sdncDeactivate) + logger.info("sdncDelete:\n" + sdncDelete) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCDelete. " + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception Occured in preProcessSDNCDelete.\n" + ex.getMessage()) } - msoLogger.info(" *****Exit preProcessSDNCDelete *****") + logger.info(" *****Exit preProcessSDNCDelete *****") } public void postProcessSDNCDelete(DelegateExecution execution, String response, String method) { - msoLogger.trace("postProcessSDNC " + method + " ") + logger.trace("postProcessSDNC " + method + " ") String msg = "" /*try { WorkflowException workflowException = execution.getVariable("WorkflowException") boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - msoLogger.info("SDNCResponse: " + response) - msoLogger.info("workflowException: " + workflowException) + logger.info("SDNCResponse: " + response) + logger.info("workflowException: " + workflowException) SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) if(execution.getVariable(Prefix + 'sdncResponseSuccess') == "true"){ - msoLogger.info("Good response from SDNC Adapter for service-instance " + method + "response:\n" + response) + logger.info("Good response from SDNC Adapter for service-instance " + method + "response:\n" + response) }else{ msg = "Bad Response from SDNC Adapter for service-instance " + method - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 3500, msg) } } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in postProcessSDNC " + method + " Exception:" + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) }*/ - msoLogger.trace("Exit postProcessSDNC " + method + " ") + logger.trace("Exit postProcessSDNC " + method + " ") } public void postProcessAAIGET(DelegateExecution execution) { - msoLogger.trace("postProcessAAIGET ") + logger.trace("postProcessAAIGET ") String msg = "" try { @@ -315,22 +319,22 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess String serviceType = "" if(foundInAAI){ - msoLogger.info("Found Service-instance in AAI") + logger.info("Found Service-instance in AAI") String siData = execution.getVariable("GENGS_service") - msoLogger.info("SI Data") + logger.info("SI Data") if (isBlank(siData)) { msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } else { - msoLogger.info("SI Data" + siData) + logger.info("SI Data" + siData) //Confirm there are no related service instances (vnf/network or volume) if (utils.nodeExists(siData, "relationship-list")) { - msoLogger.info("SI Data relationship-list exists:") + logger.info("SI Data relationship-list exists:") InputSource source = new InputSource(new StringReader(siData)); DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder() @@ -346,7 +350,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() //for ns if(e.equals("service-instance")){ def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent() - msoLogger.info("ServiceInstance Related NS :" + relatedObject) + logger.info("ServiceInstance Related NS :" + relatedObject) NodeList dataList = node.getChildNodes() if(null != dataList) { JSONObject jObj = new JSONObject() @@ -369,13 +373,13 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess } } } - msoLogger.info("Relationship related to Resource:" + jObj.toString()) + logger.info("Relationship related to Resource:" + jObj.toString()) jArray.put(jObj) } //for overlay/underlay }else if (e.equals("configuration")){ def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent() - msoLogger.info("ServiceInstance Related Configuration :" + relatedObject) + logger.info("ServiceInstance Related Configuration :" + relatedObject) NodeList dataList = node.getChildNodes() if(null != dataList) { JSONObject jObj = new JSONObject() @@ -398,7 +402,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess } } } - msoLogger.info("Relationship related to Resource:" + jObj.toString()) + logger.info("Relationship related to Resource:" + jObj.toString()) jArray.put(jObj) } } @@ -410,37 +414,37 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess }else{ boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") if(!succInAAI){ - msoLogger.info("Error getting Service-instance from AAI", + serviceInstanceId) + logger.info("Error getting Service-instance from AAI", + serviceInstanceId) WorkflowException workflowException = execution.getVariable("WorkflowException") - msoLogger.debug("workflowException: " + workflowException) + logger.debug("workflowException: " + workflowException) if(workflowException != null){ exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) } else { msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) } } - msoLogger.info("Service-instance NOT found in AAI. Silent Success") + logger.info("Service-instance NOT found in AAI. Silent Success") } }catch (BpmnError e) { throw e; } catch (Exception ex) { msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit postProcessAAIGET ") + logger.trace("Exit postProcessAAIGET ") } /** * Deletes the service instance in aai */ public void deleteServiceInstance(DelegateExecution execution) { - msoLogger.trace("Entered deleteServiceInstance") + logger.trace("Entered deleteServiceInstance") try { String globalCustId = execution.getVariable("globalSubscriberId") String serviceType = execution.getVariable("serviceType") @@ -450,15 +454,15 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId) resourceClient.delete(serviceInstanceUri) - msoLogger.trace("Exited deleteServiceInstance") + logger.trace("Exited deleteServiceInstance") }catch(Exception e){ - msoLogger.debug("Error occured within deleteServiceInstance method: " + e) + logger.debug("Error occured within deleteServiceInstance method: " + e) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Error occured during deleteServiceInstance from aai") } } public void preInitResourcesOperStatus(DelegateExecution execution){ - msoLogger.trace("STARTED preInitResourcesOperStatus Process ") + logger.trace("STARTED preInitResourcesOperStatus Process ") try{ String serviceId = execution.getVariable("serviceInstanceId") String operationId = execution.getVariable("operationId") @@ -468,7 +472,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess String progress = "0" String reason = "" String operationContent = "Prepare service creation" - msoLogger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType) + logger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType) serviceId = UriUtils.encode(serviceId,"UTF-8") execution.setVariable("serviceInstanceId", serviceId) execution.setVariable("operationId", operationId) @@ -523,14 +527,16 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess payload = utils.formatXml(payload) execution.setVariable("CVFMI_initResOperStatusRequest", payload) - msoLogger.info("Outgoing initResourceOperationStatus: \n" + payload) - msoLogger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) + logger.info("Outgoing initResourceOperationStatus: \n" + payload) + logger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preInitResourcesOperStatus Process ") + logger.trace("COMPLETED preInitResourcesOperStatus Process ") } /** @@ -556,7 +562,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess "resourceType":"underlay" } ]*/ - msoLogger.trace("STARTED preResourceDelete Process ") + logger.trace("STARTED preResourceDelete Process ") String serviceRelationShip = execution.getVariable("serviceRelationShip") def jsonSlurper = new JsonSlurper() def jsonOutput = new JsonOutput() @@ -570,15 +576,15 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess execution.setVariable("resourceTemplateId", resourceTemplateUUID) execution.setVariable("resourceInstanceId", resourceInstanceUUID) execution.setVariable("resourceType", resourceName) - msoLogger.info("Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " + resourceInstanceUUID + " resourceType: " + resourceName) + logger.info("Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " + resourceInstanceUUID + " resourceType: " + resourceName) } } } - msoLogger.trace("END preResourceDelete Process ") + logger.trace("END preResourceDelete Process ") } public void sequenceResource(execution){ - msoLogger.trace("STARTED sequenceResource Process ") + logger.trace("STARTED sequenceResource Process ") List<String> nsResources = new ArrayList<String>() List<String> wanResources = new ArrayList<String>() List<String> resourceSequence = new ArrayList<String>() @@ -605,13 +611,13 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess execution.setVariable("isContainsWanResource", isContainsWanResource) execution.setVariable("currentResourceIndex", 0) execution.setVariable("resourceSequence", resourceSequence) - msoLogger.info("resourceSequence: " + resourceSequence) + logger.info("resourceSequence: " + resourceSequence) execution.setVariable("wanResources", wanResources) - msoLogger.trace("END sequenceResource Process ") + logger.trace("END sequenceResource Process ") } public void getCurrentResource(execution){ - msoLogger.trace("Start getCurrentResoure Process ") + logger.trace("Start getCurrentResoure Process ") def currentIndex = execution.getVariable("currentResourceIndex") List<String> resourceSequence = execution.getVariable("resourceSequence") List<String> wanResources = execution.getVariable("wanResources") @@ -622,11 +628,11 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess }else{ execution.setVariable("controllerInfo", "VF-C") } - msoLogger.trace("COMPLETED getCurrentResoure Process ") + logger.trace("COMPLETED getCurrentResoure Process ") } public void parseNextResource(execution){ - msoLogger.trace("Start parseNextResource Process ") + logger.trace("Start parseNextResource Process ") def currentIndex = execution.getVariable("currentResourceIndex") def nextIndex = currentIndex + 1 execution.setVariable("currentResourceIndex", nextIndex) @@ -636,7 +642,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess }else{ execution.setVariable("allResourceFinished", "false") } - msoLogger.trace("COMPLETED parseNextResource Process ") + logger.trace("COMPLETED parseNextResource Process ") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy index 59ea5c236f..b16ccaa8fd 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy @@ -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 @@ -38,6 +40,8 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils; import org.onap.so.client.aai.AAIResourcesClient @@ -71,7 +75,7 @@ import groovy.json.* * Rollback - Deferred */ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCustomDeleteE2EServiceInstanceV2.class); + private static final Logger logger = LoggerFactory.getLogger( DoCustomDeleteE2EServiceInstanceV2.class); String Prefix="DDELSI_" @@ -82,8 +86,8 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce public void preProcessRequest (DelegateExecution execution) { def method = getClass().getSimpleName() + '.buildAPPCRequest(' +'execution=' + execution.getId() +')' - msoLogger.info("Entered " + method) - msoLogger.trace("preProcessRequest ") + logger.info("Entered " + method) + logger.trace("preProcessRequest ") String msg = "" try { @@ -109,18 +113,18 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce String serviceInstanceId = execution.getVariable("serviceInstanceId") if (isBlank(serviceInstanceId)){ msg = "Input serviceInstanceId is null" - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') if (isBlank(sdncCallbackUrl)) { msg = "URN_mso_workflow_sdncadapter_callback is null" - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - msoLogger.info("SDNC Callback URL: " + sdncCallbackUrl) + logger.info("SDNC Callback URL: " + sdncCallbackUrl) StringBuilder sbParams = new StringBuilder() Map<String, String> paramsMap = execution.getVariable("serviceInputParams") @@ -152,10 +156,10 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.info("Exited " + method) + logger.info("Exited " + method) } /** @@ -179,7 +183,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce }catch(BpmnError e) { throw e; }catch(NotFoundException e) { - msoLogger.info("SI not found in aai. Silent Success ") + logger.info("SI not found in aai. Silent Success ") }catch(Exception ex) { String msg = "Internal Error in getServiceInstance: " + ex.getMessage() exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) @@ -189,41 +193,41 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce private void loadResourcesProperties(DelegateExecution execution) { def method = getClass().getSimpleName() + '.loadResourcesProperties(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugEnabled") - msoLogger.info("Entered " + method) + logger.info("Entered " + method) String loadFilePath = "/etc/mso/config.d/reources.json" try{ def jsonPayload = new File(loadFilePath).text - msoLogger.info("jsonPayload: " + jsonPayload) + logger.info("jsonPayload: " + jsonPayload) String resourcesProperties = jsonUtil.prettyJson(jsonPayload.toString()) - msoLogger.info("resourcesProperties: " + resourcesProperties) + logger.info("resourcesProperties: " + resourcesProperties) String createResourceSort = jsonUtil.getJsonValue(resourcesProperties, "CreateResourceSort") - msoLogger.info("createResourceSort: " + createResourceSort) + logger.info("createResourceSort: " + createResourceSort) execution.setVariable("createResourceSort", createResourceSort) String deleteResourceSort = jsonUtil.getJsonValue(resourcesProperties, "DeleteResourceSort") - msoLogger.info("deleteResourceSort: " + deleteResourceSort) + logger.info("deleteResourceSort: " + deleteResourceSort) execution.setVariable("deleteResourceSort", deleteResourceSort) String resourceControllerType = jsonUtil.getJsonValue(resourcesProperties, "ResourceControllerType") - msoLogger.info("resourceControllerType: " + resourceControllerType) + logger.info("resourceControllerType: " + resourceControllerType) execution.setVariable("resourceControllerType", resourceControllerType) }catch(Exception ex){ // try error in method block String exceptionMessage = "Bpmn error encountered in " + method + " - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - msoLogger.info("Exited " + method) + logger.info("Exited " + method) } private void sortDeleteResource(DelegateExecution execution) { def method = getClass().getSimpleName() + '.sortDeleteResource(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugEnabled") - msoLogger.info("Entered " + method) + logger.info("Entered " + method) String deleteResourceSortDef = """[ { "resourceType":"GRE_SAR" @@ -267,7 +271,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce } List<String> sortResourceList = jsonUtil.StringArrayToList(execution, deleteResourceSort) - msoLogger.info("sortResourceList : " + sortResourceList) + logger.info("sortResourceList : " + sortResourceList) JSONArray newResourceList = new JSONArray() int resSortCount = sortResourceList.size() @@ -278,14 +282,14 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce List<String> resourceList = execution.getVariable(Prefix+"resourceList") for (String resource : resourceList) { - msoLogger.info("resource : " + resource) + logger.info("resource : " + resource) String resourceType = jsonUtil.getJsonValue(resource, "resourceType") if (StringUtils.containsIgnoreCase(resourceType, sortResourceType)) { JSONObject jsonObj = new JSONObject(resource) newResourceList.put(jsonObj) } - msoLogger.info("Get next sort type " ) + logger.info("Get next sort type " ) } } @@ -293,20 +297,20 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce List<String> newResourceListStr = jsonUtil.StringArrayToList(execution, newResourceStr) execution.setVariable(Prefix+"resourceList", newResourceListStr) - msoLogger.info("newResourceList : " + newResourceListStr) + logger.info("newResourceList : " + newResourceListStr) }catch(Exception ex){ // try error in method block String exceptionMessage = "Bpmn error encountered in " + method + " - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - msoLogger.info("Exited " + method) + logger.info("Exited " + method) } public void prepareServiceDeleteResource(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepareServiceDeleteResource(' +'execution=' + execution.getId() +')' - msoLogger.info("Entered " + method) + logger.info("Entered " + method) try { @@ -319,9 +323,9 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce execution.setVariable(Prefix+"resourceFinish", true) String aaiJsonRecord = execution.getVariable("serviceInstance"); - msoLogger.info("serviceInstanceAaiRecord: " +aaiJsonRecord) + logger.info("serviceInstanceAaiRecord: " +aaiJsonRecord) - msoLogger.info("aaiJsonRecord: " +aaiJsonRecord) + logger.info("aaiJsonRecord: " +aaiJsonRecord) def serviceInstanceName = jsonUtil.getJsonValue(aaiJsonRecord, "service-instance.service-instance-name") execution.setVariable("serviceInstanceName",serviceInstanceName) @@ -330,11 +334,11 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce String relationshipList = jsonUtil.getJsonValue(aaiJsonRecord, "service-instance.relationship-list") - msoLogger.info("relationship-list:" + relationshipList) + logger.info("relationship-list:" + relationshipList) if (! isBlank(relationshipList)){ - msoLogger.info("relationship-list exists" ) + logger.info("relationship-list exists" ) String relationShip = jsonUtil.getJsonValue(relationshipList, "relationship") - msoLogger.info("relationship: " + relationShip) + logger.info("relationship: " + relationShip) JSONArray allResources = new JSONArray() JSONArray serviceResources = new JSONArray() JSONArray networkResources = new JSONArray() @@ -349,32 +353,32 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce } else if (relationShip.startsWith("[") && relationShip.endsWith("]")) { jsonArray = new JSONArray(relationShip); } else { - msoLogger.info("The relationShip fomart is error" ) + logger.info("The relationShip fomart is error" ) } List<String> relationList = jsonUtil.StringArrayToList(execution, jsonArray.toString()) - msoLogger.info("relationList: " + relationList) + logger.info("relationList: " + relationList) int relationNum =relationList.size() - msoLogger.info("**************relationList size: " + relationNum) + logger.info("**************relationList size: " + relationNum) for ( int currentRelation = 0 ; currentRelation < relationNum ; currentRelation++ ) { - msoLogger.info("current Relation num: " + currentRelation) + logger.info("current Relation num: " + currentRelation) String relation = relationList[currentRelation] - msoLogger.info("relation: " + relation) + logger.info("relation: " + relation) String relatedTo = jsonUtil.getJsonValue(relation, "related-to") - msoLogger.info("relatedTo: " + relatedTo) + logger.info("relatedTo: " + relatedTo) String relatedLink = jsonUtil.getJsonValue(relation, "related-link") - msoLogger.info("relatedLink: " + relatedLink) + logger.info("relatedLink: " + relatedLink) if (StringUtils.equalsIgnoreCase(relatedTo, "allotted-resource")) { - msoLogger.info("allotted-resource exists ") + logger.info("allotted-resource exists ") Optional<AllottedResource> aaiArRsp = getAaiAr(execution, relatedLink) - msoLogger.info("aaiArRsp: " + aaiArRsp) + logger.info("aaiArRsp: " + aaiArRsp) if (aaiArRsp.isPresent()) { JSONObject jObject = new JSONObject() @@ -384,22 +388,22 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce jObject.put("resourceVersion", aaiArRsp.get().getResourceVersion()) allResources.put(jObject) - msoLogger.info("allResources: " + allResources) + logger.info("allResources: " + allResources) allottedResources.put(jObject) - msoLogger.info("allottedResources: " + allottedResources) + logger.info("allottedResources: " + allottedResources) } } else if (StringUtils.equalsIgnoreCase(relatedTo, "service-instance")){ - msoLogger.info("service-instance exists ") + logger.info("service-instance exists ") JSONObject jObject = new JSONObject() //relationship-data String rsDataStr = jsonUtil.getJsonValue(relation, "relationship-data") - msoLogger.info("rsDataStr: " + rsDataStr) + logger.info("rsDataStr: " + rsDataStr) List<String> rsDataList = jsonUtil.StringArrayToList(execution, rsDataStr) - msoLogger.info("rsDataList: " + rsDataList) + logger.info("rsDataList: " + rsDataList) for(String rsData : rsDataList){ - msoLogger.info("rsData: " + rsData) + logger.info("rsData: " + rsData) def eKey = jsonUtil.getJsonValue(rsData, "relationship-key") def eValue = jsonUtil.getJsonValue(rsData, "relationship-value") if(eKey.equals("service-instance.service-instance-id")){ @@ -412,11 +416,11 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce //related-to-property String rPropertyStr = jsonUtil.getJsonValue(relation, "related-to-property") - msoLogger.info("related-to-property: " + rPropertyStr) + logger.info("related-to-property: " + rPropertyStr) if (rPropertyStr instanceof JSONArray){ List<String> rPropertyList = jsonUtil.StringArrayToList(execution, rPropertyStr) for (String rProperty : rPropertyList) { - msoLogger.info("rProperty: " + rProperty) + logger.info("rProperty: " + rProperty) def eKey = jsonUtil.getJsonValue(rProperty, "property-key") def eValue = jsonUtil.getJsonValue(rProperty, "property-value") if(eKey.equals("service-instance.service-instance-name")){ @@ -426,7 +430,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce } else { String rProperty = rPropertyStr - msoLogger.info("rProperty: " + rProperty) + logger.info("rProperty: " + rProperty) def eKey = jsonUtil.getJsonValue(rProperty, "property-key") def eValue = jsonUtil.getJsonValue(rProperty, "property-value") if (eKey.equals("service-instance.service-instance-name")) { @@ -435,22 +439,22 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce } allResources.put(jObject) - msoLogger.info("allResources: " + allResources) + logger.info("allResources: " + allResources) serviceResources.put(jObject) - msoLogger.info("serviceResources: " + serviceResources) + logger.info("serviceResources: " + serviceResources) } else if (StringUtils.equalsIgnoreCase(relatedTo, "configuration")) { - msoLogger.info("configuration ") + logger.info("configuration ") JSONObject jObject = new JSONObject() //relationship-data String rsDataStr = jsonUtil.getJsonValue(relation, "relationship-data") - msoLogger.info("rsDataStr: " + rsDataStr) + logger.info("rsDataStr: " + rsDataStr) List<String> rsDataList = jsonUtil.StringArrayToList(execution, rsDataStr) - msoLogger.info("rsDataList: " + rsDataList) + logger.info("rsDataList: " + rsDataList) for (String rsData : rsDataList) { - msoLogger.info("rsData: " + rsData) + logger.info("rsData: " + rsData) def eKey = jsonUtil.getJsonValue(rsData, "relationship-key") def eValue = jsonUtil.getJsonValue(rsData, "relationship-value") if(eKey.equals("configuration.configuration-id")){ @@ -461,11 +465,11 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce //related-to-property String rPropertyStr = jsonUtil.getJsonValue(relation, "related-to-property") - msoLogger.info("related-to-property: " + rPropertyStr) + logger.info("related-to-property: " + rPropertyStr) if (rPropertyStr instanceof JSONArray){ List<String> rPropertyList = jsonUtil.StringArrayToList(execution, rPropertyStr) for(String rProperty : rPropertyList){ - msoLogger.info("rProperty: " + rProperty) + logger.info("rProperty: " + rProperty) def eKey = jsonUtil.getJsonValue(rProperty, "property-key") def eValue = jsonUtil.getJsonValue(rProperty, "property-value") if(eKey.equals("configuration.configuration-type")){ @@ -475,7 +479,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce } else { String rProperty = rPropertyStr - msoLogger.info("rProperty: " + rProperty) + logger.info("rProperty: " + rProperty) def eKey = jsonUtil.getJsonValue(rProperty, "property-key") def eValue = jsonUtil.getJsonValue(rProperty, "property-value") if(eKey.equals("configuration.configuration-type")){ @@ -483,34 +487,34 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce } } allResources.put(jObject) - msoLogger.info("allResources: " + allResources) + logger.info("allResources: " + allResources) networkResources.put(jObject) - msoLogger.info("networkResources: " + networkResources) + logger.info("networkResources: " + networkResources) } - msoLogger.info("Get Next releation resource " ) + logger.info("Get Next releation resource " ) } - msoLogger.info("Get releation finished. " ) + logger.info("Get releation finished. " ) } execution.setVariable("serviceRelationShip", allResources.toString()) - msoLogger.info("allResources: " + allResources.toString()) + logger.info("allResources: " + allResources.toString()) String serviceRelationShip = execution.getVariable("serviceRelationShip") - msoLogger.info("serviceRelationShip: " + serviceRelationShip) + logger.info("serviceRelationShip: " + serviceRelationShip) if ((! isBlank(serviceRelationShip)) && (! serviceRelationShip.isEmpty())) { List<String> relationShipList = jsonUtil.StringArrayToList(execution, serviceRelationShip) - msoLogger.info("relationShipList: " + relationShipList) + logger.info("relationShipList: " + relationShipList) execution.setVariable(Prefix+"resourceList", relationShipList) int resourceCount = relationShipList.size() - msoLogger.info("resourceCount: " + resourceCount) + logger.info("resourceCount: " + resourceCount) execution.setVariable(Prefix+"resourceCount",resourceCount ) int resourceNum = 0 execution.setVariable(Prefix+"nextResource", resourceNum) - msoLogger.info("start sort delete resource: ") + logger.info("start sort delete resource: ") sortDeleteResource(execution) @@ -520,48 +524,48 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce else { execution.setVariable(Prefix+"resourceFinish", true) } - msoLogger.info("Resource list set end : " + resourceCount) + logger.info("Resource list set end : " + resourceCount) } execution.setVariable("serviceResources", serviceResources.toString()) - msoLogger.info("serviceResources: " + serviceResources) + logger.info("serviceResources: " + serviceResources) String serviceResourcesShip = execution.getVariable("serviceResources") - msoLogger.info("serviceResourcesShip: " + serviceResourcesShip) + logger.info("serviceResourcesShip: " + serviceResourcesShip) if ((! isBlank(serviceResourcesShip)) && (! serviceResourcesShip.isEmpty())) { List<String> serviceResourcesList = jsonUtil.StringArrayToList(execution, serviceResourcesShip) - msoLogger.info("serviceResourcesList: " + serviceResourcesList) + logger.info("serviceResourcesList: " + serviceResourcesList) execution.setVariable(Prefix+"serviceResourceList", serviceResourcesList) execution.setVariable(Prefix+"serviceResourceCount", serviceResourcesList.size()) execution.setVariable(Prefix+"nextServiceResource", 0) - msoLogger.info("Service Resource list set end : " + serviceResourcesList.size()) + logger.info("Service Resource list set end : " + serviceResourcesList.size()) } execution.setVariable("allottedResources", allottedResources.toString()) - msoLogger.info("allottedResources: " + allottedResources) + logger.info("allottedResources: " + allottedResources) String allottedResourcesShip = execution.getVariable("allottedResources") - msoLogger.info("allottedResourcesShip: " + allottedResourcesShip) + logger.info("allottedResourcesShip: " + allottedResourcesShip) if ((! isBlank(allottedResourcesShip)) && (! allottedResourcesShip.isEmpty())) { List<String> allottedResourcesList = jsonUtil.StringArrayToList(execution, allottedResourcesShip) - msoLogger.info("allottedResourcesList: " + allottedResourcesList) + logger.info("allottedResourcesList: " + allottedResourcesList) execution.setVariable(Prefix+"allottedResourcesList", allottedResourcesList) execution.setVariable(Prefix+"allottedResourcesListCount", allottedResourcesList.size()) execution.setVariable(Prefix+"nextAllottedResourcesList", 0) - msoLogger.info("Allotted Resource list set end : " + allottedResourcesList.size()) + logger.info("Allotted Resource list set end : " + allottedResourcesList.size()) } execution.setVariable("networkResources", networkResources.toString()) - msoLogger.info("networkResources: " + networkResources) + logger.info("networkResources: " + networkResources) String networkResourcesShip = execution.getVariable("networkResources") - msoLogger.info("networkResourcesShip: " + networkResourcesShip) + logger.info("networkResourcesShip: " + networkResourcesShip) if ((! isBlank(networkResourcesShip)) && (! networkResourcesShip.isEmpty())) { List<String> networkResourcesList = jsonUtil.StringArrayToList(execution, networkResourcesShip) - msoLogger.info("networkResourcesList: " + networkResourcesList) + logger.info("networkResourcesList: " + networkResourcesList) execution.setVariable(Prefix+"networkResourcesList", networkResourcesList) execution.setVariable(Prefix+"networkResourcesListCount", networkResourcesList.size()) execution.setVariable(Prefix+"nextNetworkResourcesList", 0) - msoLogger.info("Network Resource list set end : " + networkResourcesList.size()) + logger.info("Network Resource list set end : " + networkResourcesList.size()) } } @@ -569,15 +573,15 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce throw e; } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in DeleteMobileAPNCustService flow. prepareServiceDeleteResource() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - msoLogger.info("Exited " + method) + logger.info("Exited " + method) } private Optional<AllottedResource> getAaiAr(DelegateExecution execution, String relink) { def method = getClass().getSimpleName() + '.getAaiAr(' +'execution=' + execution.getId() +')' - msoLogger.info("Entered " + method) + logger.info("Entered " + method) AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(relink).build()) return getAAIClient().get(AllottedResource.class,uri) } @@ -586,39 +590,39 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce */ public void preProcessDecomposeNextResource(DelegateExecution execution){ def method = getClass().getSimpleName() + '.getAaiAr(' +'execution=' + execution.getId() +')' - msoLogger.info("Entered " + method) - msoLogger.trace("STARTED preProcessDecomposeNextResource Process ") + logger.info("Entered " + method) + logger.trace("STARTED preProcessDecomposeNextResource Process ") try{ int resourceNum = execution.getVariable(Prefix+"nextServiceResource") List<String> serviceResourceList = execution.getVariable(Prefix+"serviceResourceList") - msoLogger.info("Service Resource List : " + serviceResourceList) + logger.info("Service Resource List : " + serviceResourceList) String serviceResource = serviceResourceList[resourceNum] execution.setVariable(Prefix+"serviceResource", serviceResource) - msoLogger.info("Current Service Resource : " + serviceResource) + logger.info("Current Service Resource : " + serviceResource) String resourceType = jsonUtil.getJsonValue(serviceResource, "resourceType") execution.setVariable("resourceType", resourceType) - msoLogger.info("resourceType : " + resourceType) + logger.info("resourceType : " + resourceType) String resourceInstanceId = jsonUtil.getJsonValue(serviceResource, "resourceInstanceId") execution.setVariable("resourceInstanceId", resourceInstanceId) - msoLogger.info("resourceInstanceId : " + resourceInstanceId) + logger.info("resourceInstanceId : " + resourceInstanceId) String resourceRole = jsonUtil.getJsonValue(serviceResource, "resourceRole") execution.setVariable("resourceRole", resourceRole) - msoLogger.info("resourceRole : " + resourceRole) + logger.info("resourceRole : " + resourceRole) String resourceVersion = jsonUtil.getJsonValue(serviceResource, "resourceVersion") execution.setVariable("resourceVersion", resourceVersion) - msoLogger.info("resourceVersion : " + resourceVersion) + logger.info("resourceVersion : " + resourceVersion) String resourceName = jsonUtil.getJsonValue(serviceResource, "resourceName") if (isBlank(resourceName)){ resourceName = resourceInstanceId } execution.setVariable(Prefix+"resourceName", resourceName) - msoLogger.info("resource Name : " + resourceName) + logger.info("resource Name : " + resourceName) execution.setVariable(Prefix+"nextServiceResource", resourceNum + 1) @@ -633,25 +637,25 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce }catch(Exception e){ // try error in method block String exceptionMessage = "Bpmn error encountered in CreateMobileAPNCustService flow. Unexpected Error from method preProcessDecomposeNextResource() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - msoLogger.info("Exited " + method) + logger.info("Exited " + method) } /** * post Decompose next resource to create request */ public void postProcessDecomposeNextResource(DelegateExecution execution){ def method = getClass().getSimpleName() + '.postProcessDecomposeNextResource(' +'execution=' + execution.getId() +')' - msoLogger.info("Entered " + method) - msoLogger.trace("STARTED postProcessDecomposeNextResource Process ") + logger.info("Entered " + method) + logger.trace("STARTED postProcessDecomposeNextResource Process ") try{ String resourceName = execution.getVariable(Prefix+"resourceName") int resourceNum = execution.getVariable(Prefix+"nextServiceResource") - msoLogger.debug("Current Resource count:"+ execution.getVariable(Prefix+"nextServiceResource")) + logger.debug("Current Resource count:"+ execution.getVariable(Prefix+"nextServiceResource")) int resourceCount = execution.getVariable(Prefix+"serviceResourceCount") - msoLogger.debug("Total Resource count:"+ execution.getVariable(Prefix+"serviceResourceCount")) + logger.debug("Total Resource count:"+ execution.getVariable(Prefix+"serviceResourceCount")) if (resourceNum < resourceCount) { execution.setVariable(Prefix+"resourceFinish", false) @@ -660,13 +664,13 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce execution.setVariable(Prefix+"resourceFinish", true) } - msoLogger.debug("Resource Finished:"+ execution.getVariable(Prefix+"resourceFinish")) + logger.debug("Resource Finished:"+ execution.getVariable(Prefix+"resourceFinish")) if (resourceCount >0 ){ int progress = (resourceNum*100) / resourceCount execution.setVariable("progress", progress.toString() ) - msoLogger.trace(":"+ execution.getVariable("")) + logger.trace(":"+ execution.getVariable("")) } execution.setVariable("operationStatus", resourceName ) @@ -674,10 +678,10 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce }catch(Exception e){ // try error in method block String exceptionMessage = "Bpmn error encountered in CreateMobileAPNCustService flow. Unexpected Error from method postProcessDecomposeNextResource() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - msoLogger.info("Exited " + method) + logger.info("Exited " + method) } /** * prepare post Unkown Resource Type @@ -685,7 +689,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce public void postOtherControllerType(DelegateExecution execution){ def method = getClass().getSimpleName() + '.postOtherControllerType(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugEnabled") - msoLogger.info("Entered " + method) + logger.info("Entered " + method) try{ @@ -694,15 +698,15 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce String controllerType = execution.getVariable("controllerType") String msg = "Resource name: "+ resourceName + " resource Type: " + resourceType+ " controller Type: " + controllerType + " can not be processed n the workflow" - msoLogger.debug(msg) + logger.debug(msg) }catch(Exception e){ // try error in method block String exceptionMessage = "Bpmn error encountered in DoCreateMobileAPNServiceInstance flow. Unexpected Error from method postOtherControllerType() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - msoLogger.info("Exited " + method) + logger.info("Exited " + method) } /** @@ -712,9 +716,9 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce // we use resource instance ids for delete flow as resourceTemplateUUIDs def method = getClass().getSimpleName() + '.preSDNCResourceDelete(' +'execution=' + execution.getId() +')' - msoLogger.info("Entered " + method) + logger.info("Entered " + method) - msoLogger.trace("STARTED preSDNCResourceDelete Process ") + logger.trace("STARTED preSDNCResourceDelete Process ") String networkResources = execution.getVariable("networkResources") @@ -730,16 +734,16 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce execution.setVariable("resourceInstanceId", resourceInstanceUUID) execution.setVariable("resourceType", resourceName) execution.setVariable("foundResource", true) - msoLogger.info("Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " + resourceInstanceUUID + " resourceType: " + resourceName) + logger.info("Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " + resourceInstanceUUID + " resourceType: " + resourceName) } } } - msoLogger.info("Exited " + method) + logger.info("Exited " + method) } public void preProcessSDNCDelete (DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessSDNCDelete(' +'execution=' + execution.getId() +')' - msoLogger.info("Entered " + method) - msoLogger.trace("preProcessSDNCDelete ") + logger.info("Entered " + method) + logger.trace("preProcessSDNCDelete ") String msg = "" try { @@ -838,50 +842,50 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") execution.setVariable("sdncDelete", sdncDelete) execution.setVariable("sdncDeactivate", sdncDeactivate) - msoLogger.info("sdncDeactivate:\n" + sdncDeactivate) - msoLogger.info("sdncDelete:\n" + sdncDelete) + logger.info("sdncDeactivate:\n" + sdncDeactivate) + logger.info("sdncDelete:\n" + sdncDelete) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCDelete. " + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception Occured in preProcessSDNCDelete.\n" + ex.getMessage()) } - msoLogger.info("Exited " + method) + logger.info("Exited " + method) } public void postProcessSDNCDelete(DelegateExecution execution, String response, String action) { def method = getClass().getSimpleName() + '.postProcessSDNCDelete(' +'execution=' + execution.getId() +')' - msoLogger.info("Entered " + method) - msoLogger.trace("postProcessSDNC " + action + " ") + logger.info("Entered " + method) + logger.trace("postProcessSDNC " + action + " ") String msg = "" /*try { WorkflowException workflowException = execution.getVariable("WorkflowException") boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - msoLogger.info("SDNCResponse: " + response) - msoLogger.info("workflowException: " + workflowException) + logger.info("SDNCResponse: " + response) + logger.info("workflowException: " + workflowException) SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) if(execution.getVariable(Prefix + 'sdncResponseSuccess') == "true"){ - msoLogger.info("Good response from SDNC Adapter for service-instance " + action + "response:\n" + response) + logger.info("Good response from SDNC Adapter for service-instance " + action + "response:\n" + response) }else{ msg = "Bad Response from SDNC Adapter for service-instance " + action - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 3500, msg) } } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in postProcessSDNC " + action + " Exception:" + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) }*/ - msoLogger.info("Exited " + method) + logger.info("Exited " + method) } /** @@ -889,7 +893,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce */ public void preUpdateServiceOperationStatus(DelegateExecution execution){ def method = getClass().getSimpleName() + '.preUpdateServiceOperationStatus(' +'execution=' + execution.getId() +')' - msoLogger.info("Entered " + method) + logger.info("Entered " + method) try{ String serviceId = execution.getVariable("serviceInstanceId") @@ -899,14 +903,14 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce String userId = "" String result = "processing" String progress = execution.getVariable("progress") - msoLogger.info("progress: " + progress ) + logger.info("progress: " + progress ) if ("100".equalsIgnoreCase(progress)) { result = "finished" } String reason = "" String operationContent = "Prepare service delete: " + execution.getVariable("operationStatus") - msoLogger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId) + logger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId) serviceId = UriUtils.encode(serviceId,"UTF-8") execution.setVariable("serviceInstanceId", serviceId) execution.setVariable("operationId", operationId) @@ -914,7 +918,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - msoLogger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint) + logger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint) String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" @@ -937,22 +941,24 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce payload = utils.formatXml(payload) execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) - msoLogger.info("Outgoing preUpdateServiceOperationStatus: \n" + payload) + logger.info("Outgoing preUpdateServiceOperationStatus: \n" + payload) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preUpdateServiceOperationStatus.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing preUpdateServiceOperationStatus.", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preUpdateServiceOperationStatus Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preUpdateServiceOperationStatus Process ") - msoLogger.info("Exited " + method) + logger.trace("COMPLETED preUpdateServiceOperationStatus Process ") + logger.info("Exited " + method) } public void preInitResourcesOperStatus(DelegateExecution execution){ def method = getClass().getSimpleName() + '.preInitResourcesOperStatus(' +'execution=' + execution.getId() +')' - msoLogger.info("Entered " + method) + logger.info("Entered " + method) - msoLogger.trace("STARTED preInitResourcesOperStatus Process ") + logger.trace("STARTED preInitResourcesOperStatus Process ") String msg="" try{ String serviceId = execution.getVariable("serviceInstanceId") @@ -963,14 +969,14 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce String progress = "0" String reason = "" String operationContent = "Prepare service delete" - msoLogger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType) + logger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType) serviceId = UriUtils.encode(serviceId,"UTF-8") execution.setVariable("serviceInstanceId", serviceId) execution.setVariable("operationId", operationId) execution.setVariable("operationType", operationType) String serviceRelationShip = execution.getVariable("serviceRelationShip") - msoLogger.info("serviceRelationShip: " + serviceRelationShip) + logger.info("serviceRelationShip: " + serviceRelationShip) if (! isBlank(serviceRelationShip)) { def jsonSlurper = new JsonSlurper() def jsonOutput = new JsonOutput() @@ -985,7 +991,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - msoLogger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint) + logger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint) String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" @@ -1003,17 +1009,17 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce payload = utils.formatXml(payload) execution.setVariable("CVFMI_initResOperStatusRequest", payload) - msoLogger.info("Outgoing initResourceOperationStatus: \n" + payload) - msoLogger.debug("DoCustomDeleteE2EServiceInstanceV2 Outgoing initResourceOperationStatus Request: " + payload) + logger.info("Outgoing initResourceOperationStatus: \n" + payload) + logger.debug("DoCustomDeleteE2EServiceInstanceV2 Outgoing initResourceOperationStatus Request: " + payload) }catch (BpmnError e) { throw e; } catch (Exception ex) { msg = "Exception in DoCustomDeleteE2EServiceInstanceV2.preInitResourcesOperStatus. " + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.info("Exited " + method) + logger.info("Exited " + method) } @@ -1025,21 +1031,21 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce // we use resource instance ids for delete flow as resourceTemplateUUIDs def method = getClass().getSimpleName() + '.preProcessVFCResourceDelete(' +'execution=' + execution.getId() +')' - msoLogger.info("Entered " + method) + logger.info("Entered " + method) - msoLogger.trace("STARTED preProcessVFCResourceDelete Process ") + logger.trace("STARTED preProcessVFCResourceDelete Process ") try{ String serviceResource = execution.getVariable("serviceResource") - msoLogger.info("serviceResource : " + serviceResource) + logger.info("serviceResource : " + serviceResource) String resourceInstanceId = execution.getVariable("resourceInstanceId") - msoLogger.info("resourceInstanceId : " + resourceInstanceId) + logger.info("resourceInstanceId : " + resourceInstanceId) execution.setVariable("resourceTemplateId", resourceInstanceId) - msoLogger.info("resourceTemplateId : " + resourceInstanceId) + logger.info("resourceTemplateId : " + resourceInstanceId) String resourceType = execution.getVariable("resourceType") - msoLogger.info("resourceType : " + resourceType) + logger.info("resourceType : " + resourceType) String resourceName = execution.getVariable(Prefix+"resourceName") @@ -1047,34 +1053,34 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce resourceName = resourceInstanceId } execution.setVariable("resourceName", resourceName) - msoLogger.info("resource Name : " + resourceName) + logger.info("resource Name : " + resourceName) - msoLogger.info("Delete Resource Info: resourceInstanceId :" + resourceInstanceId + " resourceTemplateId: " + resourceInstanceId + " resourceType: " + resourceType) + logger.info("Delete Resource Info: resourceInstanceId :" + resourceInstanceId + " resourceTemplateId: " + resourceInstanceId + " resourceType: " + resourceType) }catch (BpmnError e) { throw e; } catch (Exception ex) { msg = "Exception in DoDeleteE2EServiceInstance.preProcessVFCResourceDelete. " + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.info("Exited " + method) + logger.info("Exited " + method) } public void postProcessVFCDelete(DelegateExecution execution, String response, String action) { def method = getClass().getSimpleName() + '.postProcessVFCDelete(' +'execution=' + execution.getId() +')' - msoLogger.info("Entered " + method) + logger.info("Entered " + method) - msoLogger.trace("STARTED postProcessVFCDelete Process ") + logger.trace("STARTED postProcessVFCDelete Process ") try{ }catch (BpmnError e) { throw e; } catch (Exception ex) { msg = "Exception in DoDeleteE2EServiceInstance.postProcessVFCDelete. " + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.info("Exited " + method) + logger.info("Exited " + method) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy index 48f255bf91..f2af481f66 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 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 @@ -36,7 +38,8 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.onap.so.utils.TargetEntity import org.springframework.web.util.UriUtils import org.w3c.dom.Document @@ -76,11 +79,11 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { String Prefix="DDEESI_" ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteE2EServiceInstance.class); + private static final Logger logger = LoggerFactory.getLogger( DoDeleteE2EServiceInstance.class); public void preProcessRequest (DelegateExecution execution) { - msoLogger.debug(" ***** preProcessRequest *****") + logger.debug(" ***** preProcessRequest *****") String msg = "" try { @@ -106,18 +109,18 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { String serviceInstanceId = execution.getVariable("serviceInstanceId") if (isBlank(serviceInstanceId)){ msg = "Input serviceInstanceId is null" - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } String sdncCallbackUrl = UrnPropertiesReader.getVariable('URN_mso_workflow_sdncadapter_callback', execution) if (isBlank(sdncCallbackUrl)) { msg = "URN_mso_workflow_sdncadapter_callback is null" - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - msoLogger.info("SDNC Callback URL: " + sdncCallbackUrl) + logger.info("SDNC Callback URL: " + sdncCallbackUrl) StringBuilder sbParams = new StringBuilder() Map<String, String> paramsMap = execution.getVariable("serviceInputParams") @@ -147,14 +150,14 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.error(msg) + logger.error(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.debug("***** Exit preProcessRequest *****") + logger.debug("***** Exit preProcessRequest *****") } public void postProcessAAIGET(DelegateExecution execution) { - msoLogger.debug(" ***** postProcessAAIGET ***** ") + logger.debug(" ***** postProcessAAIGET ***** ") String msg = "" try { @@ -163,14 +166,14 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { String serviceType = "" if(foundInAAI){ - msoLogger.debug("Found Service-instance in AAI") + logger.debug("Found Service-instance in AAI") String siData = execution.getVariable("GENGS_service") - msoLogger.debug("SI Data") + logger.debug("SI Data") if (isBlank(siData)) { msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId - msoLogger.error(msg) + logger.error(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } else @@ -183,7 +186,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { // get model invariant id // Get Template uuid and version if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) { - msoLogger.debug("SI Data model-invariant-id and model-version-id exist") + logger.debug("SI Data model-invariant-id and model-version-id exist") def modelInvariantId = serviceXml.getElementsByTagName("model-invariant-id").item(0).getTextContent() def modelVersionId = serviceXml.getElementsByTagName("model-version-id").item(0).getTextContent() @@ -192,10 +195,10 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("model-version-id-original", modelVersionId) } - msoLogger.debug("SI Data" + siData) + logger.debug("SI Data" + siData) //Confirm there are no related service instances (vnf/network or volume) if (utils.nodeExists(siData, "relationship-list")) { - msoLogger.debug("SI Data relationship-list exists") + logger.debug("SI Data relationship-list exists") JSONArray jArray = new JSONArray() XmlParser xmlParser = new XmlParser() @@ -215,29 +218,29 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { }else{ boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") if(!succInAAI){ - msoLogger.debug("Error getting Service-instance from AAI :" + serviceInstanceId) + logger.debug("Error getting Service-instance from AAI :" + serviceInstanceId) WorkflowException workflowException = execution.getVariable("WorkflowException") if(workflowException != null){ - msoLogger.error("workflowException: " + workflowException) + logger.error("workflowException: " + workflowException) exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) } else { msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - msoLogger.error(msg) + logger.error(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) } } - msoLogger.debug("Service-instance NOT found in AAI. Silent Success") + logger.debug("Service-instance NOT found in AAI. Silent Success") } }catch (BpmnError e) { throw e } catch (Exception ex) { msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.debug(" *** Exit postProcessAAIGET *** ") + logger.debug(" *** Exit postProcessAAIGET *** ") } private JSONObject getRelationShipData(node, isDebugEnabled){ @@ -247,7 +250,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { def rt = utils.getNodeText(relation, "related-to") def rl = utils.getNodeText(relation, "related-link") - msoLogger.debug("ServiceInstance Related NS/Configuration :" + rl) + logger.debug("ServiceInstance Related NS/Configuration :" + rl) def rl_datas = utils.getIdenticalChildren(node, "relationship-data") for(def rl_data : rl_datas) { @@ -281,12 +284,12 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } } - msoLogger.debug("Relationship related to Resource:" + jObj.toString()) + logger.debug("Relationship related to Resource:" + jObj.toString()) return jObj } public void getCurrentNS(DelegateExecution execution){ - utils.log("INFO", "======== Start getCurrentNS Process ======== ", isDebugEnabled) + logger.info( "======== Start getCurrentNS Process ======== ") def currentIndex = execution.getVariable("currentNSIndex") List<String> nsSequence = execution.getVariable("nsSequence") @@ -297,12 +300,12 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("GENGS_serviceInstanceId", "") execution.setVariable("GENGS_serviceInstanceName", nsResourceType) - msoLogger.debug("======== COMPLETED getCurrentNS Process ======== ") + logger.debug("======== COMPLETED getCurrentNS Process ======== ") } public void prepareDecomposeService(DelegateExecution execution) { try { - msoLogger.debug(" ***** Inside prepareDecomposeService of create generic e2e service ***** ") + logger.debug(" ***** Inside prepareDecomposeService of create generic e2e service ***** ") String modelInvariantUuid = execution.getVariable("model-invariant-id-original") String modelVersionId = execution.getVariable("model-version-id-original") @@ -313,11 +316,11 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { }""" execution.setVariable("serviceModelInfo", serviceModelInfo) - msoLogger.debug(" ***** Completed prepareDecomposeService of create generic e2e service ***** ") + logger.debug(" ***** Completed prepareDecomposeService of create generic e2e service ***** ") } catch (Exception ex) { // try error in method block String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() - msoLogger.error(exceptionMessage) + logger.error(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } } @@ -336,7 +339,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { private JSONObject getRelatedResourceInAAI (DelegateExecution execution, JSONObject jObj) { - msoLogger.debug(" ***** Started getRelatedResourceInAAI *****") + logger.debug(" ***** Started getRelatedResourceInAAI *****") String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) String urlLink = jObj.get("resourceLinkUrl") @@ -349,7 +352,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { Response response = client.get() int responseCode = response.getStatus() execution.setVariable(Prefix + "GeRelatedResourceResponseCode", responseCode) - msoLogger.debug(" Get RelatedResource code is: " + responseCode) + logger.debug(" Get RelatedResource code is: " + responseCode) String aaiResponse = response.readEntity(String.class) execution.setVariable(Prefix + "GetRelatedResourceResponse", aaiResponse) @@ -358,7 +361,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) //200 OK 201 CREATED 202 ACCEPTED { - msoLogger.debug("GET RelatedResource Received a Good Response") + logger.debug("GET RelatedResource Received a Good Response") execution.setVariable(Prefix + "SuccessIndicator", true) execution.setVariable(Prefix + "FoundIndicator", true) @@ -380,16 +383,16 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } else { String exceptionMessage = "Get RelatedResource Received a Bad Response Code. Response Code is: " + responseCode - msoLogger.error(exceptionMessage) + logger.error(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - msoLogger.debug(" ***** Exit getRelatedResourceInAAI *****") + logger.debug(" ***** Exit getRelatedResourceInAAI *****") return jObj } public void postDecomposeService(DelegateExecution execution) { - msoLogger.debug(" ***** Inside processDecomposition() of delete generic e2e service flow ***** ") + logger.debug(" ***** Inside processDecomposition() of delete generic e2e service flow ***** ") try { ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") @@ -443,17 +446,17 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } execution.setVariable("isDeleteResourceListValid", isDeleteResourceListValid) - msoLogger.debug("delete resource list : " + deleteRealResourceList) + logger.debug("delete resource list : " + deleteRealResourceList) } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. processDecomposition() - " + ex.getMessage() - msoLogger.error(exceptionMessage) + logger.error(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - utils.log("DEBUG", " ***** exit processDecomposition() of delete generic e2e service flow ***** ", isDebugEnabled) + logger.debug( " ***** exit processDecomposition() of delete generic e2e service flow ***** ") } public void preInitResourcesOperStatus(DelegateExecution execution){ - msoLogger.debug(" ======== STARTED preInitResourcesOperStatus Process ======== ") + logger.debug(" ======== STARTED preInitResourcesOperStatus Process ======== ") try{ String serviceId = execution.getVariable("serviceInstanceId") String operationId = execution.getVariable("operationId") @@ -463,7 +466,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { String progress = "0" String reason = "" String operationContent = "Prepare service creation" - msoLogger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType) + logger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType) serviceId = UriUtils.encode(serviceId,"UTF-8") execution.setVariable("serviceInstanceId", serviceId) execution.setVariable("operationId", operationId) @@ -494,18 +497,18 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { payload = utils.formatXml(payload) execution.setVariable("CVFMI_initResOperStatusRequest", payload) - msoLogger.debug("Outgoing initResourceOperationStatus: \n" + payload) - msoLogger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) + logger.debug("Outgoing initResourceOperationStatus: \n" + payload) + logger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) }catch(Exception e){ - msoLogger.debug("Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e) + logger.debug("Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e) execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) } - msoLogger.debug("======== COMPLETED preInitResourcesOperStatus Process ======== ") + logger.debug("======== COMPLETED preInitResourcesOperStatus Process ======== ") } public void prepareUpdateServiceOperationStatus(DelegateExecution execution){ - msoLogger.debug(" ======== STARTED prepareUpdateServiceOperationStatus Process ======== ") + logger.debug(" ======== STARTED prepareUpdateServiceOperationStatus Process ======== ") try{ String serviceId = execution.getVariable("serviceInstanceId") String operationId = execution.getVariable("operationId") @@ -519,7 +522,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - msoLogger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint) + logger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint) String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" @@ -541,13 +544,13 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { payload = utils.formatXml(payload) execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) - msoLogger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload) + logger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload) }catch(Exception e){ - msoLogger.error("Exception Occured Processing prepareUpdateServiceOperationStatus. Exception is:\n" + e) + logger.error("Exception Occured Processing prepareUpdateServiceOperationStatus. Exception is:\n" + e) execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateServiceOperationStatus Method:\n" + e.getMessage()) } - msoLogger.debug("======== COMPLETED prepareUpdateServiceOperationStatus Process ======== ") + logger.debug("======== COMPLETED prepareUpdateServiceOperationStatus Process ======== ") } /** diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy index 67fbb97797..002e20e6d7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy @@ -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 @@ -44,6 +46,8 @@ import org.onap.so.client.graphinventory.entities.uri.Depth import org.onap.so.constants.Defaults import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils import org.onap.so.utils.TargetEntity @@ -52,7 +56,7 @@ import groovy.json.JsonOutput import javax.ws.rs.core.Response public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteNetworkInstance.class); + private static final Logger logger = LoggerFactory.getLogger( DoDeleteNetworkInstance.class); String Prefix= "DELNWKI_" String groovyClassName = "DoDeleteNetworkInstance" @@ -116,7 +120,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside preProcessRequest() of " + groovyClassName + " Request ") + logger.trace("Inside preProcessRequest() of " + groovyClassName + " Request ") // initialize flow variables InitializeProcessVariables(execution) @@ -130,12 +134,12 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { // JSON format request is sent, create xml try { def prettyJson = JsonOutput.prettyPrint(deleteNetwork.toString()) - msoLogger.debug(" Incoming message formatted . . . : " + '\n' + prettyJson) + logger.debug(" Incoming message formatted . . . : " + '\n' + prettyJson) deleteNetwork = vidUtils.createXmlNetworkRequestInfra(execution, deleteNetwork) } catch (Exception ex) { String dataErrorMessage = " Invalid json format Request - " + ex.getMessage() - msoLogger.debug(dataErrorMessage) + logger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } } else { @@ -148,14 +152,14 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } deleteNetwork = utils.formatXml(deleteNetwork) - msoLogger.debug(deleteNetwork) + logger.debug(deleteNetwork) execution.setVariable(Prefix + "networkRequest", deleteNetwork) - msoLogger.debug(Prefix + "networkRequest - " + '\n' + deleteNetwork) + logger.debug(Prefix + "networkRequest - " + '\n' + deleteNetwork) // validate 'backout-on-failure' to override 'mso.rollback' boolean rollbackEnabled = networkUtils.isRollbackEnabled(execution, deleteNetwork) execution.setVariable(Prefix + "rollbackEnabled", rollbackEnabled) - msoLogger.debug(Prefix + "rollbackEnabled - " + rollbackEnabled) + logger.debug(Prefix + "rollbackEnabled - " + rollbackEnabled) String networkInputs = utils.getNodeXml(deleteNetwork, "network-inputs", false).replace("tag0:","").replace(":tag0","") execution.setVariable(Prefix + "networkInputs", networkInputs) @@ -164,15 +168,15 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { String messageId = execution.getVariable("testMessageId") // for testing if (messageId == null || messageId == "") { messageId = UUID.randomUUID() - msoLogger.debug(Prefix + "messageId, random generated: " + messageId) + logger.debug(Prefix + "messageId, random generated: " + messageId) } else { - msoLogger.debug(Prefix + "messageId, pre-assigned: " + messageId) + logger.debug(Prefix + "messageId, pre-assigned: " + messageId) } execution.setVariable(Prefix + "messageId", messageId) String source = utils.getNodeText(deleteNetwork, "source") execution.setVariable(Prefix + "source", source) - msoLogger.debug(Prefix + "source - " + source) + logger.debug(Prefix + "source - " + source) String networkId = "" if (utils.nodeExists(networkInputs, "network-id")) { @@ -181,7 +185,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { sendSyncError(execution) // missing value of network-id String dataErrorMessage = "network-request has missing 'network-id' element/value." - msoLogger.debug(" Invalid Request - " + dataErrorMessage) + logger.debug(" Invalid Request - " + dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } } @@ -195,7 +199,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } } execution.setVariable(Prefix + "lcpCloudRegion", lcpCloudRegion) - msoLogger.debug("lcpCloudRegion : " + lcpCloudRegion) + logger.debug("lcpCloudRegion : " + lcpCloudRegion) String tenantId = null if (utils.nodeExists(networkInputs, "tenant-id")) { @@ -206,10 +210,10 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } execution.setVariable(Prefix + "tenantId", tenantId) - msoLogger.debug("tenantId : " + tenantId) + logger.debug("tenantId : " + tenantId) String sdncVersion = execution.getVariable("sdncVersion") - msoLogger.debug("sdncVersion? : " + sdncVersion) + logger.debug("sdncVersion? : " + sdncVersion) // PO Authorization Info / headers Authorization= String basicAuthValuePO = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution) @@ -221,7 +225,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } catch (IOException ex) { String dataErrorMessage = " Unable to encode PO/SDNC user/password string - " + ex.getMessage() - msoLogger.debug(dataErrorMessage ) + logger.debug(dataErrorMessage ) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } @@ -231,7 +235,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } catch (Exception ex){ // caught exception String exceptionMessage = "Exception Encountered in DoDeleteNetworkInstance, PreProcessRequest() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -243,7 +247,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.debug(" ***** Inside callRESTQueryAAI() of DoDoDeleteNetworkInstance ***** " ) + logger.debug(" ***** Inside callRESTQueryAAI() of DoDoDeleteNetworkInstance ***** " ) // get variables String networkInputs = execution.getVariable(Prefix + "networkInputs") @@ -273,7 +277,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { if(execution.getVariable(Prefix + "tenantId") == null) { String tenantId = tenantURI.getURIKeys().get("tenant-id") execution.setVariable(Prefix + "tenantId", tenantId) - msoLogger.debug(" Get AAI getTenantId() : " + tenantId) + logger.debug(" Get AAI getTenantId() : " + tenantId) } } List<AAIResourceUri> cloudRegionURIList = relationships.get().getRelatedAAIUris(AAIObjectType.CLOUD_REGION) @@ -281,24 +285,24 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { if(execution.getVariable(Prefix + "lcpCloudRegion") == null) { String lcpCloudRegion = tenantURI.getURIKeys().get("cloud-region-id") execution.setVariable(Prefix + "lcpCloudRegion", lcpCloudRegion) - msoLogger.debug(" Get AAI getCloudRegion() : " + lcpCloudRegion) + logger.debug(" Get AAI getCloudRegion() : " + lcpCloudRegion) } } } } - msoLogger.debug(Prefix + "isVfRelationshipExist - " + isVfRelationshipExist) + logger.debug(Prefix + "isVfRelationshipExist - " + isVfRelationshipExist) } else { // not found // empty aai response execution.setVariable(Prefix + "aaiReturnCode", 404) execution.setVariable(Prefix + "isAAIGood", false) execution.setVariable(Prefix + "isSilentSuccess", true) - msoLogger.debug(" AAI Query is Silent Success") + logger.debug(" AAI Query is Silent Success") } - msoLogger.debug(" AAI Query call, isAAIGood? : " + execution.getVariable(Prefix + "isAAIGood")) + logger.debug(" AAI Query call, isAAIGood? : " + execution.getVariable(Prefix + "isAAIGood")) } catch (Exception ex) { // caught exception String exceptionMessage = "Exception Encountered in DoDeleteNetworkInstance, callRESTQueryAAI() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -309,7 +313,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) - msoLogger.debug(" ***** Inside callRESTQueryAAICloudRegion of DoDeleteNetworkInstance ***** " ) + logger.debug(" ***** Inside callRESTQueryAAICloudRegion of DoDeleteNetworkInstance ***** " ) try { String networkInputs = execution.getVariable(Prefix + "networkInputs") @@ -332,7 +336,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } else { String dataErrorMessage = "QueryAAICloudRegion Unsuccessful. Return Code: " + execution.getVariable(Prefix + "queryCloudRegionReturnCode") - msoLogger.debug(dataErrorMessage) + logger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } @@ -343,7 +347,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } catch (Exception ex) { // caught exception String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, callRESTQueryAAICloudRegion(). Unexpected Response from AAI - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -354,7 +358,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) - msoLogger.trace("Inside prepareNetworkRequest of DoDeleteNetworkInstance ") + logger.trace("Inside prepareNetworkRequest of DoDeleteNetworkInstance ") ExceptionUtil exceptionUtil = new ExceptionUtil() try { // get variables @@ -411,23 +415,23 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { </deleteNetworkRequest> """.trim() - msoLogger.debug(Prefix + "deleteNetworkRequest - " + "\n" + deleteNetworkRequest) + logger.debug(Prefix + "deleteNetworkRequest - " + "\n" + deleteNetworkRequest) // Format Response String buildDeleteNetworkRequestAsString = utils.formatXml(deleteNetworkRequest) - msoLogger.debug(buildDeleteNetworkRequestAsString) - msoLogger.debug(Prefix + "deleteNetworkRequestAsString - " + "\n" + buildDeleteNetworkRequestAsString) + logger.debug(buildDeleteNetworkRequestAsString) + logger.debug(Prefix + "deleteNetworkRequestAsString - " + "\n" + buildDeleteNetworkRequestAsString) String restURL = UrnPropertiesReader.getVariable("mso.adapters.network.rest.endpoint", execution) execution.setVariable("mso.adapters.network.rest.endpoint", restURL + "/" + networkId) - msoLogger.debug("mso.adapters.network.rest.endpoint - " + "\n" + restURL + "/" + networkId) + logger.debug("mso.adapters.network.rest.endpoint - " + "\n" + restURL + "/" + networkId) execution.setVariable(Prefix + "deleteNetworkRequest", buildDeleteNetworkRequestAsString) - msoLogger.debug(Prefix + "deleteNetworkRequest - " + "\n" + buildDeleteNetworkRequestAsString) + logger.debug(Prefix + "deleteNetworkRequest - " + "\n" + buildDeleteNetworkRequestAsString) } catch (Exception ex) { // caught exception String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareNetworkRequest(). Unexpected Response from AAI - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -442,7 +446,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { @@ -461,8 +465,10 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } catch (Exception ex) { // caught exception String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, sendRequestToVnfAdapter() - " + ex.getMessage() - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, exceptionMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex); - msoLogger.debug(exceptionMessage) + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage, + "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), + "Exception is:\n" + ex); + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -473,7 +479,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) - msoLogger.trace("Inside prepareSDNCRequest of DoDeleteNetworkInstance ") + logger.trace("Inside prepareSDNCRequest of DoDeleteNetworkInstance ") try { // get variables @@ -496,7 +502,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { requestId = execution.getVariable("mso-request-id") } execution.setVariable(Prefix + "requestId", requestId) - msoLogger.debug(Prefix + "requestId " + requestId) + logger.debug(Prefix + "requestId " + requestId) L3Network queryAAIResponse = execution.getVariable(Prefix + "queryAAIResponse") SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() @@ -504,15 +510,17 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { // 1. prepare delete topology via SDNC Adapter SUBFLOW call String sndcTopologyDeleteRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "delete", "DisconnectNetworkRequest", cloudRegionId, networkId, queryAAIResponse, null) String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest) - msoLogger.debug(sndcTopologyDeleteRequesAsString) + logger.debug(sndcTopologyDeleteRequesAsString) execution.setVariable(Prefix + "deleteSDNCRequest", sndcTopologyDeleteRequesAsString) - msoLogger.debug(Prefix + "deleteSDNCRequest - " + "\n" + sndcTopologyDeleteRequesAsString) + logger.debug(Prefix + "deleteSDNCRequest - " + "\n" + sndcTopologyDeleteRequesAsString) } catch (Exception ex) { // caught exception String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRequest() - " + ex.getMessage() - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, exceptionMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex); - msoLogger.debug(exceptionMessage) + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage, + "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), + "Exception is:\n" + ex); + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -523,7 +531,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) - msoLogger.trace("Inside prepareRpcSDNCRequest of DoDeleteNetworkInstance ") + logger.trace("Inside prepareRpcSDNCRequest of DoDeleteNetworkInstance ") try { // get variables @@ -543,15 +551,17 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { // 1. prepare delete topology via SDNC Adapter SUBFLOW call String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "unassign", "DeleteNetworkInstance", cloudRegionId, networkId, null) String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyRollbackRpcRequest) - msoLogger.debug(sndcTopologyDeleteRequesAsString) + logger.debug(sndcTopologyDeleteRequesAsString) execution.setVariable(Prefix + "deleteSDNCRequest", sndcTopologyDeleteRequesAsString) - msoLogger.debug(Prefix + "deleteSDNCRequest - " + "\n" + sndcTopologyDeleteRequesAsString) + logger.debug(Prefix + "deleteSDNCRequest - " + "\n" + sndcTopologyDeleteRequesAsString) } catch (Exception ex) { // caught exception String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRequest() - " + ex.getMessage() - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, exceptionMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex); - msoLogger.debug(exceptionMessage) + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage, + "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), + "Exception is:\n" + ex); + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -563,7 +573,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside prepareRpcSDNCDeactivate() of DoDeleteNetworkInstance ") + logger.trace("Inside prepareRpcSDNCDeactivate() of DoDeleteNetworkInstance ") try { @@ -581,12 +591,12 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "deactivate", "DeleteNetworkInstance", cloudRegionId, networkId, null) String sndcTopologyRollbackRpcRequestAsString = utils.formatXml(sndcTopologyRollbackRpcRequest) execution.setVariable(Prefix + "deactivateSDNCRequest", sndcTopologyRollbackRpcRequestAsString) - msoLogger.debug(" Preparing request for RPC SDNC Topology deactivate - " + "\n" + sndcTopologyRollbackRpcRequestAsString) + logger.debug(" Preparing request for RPC SDNC Topology deactivate - " + "\n" + sndcTopologyRollbackRpcRequestAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareRpcSDNCActivateRollback() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) } @@ -601,24 +611,24 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) - msoLogger.trace("Inside validateNetworkResponse of DoDeleteNetworkInstance ") + logger.trace("Inside validateNetworkResponse of DoDeleteNetworkInstance ") try { String returnCode = execution.getVariable(Prefix + "networkReturnCode") String networkResponse = execution.getVariable(Prefix + "deleteNetworkResponse") - msoLogger.debug(" Network Adapter responseCode: " + returnCode) - msoLogger.debug("Network Adapter Response - " + "\n" + networkResponse) - msoLogger.debug(networkResponse) + logger.debug(" Network Adapter responseCode: " + returnCode) + logger.debug("Network Adapter Response - " + "\n" + networkResponse) + logger.debug(networkResponse) String errorMessage = "" if (returnCode == "200") { - msoLogger.debug(" Network Adapter Response is successful - " + "\n" + networkResponse) + logger.debug(" Network Adapter Response is successful - " + "\n" + networkResponse) // prepare rollback data String rollbackData = utils.getNodeXml(networkResponse, "rollback", false).replace("tag0:","").replace(":tag0","") if ((rollbackData == null) || (rollbackData.isEmpty())) { - msoLogger.debug(" Network Adapter 'rollback' data is not Sent: " + "\n" + networkResponse) + logger.debug(" Network Adapter 'rollback' data is not Sent: " + "\n" + networkResponse) execution.setVariable(Prefix + "rollbackNetworkRequest", "") } else { String rollbackNetwork = @@ -627,7 +637,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { </NetworkAdapter:rollbackNetwork>""" String rollbackNetworkXml = utils.formatXml(rollbackNetwork) execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkXml) - msoLogger.debug(" Network Adapter rollback data - " + "\n" + rollbackNetworkXml) + logger.debug(" Network Adapter rollback data - " + "\n" + rollbackNetworkXml) } @@ -664,7 +674,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } catch (Exception ex) { // caught exception String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, validateNetworkResponse() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -675,7 +685,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) - msoLogger.trace("Inside validateSDNCResponse of DoDeleteNetworkInstance ") + logger.trace("Inside validateSDNCResponse of DoDeleteNetworkInstance ") String response = execution.getVariable(Prefix + "deleteSDNCResponse") boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") @@ -691,9 +701,9 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { if (execution.getVariable(Prefix + "sdncResponseSuccess") == true) { // from sdnc util, prefix+'sdncResponseSuccess' execution.setVariable(Prefix + "isSdncRollbackNeeded", true) // execution.setVariable(Prefix + "isPONR", true) - msoLogger.debug("Successfully Validated SDNC Response") + logger.debug("Successfully Validated SDNC Response") } else { - msoLogger.debug("Did NOT Successfully Validated SDNC Response") + logger.debug("Did NOT Successfully Validated SDNC Response") throw new BpmnError("MSOWorkflowException") } @@ -703,7 +713,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside validateRpcSDNCDeactivateResponse() of DoDeleteNetworkInstance ") + logger.trace("Inside validateRpcSDNCDeactivateResponse() of DoDeleteNetworkInstance ") String response = execution.getVariable(Prefix + "deactivateSDNCResponse") boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") @@ -718,10 +728,10 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { if (execution.getVariable(Prefix + "sdncResponseSuccess") == true) { // from sdnc util, Prefix+'sdncResponseSuccess' execution.setVariable(Prefix + "isSdncDeactivateRollbackNeeded", true) - msoLogger.debug("Successfully Validated Rpc SDNC Activate Response") + logger.debug("Successfully Validated Rpc SDNC Activate Response") } else { - msoLogger.debug("Did NOT Successfully Validated Rpc SDNC Deactivate Response") + logger.debug("Did NOT Successfully Validated Rpc SDNC Deactivate Response") throw new BpmnError("MSOWorkflowException") } @@ -731,7 +741,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside prepareRpcSDNCDeactivateRollback() of DoDeleteNetworkInstance ") + logger.trace("Inside prepareRpcSDNCDeactivateRollback() of DoDeleteNetworkInstance ") try { @@ -748,12 +758,12 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "activate", "CreateNetworkInstance", cloudRegionId, networkId, null) String sndcTopologyRollbackRpcRequestAsString = utils.formatXml(sndcTopologyRollbackRpcRequest) execution.setVariable(Prefix + "rollbackDeactivateSDNCRequest", sndcTopologyRollbackRpcRequestAsString) - msoLogger.debug(" Preparing request for RPC SDNC Topology 'activate-CreateNetworkInstance' rollback . . . - " + "\n" + sndcTopologyRollbackRpcRequestAsString) + logger.debug(" Preparing request for RPC SDNC Topology 'activate-CreateNetworkInstance' rollback . . . - " + "\n" + sndcTopologyRollbackRpcRequestAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareRpcSDNCDeactivateRollback() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) } @@ -764,7 +774,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside prepareRollbackData() of DoDeleteNetworkInstance ") + logger.trace("Inside prepareRollbackData() of DoDeleteNetworkInstance ") try { @@ -782,14 +792,14 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } } execution.setVariable("rollbackData", rollbackData) - msoLogger.debug("** rollbackData : " + rollbackData) + logger.debug("** rollbackData : " + rollbackData) execution.setVariable("WorkflowException", execution.getVariable("WorkflowException")) - msoLogger.debug("** WorkflowException : " + execution.getVariable("WorkflowException")) + logger.debug("** WorkflowException : " + execution.getVariable("WorkflowException")) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareRollbackData() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) } @@ -800,11 +810,11 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) - msoLogger.trace("Inside postProcessResponse of DoDeleteNetworkInstance ") + logger.trace("Inside postProcessResponse of DoDeleteNetworkInstance ") try { - msoLogger.debug(" ***** Is Exception Encountered (isException)? : " + execution.getVariable(Prefix + "isException")) + logger.debug(" ***** Is Exception Encountered (isException)? : " + execution.getVariable(Prefix + "isException")) if (execution.getVariable(Prefix + "isException") == false) { execution.setVariable(Prefix + "Success", true) execution.setVariable("WorkflowException", null) @@ -820,7 +830,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("rollbackData", null) String exceptionMessage = " Exception encountered in MSO Bpmn. " if (execution.getVariable("workflowException") != null) { // Output of Rollback flow. - msoLogger.debug(" ***** workflowException: " + execution.getVariable("workflowException")) + logger.debug(" ***** workflowException: " + execution.getVariable("workflowException")) WorkflowException wfex = execution.getVariable("workflowException") exceptionMessage = wfex.getErrorMessage() } else { @@ -836,20 +846,20 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } // going to the Main flow: a-la-carte or macro - msoLogger.debug(" ***** postProcessResponse(), BAD !!!") + logger.debug(" ***** postProcessResponse(), BAD !!!") exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) throw new BpmnError("MSOWorkflowException") } } catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") + logger.debug("Rethrowing MSOWorkflowException") throw b } catch (Exception ex) { // caught exception String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, postProcessResponse() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) throw new BpmnError("MSOWorkflowException") @@ -861,7 +871,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside prepareSuccessRollbackData() of DoDeleteNetworkInstance ") + logger.trace("Inside prepareSuccessRollbackData() of DoDeleteNetworkInstance ") try { @@ -893,13 +903,13 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } execution.setVariable("rollbackData", rollbackData) - msoLogger.debug("** rollbackData : " + rollbackData) + logger.debug("** rollbackData : " + rollbackData) execution.setVariable("WorkflowException", null) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareSuccessRollbackData() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) } @@ -910,7 +920,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside prepareRpcSDNCUnassignRollbac() of DoDeleteNetworkInstance ") + logger.trace("Inside prepareRpcSDNCUnassignRollbac() of DoDeleteNetworkInstance ") try { @@ -928,15 +938,15 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { // 1. prepare delete topology via SDNC Adapter SUBFLOW call String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "assign", "CreateNetworkInstance", cloudRegionId, networkId, null) String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyRollbackRpcRequest) - msoLogger.debug(sndcTopologyDeleteRequesAsString) + logger.debug(sndcTopologyDeleteRequesAsString) execution.setVariable(Prefix + "rollbackSDNCRequest", sndcTopologyDeleteRequesAsString) - msoLogger.debug(Prefix + "rollbackSDNCRequest" + "\n" + sndcTopologyDeleteRequesAsString) - msoLogger.debug(" Preparing request for RPC SDNC Topology 'assign-CreateNetworkInstance' rollback . . . - " + "\n" + sndcTopologyDeleteRequesAsString) + logger.debug(Prefix + "rollbackSDNCRequest" + "\n" + sndcTopologyDeleteRequesAsString) + logger.debug(" Preparing request for RPC SDNC Topology 'assign-CreateNetworkInstance' rollback . . . - " + "\n" + sndcTopologyDeleteRequesAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareRpcSDNCUnassignRollback() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) } @@ -947,7 +957,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) - msoLogger.trace("Inside prepareSDNCRollback of DoDeleteNetworkInstance ") + logger.trace("Inside prepareSDNCRollback of DoDeleteNetworkInstance ") try { @@ -979,17 +989,19 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { // 1. prepare delete topology via SDNC Adapter SUBFLOW call String sndcTopologyDeleteRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "rollback", "DisconnectNetworkRequest", cloudRegionId, networkId, queryAAIResponse, null) String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest) - msoLogger.debug(sndcTopologyDeleteRequesAsString) + logger.debug(sndcTopologyDeleteRequesAsString) execution.setVariable(Prefix + "rollbackSDNCRequest", sndcTopologyDeleteRequesAsString) - msoLogger.debug(Prefix + "rollbackSDNCRequest - " + "\n" + sndcTopologyDeleteRequesAsString) - msoLogger.debug(" Preparing request for RPC SDNC Topology 'rollback-DisconnectNetworkRequest' rollback . . . - " + "\n" + sndcTopologyDeleteRequesAsString) + logger.debug(Prefix + "rollbackSDNCRequest - " + "\n" + sndcTopologyDeleteRequesAsString) + logger.debug(" Preparing request for RPC SDNC Topology 'rollback-DisconnectNetworkRequest' rollback . . . - " + "\n" + sndcTopologyDeleteRequesAsString) } catch (Exception ex) { // caught exception String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRollback() - " + ex.getMessage() - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, exceptionMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex); - msoLogger.debug(exceptionMessage) + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage, + "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), + "Exception is:\n" + ex); + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -1000,7 +1012,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside setExceptionFlag() of DoDeleteNetworkInstance ") + logger.trace("Inside setExceptionFlag() of DoDeleteNetworkInstance ") try { @@ -1011,11 +1023,11 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } else { execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) } - msoLogger.debug(Prefix + "WorkflowException - " +execution.getVariable(Prefix + "WorkflowException")) + logger.debug(Prefix + "WorkflowException - " +execution.getVariable(Prefix + "WorkflowException")) } catch(Exception ex){ String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance flow. setExceptionFlag(): " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) } @@ -1030,18 +1042,18 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) try{ - msoLogger.debug("Caught a Java Exception") - msoLogger.debug("Started processJavaException Method") - msoLogger.debug("Variables List: " + execution.getVariables()) + logger.debug("Caught a Java Exception") + logger.debug("Started processJavaException Method") + logger.debug("Variables List: " + execution.getVariables()) execution.setVariable("UnexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") }catch(Exception e){ - msoLogger.debug("Caught Exception during processJavaException Method: " + e) + logger.debug("Caught Exception during processJavaException Method: " + e) execution.setVariable("UnexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method") } - msoLogger.debug("Completed processJavaException Method of " + Prefix) + logger.debug("Completed processJavaException Method of " + Prefix) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy index 1db7475cba..d09fb03445 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy @@ -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 @@ -40,15 +42,15 @@ import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; import org.springframework.web.util.UriUtils -import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory /** * This groovy class supports the <class>DoCreateNetworkInstanceRollback.bpmn</class> process. * */ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteNetworkInstanceRollback.class); + private static final Logger logger = LoggerFactory.getLogger( DoDeleteNetworkInstanceRollback.class); String Prefix="DELNWKIR_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -96,7 +98,7 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside preProcessRequest() of " + className + ".groovy ") + logger.trace("Inside preProcessRequest() of " + className + ".groovy ") try { // initialize flow variables @@ -126,10 +128,10 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkRequest) execution.setVariable(Prefix + "rollbackSDNCRequest", rollbackSDNCRequest) execution.setVariable(Prefix + "rollbackDeactivateSDNCRequest", rollbackDeactivateSDNCRequest) - msoLogger.debug("'rollbackData': " + '\n' + execution.getVariable("rollbackData")) + logger.debug("'rollbackData': " + '\n' + execution.getVariable("rollbackData")) String sdncVersion = execution.getVariable("sdncVersion") - msoLogger.debug("sdncVersion? : " + sdncVersion) + logger.debug("sdncVersion? : " + sdncVersion) // PO Authorization Info / headers Authorization= String basicAuthValuePO = UrnPropertiesReader.getVariable("mso.adapters.po.auth",execution) @@ -141,7 +143,7 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso } catch (IOException ex) { String exceptionMessage = "Exception Encountered in DoCreateNetworkInstance, PreProcessRequest() - " String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage() - msoLogger.debug(dataErrorMessage ) + logger.debug(dataErrorMessage ) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } @@ -150,7 +152,7 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso } else { execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) } - msoLogger.debug("*** WorkflowException : " + execution.getVariable(Prefix + "WorkflowException")) + logger.debug("*** WorkflowException : " + execution.getVariable(Prefix + "WorkflowException")) if(execution.getVariable(Prefix + "WorkflowException") != null) { // called by: DoCreateNetworkInstance, partial rollback execution.setVariable(Prefix + "fullRollback", false) @@ -161,7 +163,7 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso } - msoLogger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback")) + logger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback")) } catch (BpmnError e) { throw e; @@ -170,7 +172,7 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso sendSyncError(execution) // caught exception String exceptionMessage = "Exception Encountered in PreProcessRequest() of " + className + ".groovy ***** : " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -181,7 +183,7 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside validateRollbackResponses() of DoDeleteNetworkInstanceRollback ") + logger.trace("Inside validateRollbackResponses() of DoDeleteNetworkInstanceRollback ") try { @@ -207,8 +209,8 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso } else { rollbackDeactivateSDNCMessages = " + SDNC deactivate rollback failed. " } - msoLogger.debug(" SDNC deactivate rollback Code - " + rollbackDeactivateSDNCReturnCode) - msoLogger.debug(" SDNC deactivate rollback Response - " + rollbackDeactivateSDNCResponse) + logger.debug(" SDNC deactivate rollback Code - " + rollbackDeactivateSDNCReturnCode) + logger.debug(" SDNC deactivate rollback Response - " + rollbackDeactivateSDNCResponse) } // validate SDNC rollback response @@ -234,8 +236,8 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso } else { rollbackSdncErrorMessages = " + SDNC unassign rollback failed. " } - msoLogger.debug(" SDNC assign rollback Code - " + rollbackSDNCReturnCode) - msoLogger.debug(" SDNC assign rollback Response - " + rollbackSDNCResponse) + logger.debug(" SDNC assign rollback Code - " + rollbackSDNCReturnCode) + logger.debug(" SDNC assign rollback Response - " + rollbackSDNCResponse) } // validate PO network rollback response @@ -250,13 +252,13 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso rollbackNetworkErrorMessages = " + PO Network rollback completed." } - msoLogger.debug(" NetworkRollback Code - " + rollbackNetworkReturnCode) - msoLogger.debug(" NetworkRollback Response - " + rollbackNetworkResponse) + logger.debug(" NetworkRollback Code - " + rollbackNetworkReturnCode) + logger.debug(" NetworkRollback Response - " + rollbackNetworkResponse) } String statusMessage = "" int errorCode = 7000 - msoLogger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback")) + logger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback")) if (execution.getVariable(Prefix + "fullRollback") == false) { WorkflowException wfe = execution.getVariable(Prefix + "WorkflowException") // original WorkflowException if (wfe != null) { @@ -278,7 +280,7 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso } statusMessage = statusMessage + rollbackDeactivateSDNCMessages + rollbackNetworkErrorMessages + rollbackSdncErrorMessages - msoLogger.debug("Final DoDeleteNetworkInstanceRollback status message: " + statusMessage) + logger.debug("Final DoDeleteNetworkInstanceRollback status message: " + statusMessage) String processKey = getProcessKey(execution); WorkflowException exception = new WorkflowException(processKey, errorCode, statusMessage); execution.setVariable("workflowException", exception); @@ -290,7 +292,7 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso execution.setVariable("rollbackError", false) } else { String exceptionMessage = "Network Delete Rollback was not Successful. " - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) execution.setVariable("rollbackSuccessful", false) execution.setVariable("rollbackError", true) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) @@ -301,7 +303,7 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso } catch (Exception ex) { String errorMessage = "See Previous Camunda flows for cause of Error: Undetermined Exception." String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstanceRollback flow. validateRollbackResponses() - " + errorMessage + ": " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) } @@ -319,18 +321,18 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso execution.setVariable("prefix",Prefix) try{ - msoLogger.debug("Caught a Java Exception in " + Prefix) - msoLogger.debug("Started processJavaException Method") - msoLogger.debug("Variables List: " + execution.getVariables()) + logger.debug("Caught a Java Exception in " + Prefix) + logger.debug("Started processJavaException Method") + logger.debug("Variables List: " + execution.getVariables()) execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") }catch(Exception e){ - msoLogger.debug("Caught Exception during processJavaException Method: " + e) + logger.debug("Caught Exception during processJavaException Method: " + e) execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix) } - msoLogger.debug("Completed processJavaException Method in " + Prefix) + logger.debug("Completed processJavaException Method in " + Prefix) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy index 6a31095920..7e194657fb 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy @@ -5,6 +5,8 @@ * ================================================================================ * Copyright (C) 2018 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 @@ -43,7 +45,8 @@ import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.infrastructure.properties.BPMNProperties -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory /** * input for script : @@ -62,7 +65,7 @@ import org.onap.so.logger.MsoLogger */ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteResourcesV1.class); + private static final Logger logger = LoggerFactory.getLogger( DoDeleteResourcesV1.class); String Prefix="DDR_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -70,7 +73,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create() public void preProcessRequest (DelegateExecution execution) { - msoLogger.debug(" ***** preProcessRequest *****") + logger.debug(" ***** preProcessRequest *****") String msg = "" try { @@ -95,18 +98,18 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { String serviceInstanceId = execution.getVariable("serviceInstanceId") if (isBlank(serviceInstanceId)){ msg = "Input serviceInstanceId is null" - msoLogger.error(msg) + logger.error(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } String sdncCallbackUrl = UrnPropertiesReader.getVariable('URN_mso_workflow_sdncadapter_callback', execution) if (isBlank(sdncCallbackUrl)) { msg = "URN_mso_workflow_sdncadapter_callback is null" - msoLogger.error(msg) + logger.error(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl) + logger.debug("SDNC Callback URL: " + sdncCallbackUrl) StringBuilder sbParams = new StringBuilder() Map<String, String> paramsMap = execution.getVariable("serviceInputParams") @@ -136,14 +139,14 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.error(msg) + logger.error(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.debug(" ***** Exit preProcessRequest *****",) + logger.debug(" ***** Exit preProcessRequest *****",) } public void sequenceResource(DelegateExecution execution){ - msoLogger.debug(" ======== STARTED sequenceResource Process ======== ") + logger.debug(" ======== STARTED sequenceResource Process ======== ") List<Resource> sequencedResourceList = new ArrayList<Resource>() List<Resource> wanResources = new ArrayList<Resource>() @@ -196,15 +199,15 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { execution.setVariable("isContainsWanResource", isContainsWanResource) execution.setVariable("currentResourceIndex", 0) execution.setVariable("sequencedResourceList", sequencedResourceList) - msoLogger.debug("resourceSequence: " + resourceSequence) - msoLogger.debug(" ======== END sequenceResource Process ======== ") + logger.debug("resourceSequence: " + resourceSequence) + logger.debug(" ======== END sequenceResource Process ======== ") } /** * prepare delete parameters */ public void preResourceDelete(DelegateExecution execution){ - msoLogger.debug(" ======== STARTED preResourceDelete Process ======== ") + logger.debug(" ======== STARTED preResourceDelete Process ======== ") List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") @@ -216,14 +219,14 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { String resourceTemplateUUID = curResource.getModelInfo().getModelUuid() execution.setVariable("resourceInstanceId", resourceInstanceUUID) execution.setVariable("currentResource", curResource) - msoLogger.debug("Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " + logger.debug("Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " + resourceInstanceUUID + " resourceModelName: " + curResource.getModelInfo().getModelName()) } else { execution.setVariable("resourceInstanceId", "") } - msoLogger.debug(" ======== END preResourceDelete Process ======== ") + logger.debug(" ======== END preResourceDelete Process ======== ") } @@ -231,7 +234,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { * Execute delete workflow for resource */ public void executeResourceDelete(DelegateExecution execution) { - msoLogger.debug("======== Start executeResourceDelete Process ======== ") + logger.debug("======== Start executeResourceDelete Process ======== ") try { String requestId = execution.getVariable("msoRequestId") String serviceInstanceId = execution.getVariable("serviceInstanceId") @@ -263,19 +266,19 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + recipeUri HttpResponse resp = BpmnRestClient.post(recipeURL, requestId, recipeTimeout, action, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) - msoLogger.debug(" ======== END executeResourceDelete Process ======== ") + logger.debug(" ======== END executeResourceDelete Process ======== ") }catch(BpmnError b){ - msoLogger.error("Rethrowing MSOWorkflowException") + logger.error("Rethrowing MSOWorkflowException") throw b }catch(Exception e){ - msoLogger.error("Error occured within DoDeleteResourcesV1 executeResourceDelete method: " + e) + logger.error("Error occured within DoDeleteResourcesV1 executeResourceDelete method: " + e) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured during DoDeleteResourcesV1 executeResourceDelete Catalog") } } public void parseNextResource(DelegateExecution execution){ - msoLogger.debug("======== Start parseNextResource Process ======== ") + logger.debug("======== Start parseNextResource Process ======== ") def currentIndex = execution.getVariable("currentResourceIndex") def nextIndex = currentIndex + 1 execution.setVariable("currentResourceIndex", nextIndex) @@ -285,7 +288,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { }else{ execution.setVariable("allResourceFinished", "false") } - msoLogger.debug("======== COMPLETED parseNextResource Process ======== ") + logger.debug("======== COMPLETED parseNextResource Process ======== ") } public void prepareFinishedProgressForResource(DelegateExecution execution) { @@ -333,7 +336,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { } public void prepareSDNCServiceRequest (DelegateExecution execution, String svcAction) { - msoLogger.debug(" ***** Started prepareSDNCServiceRequest for " + svcAction + "*****") + logger.debug(" ***** Started prepareSDNCServiceRequest for " + svcAction + "*****") try { // get variables @@ -391,16 +394,16 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { </aetgt:SDNCAdapterWorkflowRequest>""".trim() String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest) - msoLogger.debug(sndcTopologyDeleteRequesAsString) + logger.debug(sndcTopologyDeleteRequesAsString) execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyDeleteRequesAsString) - msoLogger.debug("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyDeleteRequesAsString) + logger.debug("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyDeleteRequesAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoDeleteResourcesV1 flow. prepareSDNCServiceRequest() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - msoLogger.debug("***** Exit prepareSDNCServiceRequest for " + svcAction + "*****") + logger.debug("***** Exit prepareSDNCServiceRequest for " + svcAction + "*****") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy index eb736f8ffe..2e1cca54a6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy @@ -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 @@ -38,7 +40,8 @@ import org.onap.so.client.aai.AAIResourcesClient 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.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils; import groovy.json.* @@ -65,7 +68,7 @@ import groovy.json.* * Rollback - Deferred */ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteServiceInstance.class); + private static final Logger logger = LoggerFactory.getLogger( DoDeleteServiceInstance.class); String Prefix="DDELSI_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -73,7 +76,7 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { public void preProcessRequest (DelegateExecution execution) { - msoLogger.trace("preProcessRequest ") + logger.trace("preProcessRequest ") String msg = "" try { @@ -99,18 +102,18 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { String serviceInstanceId = execution.getVariable("serviceInstanceId") if (isBlank(serviceInstanceId)){ msg = "Input serviceInstanceId is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } String sdncCallbackUrl = UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback',execution) if (isBlank(sdncCallbackUrl)) { msg = "mso.workflow.sdncadapter.callback is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl) + logger.debug("SDNC Callback URL: " + sdncCallbackUrl) StringBuilder sbParams = new StringBuilder() Map<String, String> paramsMap = execution.getVariable("serviceInputParams") @@ -140,15 +143,15 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit preProcessRequest ") + logger.trace("Exit preProcessRequest ") } public void preProcessSDNCDelete (DelegateExecution execution) { - msoLogger.trace("preProcessSDNCDelete ") + logger.trace("preProcessSDNCDelete ") String msg = "" try { @@ -230,57 +233,57 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") execution.setVariable("sdncDelete", sdncDelete) execution.setVariable("sdncDeactivate", sdncDeactivate) - msoLogger.debug("sdncDeactivate:\n" + sdncDeactivate) - msoLogger.debug("sdncDelete:\n" + sdncDelete) + logger.debug("sdncDeactivate:\n" + sdncDeactivate) + logger.debug("sdncDelete:\n" + sdncDelete) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCDelete. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception Occured in preProcessSDNCDelete.\n" + ex.getMessage()) } - msoLogger.debug(" *****Exit preProcessSDNCDelete *****") + logger.debug(" *****Exit preProcessSDNCDelete *****") } public void postProcessSDNCDelete(DelegateExecution execution, String response, String method) { - msoLogger.trace("postProcessSDNC " + method + " ") + logger.trace("postProcessSDNC " + method + " ") String msg = "" try { WorkflowException workflowException = execution.getVariable("WorkflowException") boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - msoLogger.debug("SDNCResponse: " + response) - msoLogger.debug("workflowException: " + workflowException) + logger.debug("SDNCResponse: " + response) + logger.debug("workflowException: " + workflowException) SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - msoLogger.debug("Good response from SDNC Adapter for service-instance " + method + "response:\n" + response) + logger.debug("Good response from SDNC Adapter for service-instance " + method + "response:\n" + response) }else{ msg = "Bad Response from SDNC Adapter for service-instance " + method - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 3500, msg) } } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in postProcessSDNC " + method + " Exception:" + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit postProcessSDNC " + method + " ") + logger.trace("Exit postProcessSDNC " + method + " ") } /** * Gets the service instance uri from aai */ public void getServiceInstance(DelegateExecution execution) { - msoLogger.trace("getServiceInstance ") + logger.trace("getServiceInstance ") try { String serviceInstanceId = execution.getVariable('serviceInstanceId') @@ -343,7 +346,7 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { }else{ execution.setVariable("siInUse", true) - msoLogger.debug("Stopped deleting Service Instance, it has dependencies") + logger.debug("Stopped deleting Service Instance, it has dependencies") exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Stopped deleting Service Instance, it has dependencies") } } @@ -355,7 +358,7 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { throw e; }catch (Exception ex){ String msg = "Exception in getServiceInstance. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } @@ -364,7 +367,7 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { * Deletes the service instance in aai */ public void deleteServiceInstance(DelegateExecution execution) { - msoLogger.trace("Entered deleteServiceInstance") + logger.trace("Entered deleteServiceInstance") try { String globalCustId = execution.getVariable("globalSubscriberId") String serviceType = execution.getVariable("subscriptionServiceType") @@ -374,9 +377,9 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId) resourceClient.delete(serviceInstanceUri) - msoLogger.trace("Exited deleteServiceInstance") + logger.trace("Exited deleteServiceInstance") }catch(Exception e){ - msoLogger.debug("Error occured within deleteServiceInstance method: " + e) + logger.debug("Error occured within deleteServiceInstance method: " + e) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Error occured during deleteServiceInstance from aai") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy index 7c8a1d70e1..00244aded0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -30,7 +32,8 @@ import org.onap.so.client.HttpClientFactory import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.onap.so.utils.TargetEntity import org.onap.so.bpmn.core.UrnPropertiesReader @@ -40,7 +43,7 @@ import javax.ws.rs.core.Response * flow for E2E ServiceInstance Delete */ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteVFCNetworkServiceInstance.class); + private static final Logger logger = LoggerFactory.getLogger( DoDeleteVFCNetworkServiceInstance.class); ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -55,21 +58,21 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces public void preProcessRequest (DelegateExecution execution) { String msg = "" - msoLogger.trace("preProcessRequest() ") + logger.trace("preProcessRequest() ") try { //deal with operation key String globalSubscriberId = execution.getVariable("globalSubscriberId") - msoLogger.info("globalSubscriberId:" + globalSubscriberId) + logger.info("globalSubscriberId:" + globalSubscriberId) String serviceType = execution.getVariable("serviceType") - msoLogger.info("serviceType:" + serviceType) + logger.info("serviceType:" + serviceType) String serviceId = execution.getVariable("serviceId") - msoLogger.info("serviceId:" + serviceId) + logger.info("serviceId:" + serviceId) String operationId = execution.getVariable("operationId") - msoLogger.info("serviceType:" + serviceType) + logger.info("serviceType:" + serviceType) String nodeTemplateUUID = execution.getVariable("resourceTemplateId") - msoLogger.info("nodeTemplateUUID:" + nodeTemplateUUID) + logger.info("nodeTemplateUUID:" + nodeTemplateUUID) String nsInstanceId = execution.getVariable("resourceInstanceId") - msoLogger.info("nsInstanceId:" + nsInstanceId) + logger.info("nsInstanceId:" + nsInstanceId) execution.setVariable("nsInstanceId",nsInstanceId) String nsOperationKey = """{ "globalSubscriberId":"${globalSubscriberId}", @@ -79,13 +82,13 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces "nodeTemplateUUID":"${nodeTemplateUUID}" }""" execution.setVariable("nsOperationKey", nsOperationKey); - msoLogger.info("nsOperationKey:" + nsOperationKey) + logger.info("nsOperationKey:" + nsOperationKey) String vfcAdapterUrl = UrnPropertiesReader.getVariable("mso.adapters.vfc.rest.endpoint", execution) if (vfcAdapterUrl == null || vfcAdapterUrl.isEmpty()) { msg = getProcessKey(execution) + ': mso:adapters:vfcc:rest:endpoint URN mapping is not defined' - msoLogger.debug(msg) + logger.debug(msg) } while (vfcAdapterUrl.endsWith('/')) { @@ -98,10 +101,10 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit preProcessRequest ") + logger.trace("Exit preProcessRequest ") } /** @@ -109,10 +112,10 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces */ public void deleteNSRelationship(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** deleteNSRelationship *****", isDebugEnabled) + logger.info(" ***** deleteNSRelationship *****") String nsInstanceId = execution.getVariable("resourceInstanceId") if(nsInstanceId == null || nsInstanceId == ""){ - utils.log("INFO"," Delete NS failed", isDebugEnabled) + logger.info(" Delete NS failed") return } String globalSubscriberId = execution.getVariable("globalSubscriberId") @@ -125,7 +128,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces }catch(Exception e){ exceptionUtil.buildAndThrowWorkflowException(execution,25000,"Exception occured while NS disconnect call: " + e.getMessage()) } - utils.log("INFO"," *****Exit deleteNSRelationship *****", isDebugEnabled) + logger.info(" *****Exit deleteNSRelationship *****") } /** @@ -133,7 +136,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces */ public void deleteNetworkService(DelegateExecution execution) { - msoLogger.trace("deleteNetworkService start ") + logger.trace("deleteNetworkService start ") String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl") String nsOperationKey = execution.getVariable("nsOperationKey"); String url = vfcAdapterUrl + "/ns/" + execution.getVariable("nsInstanceId") @@ -145,7 +148,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces } execution.setVariable("operationStatus", operationStatus) - msoLogger.trace("deleteNetworkService end ") + logger.trace("deleteNetworkService end ") } /** @@ -153,7 +156,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces */ public void terminateNetworkService(DelegateExecution execution) { - msoLogger.trace("terminateNetworkService start ") + logger.trace("terminateNetworkService start ") String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl") String nsOperationKey = execution.getVariable("nsOperationKey") String url = vfcAdapterUrl + "/ns/" + execution.getVariable("nsInstanceId") + "/terminate" @@ -165,7 +168,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId") } execution.setVariable("jobId", jobId) - msoLogger.trace("terminateNetworkService end ") + logger.trace("terminateNetworkService end ") } /** @@ -173,7 +176,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces */ public void queryNSProgress(DelegateExecution execution) { - msoLogger.trace("queryNSProgress start ") + logger.trace("queryNSProgress start ") String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl") String jobId = execution.getVariable("jobId") String nsOperationKey = execution.getVariable("nsOperationKey"); @@ -186,7 +189,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces operationProgress = jsonUtil.getJsonValue(apiResponseAsString, "responseDescriptor.progress") } execution.setVariable("operationProgress", operationProgress) - msoLogger.trace("queryNSProgress end ") + logger.trace("queryNSProgress end ") } /** @@ -196,7 +199,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces try { Thread.sleep(5000); } catch(InterruptedException e) { - msoLogger.info("Time Delay exception" + e) + logger.info("Time Delay exception" + e) } } @@ -214,8 +217,8 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces */ private Response postRequest(DelegateExecution execution, String urlString, String requestBody){ - msoLogger.trace("Started Execute VFC adapter Post Process ") - msoLogger.info("url:"+urlString +"\nrequestBody:"+ requestBody) + logger.trace("Started Execute VFC adapter Post Process ") + logger.info("url:"+urlString +"\nrequestBody:"+ requestBody) Response apiResponse = null try{ URL url = new URL(urlString); @@ -229,11 +232,11 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces apiResponse = httpClient.post(requestBody) - msoLogger.debug("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class)) + logger.debug("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class)) - msoLogger.trace("Completed Execute VF-C adapter Post Process ") + logger.trace("Completed Execute VF-C adapter Post Process ") }catch(Exception e){ - msoLogger.error("Exception occured while executing VF-C Post Call. Exception is: \n" + e.getMessage()); + logger.error("Exception occured while executing VF-C Post Call. Exception is: \n" + e.getMessage()); throw new BpmnError("MSOWorkflowException") } return apiResponse @@ -245,8 +248,8 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces */ private Response deleteRequest(DelegateExecution execution, String url, String requestBody){ - msoLogger.trace("Started Execute VFC adapter Delete Process ") - msoLogger.info("url:"+url +"\nrequestBody:"+ requestBody) + logger.trace("Started Execute VFC adapter Delete Process ") + logger.info("url:"+url +"\nrequestBody:"+ requestBody) Response r try{ @@ -260,9 +263,9 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces httpClient.addAdditionalHeader("Content-Type", "application/json") r = httpClient.delete(requestBody) - msoLogger.trace("Completed Execute VF-C adapter Delete Process ") + logger.trace("Completed Execute VF-C adapter Delete Process ") }catch(Exception e){ - msoLogger.error("Exception occured while executing VF-C Post Call. Exception is: \n" + e.getMessage()); + logger.error("Exception occured while executing VF-C Post Call. Exception is: \n" + e.getMessage()); throw new BpmnError("MSOWorkflowException") } return r diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy index 3bc481ab01..2e0b69066e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy @@ -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 @@ -43,6 +45,8 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils import org.w3c.dom.Document import org.w3c.dom.Element @@ -71,7 +75,7 @@ import org.xml.sax.InputSource * */ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteVfModule.class); + private static final Logger logger = LoggerFactory.getLogger( DoDeleteVfModule.class); def Prefix="DoDVfMod_" @@ -138,9 +142,9 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ } else { - msoLogger.debug("DoDeleteVfModule Request: " + xml) + logger.debug("DoDeleteVfModule Request: " + xml) - msoLogger.debug("input request xml: " + xml) + logger.debug("input request xml: " + xml) vnfId = utils.getNodeText(xml,"vnf-id") execution.setVariable("vnfId", vnfId) @@ -183,8 +187,8 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ <vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id> <orchestration-status>pending-delete</orchestration-status> </PrepareUpdateAAIVfModuleRequest>""" as String - msoLogger.debug("PrepareUpdateAAIVfModuleRequest :" + request) - msoLogger.debug("UpdateAAIVfModule Request: " + request) + logger.debug("PrepareUpdateAAIVfModuleRequest :" + request) + logger.debug("UpdateAAIVfModule Request: " + request) execution.setVariable("PrepareUpdateAAIVfModuleRequest", request) execution.setVariable("vfModuleFromAAI", null) }catch(BpmnError b){ @@ -267,8 +271,8 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ </sdncadapterworkflow:SDNCRequestData> </sdncadapterworkflow:SDNCAdapterWorkflowRequest>""" - msoLogger.debug("sdncAdapterWorkflowRequest: " + request) - msoLogger.debug("DoDeleteVfModule - SDNCAdapterWorkflowRequest: " + request) + logger.debug("sdncAdapterWorkflowRequest: " + request) + logger.debug("DoDeleteVfModule - SDNCAdapterWorkflowRequest: " + request) execution.setVariable("sdncAdapterWorkflowRequest", request) } @@ -309,8 +313,8 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ </deleteVfModuleRequest> """ as String - msoLogger.debug("vnfAdapterRestV1Request: " + request) - msoLogger.debug("deleteVfModuleRequest: " + request) + logger.debug("vnfAdapterRestV1Request: " + request) + logger.debug("deleteVfModuleRequest: " + request) execution.setVariable("vnfAdapterRestV1Request", request) } @@ -327,8 +331,8 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ <heat-stack-id>DELETE</heat-stack-id> <orchestration-status>deleted</orchestration-status> </UpdateAAIVfModuleRequest>""" as String - msoLogger.debug("UpdateAAIVfModuleRequest :" + request) - msoLogger.debug("UpdateAAIVfModuleRequest: " + request) + logger.debug("UpdateAAIVfModuleRequest :" + request) + logger.debug("UpdateAAIVfModuleRequest: " + request) execution.setVariable("UpdateAAIVfModuleRequest", request) } @@ -344,15 +348,17 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ <vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id> <vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id> </DeleteAAIVfModuleRequest>""" as String - msoLogger.debug("DeleteAAIVfModuleRequest :" + request) - msoLogger.debug("DeleteAAIVfModuleRequest: " + request) + logger.debug("DeleteAAIVfModuleRequest :" + request) + logger.debug("DeleteAAIVfModuleRequest: " + request) execution.setVariable("DeleteAAIVfModuleRequest", request) } // generates a WorkflowException if // - public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception"); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), + "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception"); String processKey = getProcessKey(execution); WorkflowException exception = new WorkflowException(processKey, 5000, execution.getVariable("DoDVfMod_deleteGenericVnfResponse")) @@ -370,7 +376,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - msoLogger.debug("Successfully Validated SDNC Response") + logger.debug("Successfully Validated SDNC Response") }else{ throw new BpmnError("MSOWorkflowException") } @@ -381,19 +387,19 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable("prefix",Prefix) try{ - msoLogger.trace("STARTED postProcessVNFAdapterRequest Process") + logger.trace("STARTED postProcessVNFAdapterRequest Process") String vnfResponse = execution.getVariable("DoDVfMod_doDeleteVfModuleResponse") - msoLogger.debug("VNF Adapter Response is: " + vnfResponse) - msoLogger.debug("deleteVnfAResponse is: \n" + vnfResponse) + logger.debug("VNF Adapter Response is: " + vnfResponse) + logger.debug("deleteVnfAResponse is: \n" + vnfResponse) if(vnfResponse != null){ if(vnfResponse.contains("deleteVfModuleResponse")){ - msoLogger.debug("Received a Good Response from VNF Adapter for DELETE_VF_MODULE Call.") + logger.debug("Received a Good Response from VNF Adapter for DELETE_VF_MODULE Call.") execution.setVariable("DoDVfMod_vnfVfModuleDeleteCompleted", true) // Parse vnfOutputs for contrail network polcy FQDNs @@ -414,43 +420,43 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ String key = element.getElementsByTagNameNS("*", "key").item(0).getTextContent() if (key.endsWith("contrail_network_policy_fqdn")) { String contrailNetworkPolicyFqdn = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() - msoLogger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn) + logger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn) contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn) } else if (key.equals("oam_management_v4_address")) { String oamManagementV4Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() - msoLogger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address) + logger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address) execution.setVariable(Prefix + "oamManagementV4Address", oamManagementV4Address) } else if (key.equals("oam_management_v6_address")) { String oamManagementV6Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() - msoLogger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address) + logger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address) execution.setVariable(Prefix + "oamManagementV6Address", oamManagementV6Address) } } } if (!contrailNetworkPolicyFqdnList.isEmpty()) { - msoLogger.debug("Setting the fqdn list") + logger.debug("Setting the fqdn list") execution.setVariable("DoDVfMod_contrailNetworkPolicyFqdnList", contrailNetworkPolicyFqdnList) } } }else{ - msoLogger.debug("Received a BAD Response from VNF Adapter for DELETE_VF_MODULE Call.") + logger.debug("Received a BAD Response from VNF Adapter for DELETE_VF_MODULE Call.") exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error") } }else{ - msoLogger.debug("Response from VNF Adapter is Null for DELETE_VF_MODULE Call.") + logger.debug("Response from VNF Adapter is Null for DELETE_VF_MODULE Call.") exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Empty response from VNF Adapter") } }catch(BpmnError b){ throw b }catch(Exception e){ - msoLogger.debug("Internal Error Occured in PostProcess Method") + logger.debug("Internal Error Occured in PostProcess Method") exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Internal Error Occured in PostProcess Method") } - msoLogger.trace("COMPLETED postProcessVnfAdapterResponse Process") + logger.trace("COMPLETED postProcessVnfAdapterResponse Process") } public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) { @@ -458,21 +464,21 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED deleteNetworkPoliciesFromAAI ") + logger.trace("STARTED deleteNetworkPoliciesFromAAI ") try { // get variables List fqdnList = execution.getVariable("DoDVfMod_contrailNetworkPolicyFqdnList") if (fqdnList == null) { - msoLogger.debug("No network policies to delete") + logger.debug("No network policies to delete") return } int fqdnCount = fqdnList.size() execution.setVariable("DoDVfMod_networkPolicyFqdnCount", fqdnCount) - msoLogger.debug("DoDVfMod_networkPolicyFqdnCount - " + fqdnCount) + logger.debug("DoDVfMod_networkPolicyFqdnCount - " + fqdnCount) if (fqdnCount > 0) { // AII loop call over contrail network policy fqdn list @@ -489,7 +495,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ execution.setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", 200) // Retrieve the network policy id for this FQDN def networkPolicyId = networkPolicy.getNetworkPolicyId() - msoLogger.debug("Deleting network-policy with network-policy-id " + networkPolicyId) + logger.debug("Deleting network-policy with network-policy-id " + networkPolicyId) try { AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId) getAAIClient().delete(delUri) @@ -497,30 +503,30 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ } catch (Exception e) { execution.setVariable("DoDVfMod_aaiDeleteNetworkPolicyReturnCode", 500) String delErrorMessage = "Unable to delete network-policy to AAI deleteNetworkPoliciesFromAAI - " + e.getMessage() - msoLogger.debug(delErrorMessage) + logger.debug(delErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, delErrorMessage) } } else { execution.setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", 404) // This network policy FQDN is not in AAI. No need to delete. - msoLogger.debug("The return code is: " + 404) - msoLogger.debug("This network policy FQDN is not in AAI: " + fqdn) - msoLogger.debug("Network policy FQDN is not in AAI") + logger.debug("The return code is: " + 404) + logger.debug("This network policy FQDN is not in AAI: " + fqdn) + logger.debug("Network policy FQDN is not in AAI") } }catch(Exception e ) { // aai all errors String dataErrorMessage = "Unexpected Response from deleteNetworkPoliciesFromAAI - " + e.getMessage() - msoLogger.debug(dataErrorMessage) + logger.debug(dataErrorMessage) } } // end loop } else { - msoLogger.debug("No contrail network policies to query/create") + logger.debug("No contrail network policies to query/create") } } catch (BpmnError e) { throw e; } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in DoDeletVfModule flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -536,7 +542,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def vnfId = execution.getVariable('vnfId') @@ -563,15 +569,17 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ """ updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest) execution.setVariable(Prefix + 'updateAAIGenericVnfRequest', updateAAIGenericVnfRequest) - msoLogger.debug("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest) - msoLogger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest) + logger.debug("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest) + logger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest) - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) } } @@ -589,7 +597,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ def method = getClass().getSimpleName() + '.queryAAIVfModuleForStatus(' + 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable(Prefix + 'orchestrationStatus', '') @@ -607,18 +615,20 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ execution.setVariable(Prefix + 'queryAAIVfModuleForStatusResponse', vfModule.get()) def orchestrationStatus = vfModule.get().getOrchestrationStatus() execution.setVariable(Prefix + "orchestrationStatus", orchestrationStatus) - msoLogger.debug("Received orchestration status from A&AI: " + orchestrationStatus) + logger.debug("Received orchestration status from A&AI: " + orchestrationStatus) } } catch (Exception ex) { ex.printStackTrace() - msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) } - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage()) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy index abc83b2784..655d6ec958 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy @@ -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 @@ -43,9 +45,11 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory public class DoDeleteVfModuleFromVnf extends VfModuleBase { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteVfModuleFromVnf.class); + private static final Logger logger = LoggerFactory.getLogger( DoDeleteVfModuleFromVnf.class); def Prefix="DDVFMV_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -69,12 +73,12 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { String requestId = execution.getVariable("msoRequestId") execution.setVariable("mso-request-id", requestId) execution.setVariable("requestId", requestId) - msoLogger.debug("msoRequestId: " + requestId) + logger.debug("msoRequestId: " + requestId) String tenantId = execution.getVariable("tenantId") - msoLogger.debug("tenantId: " + tenantId) + logger.debug("tenantId: " + tenantId) String cloudSiteId = execution.getVariable("lcpCloudRegionId") execution.setVariable("cloudSiteId", cloudSiteId) - msoLogger.debug("cloudSiteId: " + cloudSiteId) + logger.debug("cloudSiteId: " + cloudSiteId) // Source is HARDCODED String source = "VID" execution.setVariable("source", source) @@ -85,11 +89,11 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { // ServiceId is hardcoded to empty execution.setVariable("serviceId", "") String serviceInstanceId = execution.getVariable("serviceInstanceId") - msoLogger.debug("serviceInstanceId: " + serviceInstanceId) + logger.debug("serviceInstanceId: " + serviceInstanceId) String vnfId = execution.getVariable("vnfId") - msoLogger.debug("vnfId: " + vnfId) + logger.debug("vnfId: " + vnfId) String vfModuleId = execution.getVariable("vfModuleId") - msoLogger.debug("vfModuleId: " + vfModuleId) + logger.debug("vfModuleId: " + vfModuleId) if (serviceInstanceId == null || serviceInstanceId.isEmpty()) { execution.setVariable(Prefix + "serviceInstanceIdToSdnc", vfModuleId) } @@ -102,24 +106,25 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { sdncVersion = "1707" } execution.setVariable(Prefix + "sdncVersion", sdncVersion) - msoLogger.debug("Incoming Sdnc Version is: " + sdncVersion) + logger.debug("Incoming Sdnc Version is: " + sdncVersion) String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception"); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception"); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl) - msoLogger.debug("SDNC Callback URL is: " + sdncCallbackUrl) + logger.debug("SDNC Callback URL: " + sdncCallbackUrl) + logger.debug("SDNC Callback URL is: " + sdncCallbackUrl) }catch(BpmnError b){ throw b }catch(Exception e){ - msoLogger.debug("Exception is: " + e.getMessage()) + logger.debug("Exception is: " + e.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!") } } @@ -129,7 +134,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def vnfId = execution.getVariable('vnfId') @@ -147,15 +152,17 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { } } catch (Exception ex) { ex.printStackTrace() - msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) execution.setVariable('DDVMFV_getVnfResponseCode', 500) execution.setVariable('DDVFMV_getVnfResponse', 'AAI GET Failed:' + ex.getMessage()) } - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVfModule(): ' + e.getMessage()) } } @@ -173,7 +180,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { 'execution=' + execution.getId() + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { GenericVnf genericVnf = execution.getVariable('DDVMFV_getVnfResponse') @@ -185,28 +192,30 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { } if (!vfModule.isPresent()) { String msg = 'VF Module \'' + vfModuleId + '\' does not exist in Generic VNF \'' + vnfId + '\'' - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, msg) } else { Boolean isOnlyVfModule = (genericVnf.getVfModules().getVfModule().size() == 1) if (isDebugLogEnabled) { - msoLogger.debug('VF Module \'' + vfModuleId + '\': isBaseVfModule=' + vfModule.get().isIsBaseVfModule() + ', isOnlyVfModule=' + isOnlyVfModule) + logger.debug('VF Module \'' + vfModuleId + '\': isBaseVfModule=' + vfModule.get().isIsBaseVfModule() + ', isOnlyVfModule=' + isOnlyVfModule) } if (vfModule.get().isIsBaseVfModule() && !isOnlyVfModule) { String msg = 'Cannot delete VF Module \'' + vfModuleId + '\'since it is the base VF Module and it\'s not the only VF Module in Generic VNF \'' + vnfId + '\'' - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 1002,msg) } def heatStackId = vfModule.get().getHeatStackId() execution.setVariable('DDVMFV_heatStackId', heatStackId) - msoLogger.debug('VF Module heatStackId retrieved from AAI: ' + heatStackId) + logger.debug('VF Module heatStackId retrieved from AAI: ' + heatStackId) } - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in validateVfModule(): ' + e.getMessage()) } } @@ -215,7 +224,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { public void preProcessSDNCDeactivateRequest(DelegateExecution execution){ execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED preProcessSDNCDeactivateRequest ") + logger.trace("STARTED preProcessSDNCDeactivateRequest ") def serviceInstanceId = execution.getVariable("serviceInstanceId") @@ -226,14 +235,16 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest) execution.setVariable("DDVMFV_deactivateSDNCRequest", deactivateSDNCRequest) - msoLogger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) + logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessSDNCDeactivateRequest. Exception is:\n" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing preProcessSDNCDeactivateRequest. Exception is:\n" + e, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preProcessSDNCDeactivateRequest ") + logger.trace("COMPLETED preProcessSDNCDeactivateRequest ") } public void preProcessSDNCUnassignRequest(DelegateExecution execution) { @@ -241,23 +252,23 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED preProcessSDNCUnassignRequest Process ") + logger.trace("STARTED preProcessSDNCUnassignRequest Process ") try{ String serviceInstanceId = execution.getVariable("serviceInstanceId") String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign") execution.setVariable("DDVMFV_unassignSDNCRequest", unassignSDNCRequest) - msoLogger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest) + logger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest) }catch(Exception e){ - msoLogger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e) + logger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preProcessSDNCUnassignRequest Process ") + logger.trace("COMPLETED preProcessSDNCUnassignRequest Process ") } public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ @@ -314,33 +325,33 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { </sdncadapterworkflow:SDNCRequestData> </sdncadapterworkflow:SDNCAdapterWorkflowRequest>""" - msoLogger.debug("sdncRequest: " + sdncRequest) + logger.debug("sdncRequest: " + sdncRequest) return sdncRequest } public void validateSDNCResponse(DelegateExecution execution, String response, String method){ execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED ValidateSDNCResponse Process") + logger.trace("STARTED ValidateSDNCResponse Process") WorkflowException workflowException = execution.getVariable("WorkflowException") boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - msoLogger.debug("workflowException: " + workflowException) + logger.debug("workflowException: " + workflowException) SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - msoLogger.debug("SDNCResponse: " + response) + logger.debug("SDNCResponse: " + response) String sdncResponse = response if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse) + logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse) }else{ - msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") + logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") throw new BpmnError("MSOWorkflowException") } - msoLogger.trace("COMPLETED ValidateSDNCResponse Process") + logger.trace("COMPLETED ValidateSDNCResponse Process") } @@ -381,8 +392,8 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { </deleteVfModuleRequest> """ as String - msoLogger.debug("vnfAdapterRestV1Request: " + request) - msoLogger.debug("deleteVfModuleRequest: " + request) + logger.debug("vnfAdapterRestV1Request: " + request) + logger.debug("deleteVfModuleRequest: " + request) execution.setVariable("vnfAdapterRestV1Request", request) } @@ -390,7 +401,9 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { // generates a WorkflowException if // - public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DDVFMV_deleteGenericVnfResponse"), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception"); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DDVFMV_deleteGenericVnfResponse"), + "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception"); String processKey = getProcessKey(execution); WorkflowException exception = new WorkflowException(processKey, 5000, execution.getVariable("DDVFMV_deleteGenericVnfResponse")) @@ -402,19 +415,19 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable("prefix",Prefix) try{ - msoLogger.trace("STARTED postProcessVNFAdapterRequest Process") + logger.trace("STARTED postProcessVNFAdapterRequest Process") String vnfResponse = execution.getVariable("DDVMFV_doDeleteVfModuleResponse") - msoLogger.debug("VNF Adapter Response is: " + vnfResponse) - msoLogger.debug("deleteVnfAResponse is: \n" + vnfResponse) + logger.debug("VNF Adapter Response is: " + vnfResponse) + logger.debug("deleteVnfAResponse is: \n" + vnfResponse) if(vnfResponse != null){ if(vnfResponse.contains("deleteVfModuleResponse")){ - msoLogger.debug("Received a Good Response from VNF Adapter for DELETE_VF_MODULE Call.") + logger.debug("Received a Good Response from VNF Adapter for DELETE_VF_MODULE Call.") execution.setVariable("DDVFMV_vnfVfModuleDeleteCompleted", true) // Parse vnfOutputs for contrail network polcy FQDNs @@ -428,41 +441,41 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { } else if (key.endsWith("contrail_network_policy_fqdn")) { String contrailNetworkPolicyFqdn = utils.getChildNodeText(node, "value") - msoLogger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn) + logger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn) contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn) } else if (key.equals("oam_management_v4_address")) { String oamManagementV4Address = utils.getChildNodeText(node, "value") - msoLogger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address) + logger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address) execution.setVariable(Prefix + "oamManagementV4Address", oamManagementV4Address) } else if (key.equals("oam_management_v6_address")) { String oamManagementV6Address = utils.getChildNodeText(node, "value") - msoLogger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address) + logger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address) execution.setVariable(Prefix + "oamManagementV6Address", oamManagementV6Address) } } if (!contrailNetworkPolicyFqdnList.isEmpty()) { - msoLogger.debug("Setting the fqdn list") + logger.debug("Setting the fqdn list") execution.setVariable("DDVFMV_contrailNetworkPolicyFqdnList", contrailNetworkPolicyFqdnList) } } }else{ - msoLogger.debug("Received a BAD Response from VNF Adapter for DELETE_VF_MODULE Call.") + logger.debug("Received a BAD Response from VNF Adapter for DELETE_VF_MODULE Call.") exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error") } }else{ - msoLogger.debug("Response from VNF Adapter is Null for DELETE_VF_MODULE Call.") + logger.debug("Response from VNF Adapter is Null for DELETE_VF_MODULE Call.") exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Empty response from VNF Adapter") } }catch(BpmnError b){ throw b }catch(Exception e){ - msoLogger.debug("Internal Error Occured in PostProcess Method") + logger.debug("Internal Error Occured in PostProcess Method") exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Internal Error Occured in PostProcess Method") } - msoLogger.trace("COMPLETED postProcessVnfAdapterResponse Process") + logger.trace("COMPLETED postProcessVnfAdapterResponse Process") } public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) { @@ -470,21 +483,21 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED deleteNetworkPoliciesFromAAI ") + logger.trace("STARTED deleteNetworkPoliciesFromAAI ") try { // get variables List fqdnList = execution.getVariable("DDVFMV_contrailNetworkPolicyFqdnList") if (fqdnList == null) { - msoLogger.debug("No network policies to delete") + logger.debug("No network policies to delete") return } int fqdnCount = fqdnList.size() execution.setVariable("DDVFMV_networkPolicyFqdnCount", fqdnCount) - msoLogger.debug("DDVFMV_networkPolicyFqdnCount - " + fqdnCount) + logger.debug("DDVFMV_networkPolicyFqdnCount - " + fqdnCount) AaiUtil aaiUriUtil = new AaiUtil(this) @@ -509,37 +522,37 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { // This network policy FQDN exists in AAI - need to delete it now // Retrieve the network policy id for this FQDN def networkPolicyId = networkPolicy.getNetworkPolicyId() - msoLogger.debug("Deleting network-policy with network-policy-id " + networkPolicyId) + logger.debug("Deleting network-policy with network-policy-id " + networkPolicyId) // Retrieve the resource version for this network policy try { AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId) getAAIClient().delete(delUri) execution.setVariable("DDVFMV_aaiDeleteNetworkPolicyReturnCode", 200) - msoLogger.debug(" ***** AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + 200) + logger.debug(" ***** AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + 200) // This network policy was deleted from AAI successfully - msoLogger.debug(" DelAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : ") + logger.debug(" DelAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : ") } catch (Exception e) { // aai all errors String delErrorMessage = "Unable to delete network-policy to AAI deleteNetworkPoliciesFromAAI - " + e.getMessage() - msoLogger.debug(delErrorMessage) + logger.debug(delErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, delErrorMessage) } } else { execution.setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", 404) // This network policy FQDN is not in AAI. No need to delete. - msoLogger.debug("This network policy FQDN is not in AAI: " + fqdn) - msoLogger.debug("Network policy FQDN is not in AAI") + logger.debug("This network policy FQDN is not in AAI: " + fqdn) + logger.debug("Network policy FQDN is not in AAI") } } catch (Exception e) { // aai all errors String dataErrorMessage = "Unexpected Response from deleteNetworkPoliciesFromAAI - " + e.getMessage() - msoLogger.debug(dataErrorMessage) + logger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } } // end loop } else { - msoLogger.debug("No contrail network policies to query/create") + logger.debug("No contrail network policies to query/create") } @@ -548,7 +561,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in DoDeletVfModule flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -565,7 +578,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { <vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id> <vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id> </DeleteAAIVfModuleRequest>""" as String - msoLogger.debug("DeleteAAIVfModuleRequest :" + request) + logger.debug("DeleteAAIVfModuleRequest :" + request) execution.setVariable("DeleteAAIVfModuleRequest", request) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy index 710d13470f..787b582808 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy @@ -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,11 +41,12 @@ import org.onap.so.client.aai.entities.Relationships import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import javax.ws.rs.NotFoundException class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteVfModuleVolumeV2.class); + private static final Logger logger = LoggerFactory.getLogger( DoDeleteVfModuleVolumeV2.class); String prefix="DDVMV_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -89,7 +92,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{ // if tenantId or lcpCloudregionId is not passed, get it from cloudRegionConfiguration variable if(!tenantId || !cloudSiteId) { def cloudConfiguration = execution.getVariable("cloudConfiguration") - msoLogger.debug("Using cloudConfiguration variable to get tenantId and lcpCloudRegionId - " + cloudConfiguration) + logger.debug("Using cloudConfiguration variable to get tenantId and lcpCloudRegionId - " + cloudConfiguration) tenantId = jsonUtil.getJsonValue(cloudConfiguration, "tenantId") execution.setVariable("tenantId", tenantId) cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId") @@ -135,7 +138,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{ } } else { - msoLogger.debug("AAI Query Cloud Region Unsuccessful.") + logger.debug("AAI Query Cloud Region Unsuccessful.") exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable(prefix+"queryCloudRegionReturnCode")) } } @@ -166,14 +169,14 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{ def heatStackId = volumeGroup.getHeatStackId()==null ? '' : volumeGroup.getHeatStackId() execution.setVariable(prefix+'volumeGroupHeatStackId', heatStackId) - msoLogger.debug('Heat stack id from AAI response: ' + heatStackId) + logger.debug('Heat stack id from AAI response: ' + heatStackId) AAIResultWrapper wrapper = getAAIClient().get(uri); Optional<Relationships> relationships = wrapper.getRelationships() String volumeGroupTenantId = null if(relationships.isPresent()){ if(relationships.get().getRelatedAAIUris(AAIObjectType.VF_MODULE)){ - msoLogger.debug('Volume Group ' + volumeGroupId + ' currently in use') + logger.debug('Volume Group ' + volumeGroupId + ' currently in use') exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume Group ${volumeGroupId} currently in use - found vf-module relationship.") } for(AAIResourceUri aaiResourceUri: relationships.get().getRelatedAAIUris(AAIObjectType.TENANT)){ @@ -181,22 +184,22 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{ } } - msoLogger.debug('Tenant ID from AAI response: ' + volumeGroupTenantId) + logger.debug('Tenant ID from AAI response: ' + volumeGroupTenantId) if (volumeGroupTenantId == null) { - msoLogger.debug("Could not find Tenant Id element in Volume Group with Volume Group Id ${volumeGroupId}") + logger.debug("Could not find Tenant Id element in Volume Group with Volume Group Id ${volumeGroupId}") exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Could not find Tenant Id element in Volume Group with Volume Group Id ${volumeGroupId}") } if (volumeGroupTenantId != tenantId) { def String errorMessage = 'TenantId ' + tenantId + ' in incoming request does not match Tenant Id ' + volumeGroupTenantId + ' retrieved from AAI for Volume Group Id ' + volumeGroupId - msoLogger.debug("Error in DeleteVfModuleVolume: " + errorMessage) + logger.debug("Error in DeleteVfModuleVolume: " + errorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 5000, errorMessage) } - msoLogger.debug('Received Tenant Id ' + volumeGroupTenantId + ' from AAI for Volume Group with Volume Group Id ' + volumeGroupId ) + logger.debug('Received Tenant Id ' + volumeGroupTenantId + ' from AAI for Volume Group with Volume Group Id ' + volumeGroupId ) }else{ execution.setVariable(prefix + "queryAAIVolGrpResponse", "Volume Group ${volumeGroupId} not found in AAI. Response code: 404") - msoLogger.debug("Volume Group ${volumeGroupId} not found in AAI") + logger.debug("Volume Group ${volumeGroupId} not found in AAI") exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume Group ${volumeGroupId} not found in AAI. Response code: 404") } }catch (Exception ex) { @@ -244,7 +247,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{ """ vnfAdapterRestRequest = utils.formatXml(vnfAdapterRestRequest) execution.setVariable(prefix+'deleteVnfARequest', vnfAdapterRestRequest) - msoLogger.debug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest) + logger.debug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest) } @@ -263,7 +266,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{ try { AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,Defaults.CLOUD_OWNER.toString(), cloudRegion, volumeGroupId) getAAIClient().delete(resourceUri) - msoLogger.debug("Volume group $volumeGroupId deleted.") + logger.debug("Volume group $volumeGroupId deleted.") }catch (NotFoundException ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume group $volumeGroupId not found for delete in AAI Response code: 404") }catch (Exception ex) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy index 47a4d55e0c..25303473c7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy @@ -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 @@ -44,8 +46,8 @@ import org.w3c.dom.Node import org.w3c.dom.NodeList import org.xml.sax.InputSource -import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory /** * This class supports the DoDeleteVnf subFlow @@ -54,7 +56,7 @@ import org.onap.so.logger.MsoLogger * */ class DoDeleteVnf extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteVnf.class); + private static final Logger logger = LoggerFactory.getLogger( DoDeleteVnf.class); String Prefix="DoDVNF_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -71,7 +73,7 @@ class DoDeleteVnf extends AbstractServiceTaskProcessor { public void preProcessRequest(DelegateExecution execution) { execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED DoDeleteVnf PreProcessRequest Process") + logger.trace("STARTED DoDeleteVnf PreProcessRequest Process") execution.setVariable("DoDVNF_SuccessIndicator", false) execution.setVariable("DoDVNF_vnfInUse", false) @@ -81,24 +83,24 @@ class DoDeleteVnf extends AbstractServiceTaskProcessor { String vnfId = execution.getVariable("vnfId") execution.setVariable("DoDVNF_vnfId", vnfId) - msoLogger.debug("Incoming Vnf(Instance) Id is: " + vnfId) + logger.debug("Incoming Vnf(Instance) Id is: " + vnfId) }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") + logger.debug("Rethrowing MSOWorkflowException") throw b }catch(Exception e){ - msoLogger.debug(" Error Occured in DoDeleteVnf PreProcessRequest method!" + e) + logger.debug(" Error Occured in DoDeleteVnf PreProcessRequest method!" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoDeleteVnf PreProcessRequest") } - msoLogger.trace("COMPLETED DoDeleteVnf PreProcessRequest Process ") + logger.trace("COMPLETED DoDeleteVnf PreProcessRequest Process ") } public void getVnf(DelegateExecution execution){ execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED DoDeleteVnf getVnf Process ") + logger.trace("STARTED DoDeleteVnf getVnf Process ") try { AAIResourcesClient resourceClient = new AAIResourcesClient() @@ -113,7 +115,7 @@ class DoDeleteVnf extends AbstractServiceTaskProcessor { if(!relationships.isEmpty()){ execution.setVariable("DoDVNF_vnfInUse", true) }else{ - msoLogger.debug("Relationship NOT related to OpenStack") + logger.debug("Relationship NOT related to OpenStack") } } @@ -130,18 +132,18 @@ class DoDeleteVnf extends AbstractServiceTaskProcessor { } } catch (Exception ex) { - msoLogger.debug("Error Occured in DoDeleteVnf getVnf Process " + ex.getMessage()) + logger.debug("Error Occured in DoDeleteVnf getVnf Process " + ex.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoDeleteVnf getVnf Process") } - msoLogger.trace("COMPLETED DoDeleteVnf getVnf Process ") + logger.trace("COMPLETED DoDeleteVnf getVnf Process ") } /** * Deletes the generic vnf from aai */ public void deleteVnf(DelegateExecution execution) { - msoLogger.trace("STARTED deleteVnf") + logger.trace("STARTED deleteVnf") try { String vnfId = execution.getVariable("DoDVNF_vnfId") @@ -149,9 +151,9 @@ class DoDeleteVnf extends AbstractServiceTaskProcessor { AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) resourceClient.delete(uri) - msoLogger.trace("COMPLETED deleteVnf") + logger.trace("COMPLETED deleteVnf") } catch (Exception ex) { - msoLogger.debug("Error Occured in DoDeleteVnf deleteVnf Process " + ex.getMessage()) + logger.debug("Error Occured in DoDeleteVnf deleteVnf Process " + ex.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoDeleteVnf deleteVnf Process") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy index 6e0c6bb002..3b23a03589 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy @@ -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 @@ -44,13 +46,15 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.aai.AAIObjectType import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory /** * This class supports the macro VID Flow * with the deletion of a generic vnf and related VF modules. */ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteVnfAndModules.class); + private static final Logger logger = LoggerFactory.getLogger( DoDeleteVnfAndModules.class); String Prefix="DDVAM_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -68,28 +72,28 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { public void preProcessRequest(DelegateExecution execution) { execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED DoDeleteVnfAndModules PreProcessRequest Process") + logger.trace("STARTED DoDeleteVnfAndModules PreProcessRequest Process") try{ // Get Variables String cloudConfiguration = execution.getVariable("cloudConfiguration") - msoLogger.debug("Cloud Configuration: " + cloudConfiguration) + logger.debug("Cloud Configuration: " + cloudConfiguration) String requestId = execution.getVariable("msoRequestId") execution.setVariable("requestId", requestId) execution.setVariable("mso-request-id", requestId) - msoLogger.debug("Incoming Request Id is: " + requestId) + logger.debug("Incoming Request Id is: " + requestId) String serviceInstanceId = execution.getVariable("serviceInstanceId") - msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + logger.debug("Incoming Service Instance Id is: " + serviceInstanceId) String vnfId = execution.getVariable("vnfId") - msoLogger.debug("Incoming Vnf Id is: " + vnfId) + logger.debug("Incoming Vnf Id is: " + vnfId) String source = "VID" execution.setVariable("DDVAM_source", source) - msoLogger.debug("Incoming Source is: " + source) + logger.debug("Incoming Source is: " + source) execution.setVariable("DDVAM_isVidRequest", "true") @@ -98,7 +102,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { sdncVersion = "1702" } execution.setVariable("DDVAM_sdncVersion", sdncVersion) - msoLogger.debug("Incoming Sdnc Version is: " + sdncVersion) + logger.debug("Incoming Sdnc Version is: " + sdncVersion) // Set aLaCarte flag to false execution.setVariable("aLaCarte", false) @@ -106,12 +110,13 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback", execution) if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception"); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception"); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl) - msoLogger.debug("SDNC Callback URL is: " + sdncCallbackUrl) + logger.debug("SDNC Callback URL: " + sdncCallbackUrl) + logger.debug("SDNC Callback URL is: " + sdncCallbackUrl) if (!sdncVersion.equals("1702")) { @@ -120,66 +125,66 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { String serviceId = execution.getVariable("productFamilyId") execution.setVariable("DDVAM_serviceId", serviceId) - msoLogger.debug("Incoming Service Id is: " + serviceId) + logger.debug("Incoming Service Id is: " + serviceId) //String modelInvariantId = jsonUtil.getJsonValue(vnfModelInfo, "modelInvariantId") //execution.setVariable("DDVAM_modelInvariantId", modelInvariantId) - //msoLogger.debug("Incoming Invariant Id is: " + modelInvariantId) + //logger.debug("Incoming Invariant Id is: " + modelInvariantId) //String modelVersionId = jsonUtil.getJsonValue(vnfModelInfo, "modelVersionId") //if (modelVersionId == null) { // modelVersionId = "" //} //execution.setVariable("DDVAM_modelVersionId", modelVersionId) - //msoLogger.debug("Incoming Version Id is: " + modelVersionId) + //logger.debug("Incoming Version Id is: " + modelVersionId) //String modelVersion = jsonUtil.getJsonValue(vnfModelInfo, "modelVersion") //execution.setVariable("DDVAM_modelVersion", modelVersion) - //msoLogger.debug("Incoming Model Version is: " + modelVersion) + //logger.debug("Incoming Model Version is: " + modelVersion) //String modelName = jsonUtil.getJsonValue(vnfModelInfo, "modelName") //execution.setVariable("DDVAM_modelName", modelName) - //msoLogger.debug("Incoming Model Name is: " + modelName) + //logger.debug("Incoming Model Name is: " + modelName) //String modelCustomizationId = jsonUtil.getJsonValue(vnfModelInfo, "modelCustomizationId") //if (modelCustomizationId == null) { // modelCustomizationId = "" //} //execution.setVariable("DDVAM_modelCustomizationId", modelCustomizationId) - //msoLogger.debug("Incoming Model Customization Id is: " + modelCustomizationId) + //logger.debug("Incoming Model Customization Id is: " + modelCustomizationId) String cloudSiteId = execution.getVariable("lcpCloudRegionId") execution.setVariable("DDVAM_cloudSiteId", cloudSiteId) - msoLogger.debug("Incoming Cloud Site Id is: " + cloudSiteId) + logger.debug("Incoming Cloud Site Id is: " + cloudSiteId) String tenantId = execution.getVariable("tenantId") execution.setVariable("DDVAM_tenantId", tenantId) - msoLogger.debug("Incoming Tenant Id is: " + tenantId) + logger.debug("Incoming Tenant Id is: " + tenantId) String globalSubscriberId = execution.getVariable("globalSubscriberId") if (globalSubscriberId == null) { globalSubscriberId = "" } execution.setVariable("DDVAM_globalSubscriberId", globalSubscriberId) - msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + logger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) } execution.setVariable("DDVAM_vfModulesFromDecomposition", null) // Retrieve serviceDecomposition if present ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") if (serviceDecomposition != null) { - msoLogger.debug("Getting Catalog DB data from ServiceDecomposition object: " + serviceDecomposition.toJsonString()) + logger.debug("Getting Catalog DB data from ServiceDecomposition object: " + serviceDecomposition.toJsonString()) List<VnfResource> vnfs = serviceDecomposition.getVnfResources() - msoLogger.debug("Read vnfs") + logger.debug("Read vnfs") if (vnfs == null) { - msoLogger.debug("Error - vnfs are empty in serviceDecomposition object") + logger.debug("Error - vnfs are empty in serviceDecomposition object") exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in preProcessRequest - vnfs are empty") } VnfResource vnf = vnfs[0] if (vnf == null) { - msoLogger.debug("Error - vnf is empty in serviceDecomposition object") + logger.debug("Error - vnf is empty in serviceDecomposition object") exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in preProcessRequest - vnf is empty") } @@ -193,14 +198,14 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") + logger.debug("Rethrowing MSOWorkflowException") throw b }catch(Exception e){ - msoLogger.debug(" Error Occured in DoCreateVnfAndModules PreProcessRequest method!" + e.getMessage()) + logger.debug(" Error Occured in DoCreateVnfAndModules PreProcessRequest method!" + e.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf PreProcessRequest") } - msoLogger.trace("COMPLETED DoDeleteVnfAndModules PreProcessRequest Process ") + logger.trace("COMPLETED DoDeleteVnfAndModules PreProcessRequest Process ") } @@ -208,7 +213,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { public void preProcessAddOnModule(DelegateExecution execution){ execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED preProcessAddOnModule ") + logger.trace("STARTED preProcessAddOnModule ") try { JSONArray addOnModules = (JSONArray) execution.getVariable("addOnModules") @@ -233,10 +238,12 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessAddOnModule." + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing preProcessAddOnModule." + e, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preProcessSDNCAssignRequest ") + logger.trace("COMPLETED preProcessSDNCAssignRequest ") } /** @@ -250,7 +257,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { def method = getClass().getSimpleName() + '.queryAAIVfModule(' + 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def vnfId = execution.getVariable('vnfId') @@ -279,16 +286,16 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { // Find the model for this vf module in decomposition if specified if (vfModulesFromDecomposition != null) { - msoLogger.debug("vfModulesFromDecomposition is not null") + logger.debug("vfModulesFromDecomposition is not null") def vfModuleUuid = vfModule.getModelVersionId() if (vfModuleUuid == null) { vfModuleUuid = vfModule.getPersonaModelVersion() } - msoLogger.debug("vfModule UUID is: " + vfModuleUuid) + logger.debug("vfModule UUID is: " + vfModuleUuid) for (j in 0..vfModulesFromDecomposition.size()-1) { ModuleResource mr = vfModulesFromDecomposition[j] if (mr.getModelInfo().getModelUuid() == vfModuleUuid) { - msoLogger.debug("Found modelInfo") + logger.debug("Found modelInfo") vfModuleModelInfo = mr.getModelInfo() break } @@ -325,14 +332,16 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { execution.setVariable("DDVAM_vfModules", vfModulesList) } catch (Exception ex) { ex.printStackTrace() - msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) } - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) } } @@ -340,7 +349,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { public void prepareNextModuleToDelete(DelegateExecution execution){ execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED prepareNextModuleToDelete ") + logger.trace("STARTED prepareNextModuleToDelete ") try { int i = execution.getVariable("DDVAM_nextModule") @@ -354,20 +363,22 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { execution.setVariable("DDVAM_vfModuleName", vfModuleName) def vfModuleModelInfo = vfModule.get("vfModuleModelInfo") - msoLogger.debug("vfModuleModelInfo for module delete: " + vfModuleModelInfo) + logger.debug("vfModuleModelInfo for module delete: " + vfModuleModelInfo) execution.setVariable("DDVAM_vfModuleModelInfo", vfModuleModelInfo) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessAddOnModule." + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing preProcessAddOnModule." + e, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareNextModuleToDelete Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED prepareNextModuleToDelete ") + logger.trace("COMPLETED prepareNextModuleToDelete ") } public void preProcessSDNCDeactivateRequest(DelegateExecution execution){ execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED preProcessSDNCDeactivateRequest ") + logger.trace("STARTED preProcessSDNCDeactivateRequest ") def vnfId = execution.getVariable("vnfId") def serviceInstanceId = execution.getVariable("serviceInstanceId") @@ -378,14 +389,16 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest) execution.setVariable("DDVAM_deactivateSDNCRequest", deactivateSDNCRequest) - msoLogger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) - msoLogger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) + logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) + logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessSDNCDeactivateRequest." + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing preProcessSDNCDeactivateRequest." + e, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preProcessSDNCDeactivateRequest ") + logger.trace("COMPLETED preProcessSDNCDeactivateRequest ") } public void preProcessSDNCUnassignRequest(DelegateExecution execution) { @@ -393,9 +406,9 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED preProcessSDNCUnassignRequest Process ") + logger.trace("STARTED preProcessSDNCUnassignRequest Process ") try{ String vnfId = execution.getVariable("vnfId") String serviceInstanceId = execution.getVariable("serviceInstanceId") @@ -403,14 +416,14 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign") execution.setVariable("DDVAM_unassignSDNCRequest", unassignSDNCRequest) - msoLogger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest) - msoLogger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest) + logger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest) + logger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest) }catch(Exception e){ - msoLogger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e) + logger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preProcessSDNCUnassignRequest Process ") + logger.trace("COMPLETED preProcessSDNCUnassignRequest Process ") } public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ @@ -474,33 +487,33 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { </sdncadapterworkflow:SDNCRequestData> </sdncadapterworkflow:SDNCAdapterWorkflowRequest>""" - msoLogger.debug("sdncRequest: " + sdncRequest) + logger.debug("sdncRequest: " + sdncRequest) return sdncRequest } public void validateSDNCResponse(DelegateExecution execution, String response, String method){ execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED ValidateSDNCResponse Process") + logger.trace("STARTED ValidateSDNCResponse Process") WorkflowException workflowException = execution.getVariable("WorkflowException") boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - msoLogger.debug("workflowException: " + workflowException) + logger.debug("workflowException: " + workflowException) SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - msoLogger.debug("SDNCResponse: " + response) + logger.debug("SDNCResponse: " + response) String sdncResponse = response if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse) + logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse) }else{ - msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") + logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") throw new BpmnError("MSOWorkflowException") } - msoLogger.trace("COMPLETED ValidateSDNCResponse Process") + logger.trace("COMPLETED ValidateSDNCResponse Process") } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy index 41d9384f52..e04cf35c54 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 CMCC All rights reserved. * * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -31,6 +33,8 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils; @@ -40,7 +44,7 @@ import org.springframework.web.util.UriUtils; * */ public class DoScaleE2EServiceInstance extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoScaleE2EServiceInstance.class); + private static final Logger logger = LoggerFactory.getLogger( DoScaleE2EServiceInstance.class); String Prefix = "DCRESI_" @@ -49,7 +53,7 @@ public class DoScaleE2EServiceInstance extends AbstractServiceTaskProcessor { public void preProcessRequest(DelegateExecution execution) { String msg = "" - msoLogger.trace("preProcessRequest ") + logger.trace("preProcessRequest ") try { String requestId = execution.getVariable("msoRequestId") @@ -82,22 +86,22 @@ public class DoScaleE2EServiceInstance extends AbstractServiceTaskProcessor { } if (isBlank(serviceInstanceId)) { msg = "Input serviceInstanceId is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } } catch (BpmnError e) { throw e; } catch (Exception ex) { msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit preProcessRequest ") + logger.trace("Exit preProcessRequest ") } public void preInitResourcesOperStatus(DelegateExecution execution){ - msoLogger.trace("STARTED preInitResourcesOperStatus Process ") + logger.trace("STARTED preInitResourcesOperStatus Process ") try{ String serviceId = execution.getVariable("serviceInstanceId") String operationId = execution.getVariable("operationId") @@ -105,7 +109,7 @@ public class DoScaleE2EServiceInstance extends AbstractServiceTaskProcessor { // resourceTemplateUUIDs should be created ?? String resourceTemplateUUIDs = execution.getVariable("resourceTemplateUUIDs") - msoLogger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType) + logger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType) serviceId = UriUtils.encode(serviceId,"UTF-8") execution.setVariable("serviceInstanceId", serviceId) execution.setVariable("operationId", operationId) @@ -129,14 +133,16 @@ public class DoScaleE2EServiceInstance extends AbstractServiceTaskProcessor { payload = utils.formatXml(payload) execution.setVariable("CVFMI_initResOperStatusRequest", payload) - msoLogger.info("Outgoing initResourceOperationStatus: \n" + payload) - msoLogger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) + logger.info("Outgoing initResourceOperationStatus: \n" + payload) + logger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preInitResourcesOperStatus Process ") + logger.trace("COMPLETED preInitResourcesOperStatus Process ") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy index 19d30bb9b1..671eb5cdc0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 CMCC. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -46,6 +48,8 @@ import org.onap.so.bpmn.infrastructure.vfcmodel.NsParameters import org.onap.so.bpmn.infrastructure.vfcmodel.LocationConstraint import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.onap.so.utils.TargetEntity @@ -56,7 +60,7 @@ import org.onap.so.utils.TargetEntity * flow for VFC Network Service Scale */ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoScaleVFCNetworkServiceInstance.class); + private static final Logger logger = LoggerFactory.getLogger( DoScaleVFCNetworkServiceInstance.class); String host = "http://mso.mso.testlab.openecomp.org:8080" @@ -76,7 +80,7 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess * generate the nsParameters */ public void preProcessRequest(DelegateExecution execution) { - msoLogger.trace("preProcessRequest() ") + logger.trace("preProcessRequest() ") List<NSResourceInputParameter> nsRIPList = convertScaleNsReq2NSResInputParamList(execution) String requestJsonStr = "" @@ -93,7 +97,7 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess execution.setVariable("reqBody", requestJsonStr) - msoLogger.trace("Exit preProcessRequest ") + logger.trace("Exit preProcessRequest ") } /** @@ -122,7 +126,7 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess if (returnCode == "200" || returnCode == "202") { jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId") } - utils.log("INFO", "scaleNetworkService get a ns scale job Id:" + jobId, isDebugEnabled) + logger.info( "scaleNetworkService get a ns scale job Id:" + jobId) execution.setVariable("jobId", jobId) execution.setVariable("nodeTemplateUUID", nodeTemplateUUID) @@ -178,7 +182,9 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess try { Thread.sleep(5000) } catch (InterruptedException e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Time Delay exception" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Time Delay exception" + e, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue()); } } @@ -196,8 +202,8 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess * requestBody: the body of the request */ private Response postRequest(DelegateExecution execution, String urlString, String requestBody){ - msoLogger.trace("Started Execute VFC adapter Post Process ") - msoLogger.info("url:"+urlString +"\nrequestBody:"+ requestBody) + logger.trace("Started Execute VFC adapter Post Process ") + logger.info("url:"+urlString +"\nrequestBody:"+ requestBody) Response apiResponse = null try{ URL url = new URL(urlString); @@ -207,10 +213,10 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess apiResponse = httpClient.post(requestBody) - msoLogger.info("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class)) - msoLogger.trace("Completed Execute VF-C adapter Post Process ") + logger.info("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class)) + logger.trace("Completed Execute VF-C adapter Post Process ") }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing VFC Post Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception occured while executing VFC Post Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), e); throw new BpmnError("MSOWorkflowException") } return apiResponse diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy index baa695af09..4fe30803c4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 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 @@ -40,6 +42,8 @@ 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.springframework.web.util.UriUtils; +import org.slf4j.Logger +import org.slf4j.LoggerFactory import groovy.json.* @@ -67,6 +71,7 @@ import groovy.json.* * @param - WorkflowException */ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { + private static final Logger logger = LoggerFactory.getLogger( DoUpdateE2EServiceInstance.class); String Prefix="DUPDSI_" private static final String DebugFlag = "isDebugEnabled" @@ -76,7 +81,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Enter DoUpdateE2EServiceInstance preProcessRequest *****", isDebugEnabled) + logger.info(" ***** Enter DoUpdateE2EServiceInstance preProcessRequest *****") String msg = "" @@ -85,24 +90,24 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { //Inputs //for AAI GET & PUT & SDNC assignToplology String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId - utils.log("INFO"," ***** globalSubscriberId *****" + globalSubscriberId, isDebugEnabled) + logger.info(" ***** globalSubscriberId *****" + globalSubscriberId) //for AAI PUT & SDNC assignTopology String serviceType = execution.getVariable("serviceType") - utils.log("INFO"," ***** serviceType *****" + serviceType, isDebugEnabled) + logger.info(" ***** serviceType *****" + serviceType) //for SDNC assignTopology String productFamilyId = execution.getVariable("productFamilyId") //AAI productFamilyId if (isBlank(globalSubscriberId)) { msg = "Input globalSubscriberId is null" - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(serviceType)) { msg = "Input serviceType is null" - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } @@ -110,7 +115,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { String serviceInstanceId = execution.getVariable("serviceInstanceId") if (isBlank(serviceInstanceId)){ msg = "Input serviceInstanceId is null" - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } @@ -122,29 +127,29 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { // target model Invariant uuid String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid") execution.setVariable("modelInvariantUuid", modelInvariantUuid) - utils.log("INFO", "modelInvariantUuid: " + modelInvariantUuid, isDebugEnabled) + logger.info( "modelInvariantUuid: " + modelInvariantUuid) // target model uuid String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid") execution.setVariable("modelUuid", modelUuid) - utils.log("INFO","modelUuid: " + modelUuid, isDebugEnabled) + logger.info("modelUuid: " + modelUuid) } catch (BpmnError e) { throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - utils.log("INFO", "======== COMPLETED preProcessRequest Process ======== ", isDebugEnabled) + logger.info( "======== COMPLETED preProcessRequest Process ======== ") } public void preInitResourcesOperStatus(DelegateExecution execution){ def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled) + logger.info( " ======== STARTED preInitResourcesOperStatus Process ======== ") try{ String serviceId = execution.getVariable("serviceInstanceId") String operationId = execution.getVariable("operationId") @@ -154,7 +159,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { String progress = "0" String reason = "" String operationContent = "Prepare service updating" - utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled) + logger.info( "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType) serviceId = UriUtils.encode(serviceId,"UTF-8") execution.setVariable("serviceInstanceId", serviceId) execution.setVariable("operationId", operationId) @@ -171,7 +176,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) + logger.info( "DB Adapter Endpoint is: " + dbAdapterEndpoint) String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" @@ -189,20 +194,20 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { payload = utils.formatXml(payload) execution.setVariable("CVFMI_initResOperStatusRequest", payload) - utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled) + logger.info( "Outgoing initResourceOperationStatus: \n" + payload) utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled) + logger.info( "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e) execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) } - utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled) + logger.info( "======== COMPLETED preInitResourcesOperStatus Process ======== ") } public void preProcessForAddResource(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** preProcessForAddResource ***** ", isDebugEnabled) + logger.info(" ***** preProcessForAddResource ***** ") execution.setVariable("operationType", "create") @@ -212,21 +217,21 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("hasResourcetoAdd", true) } - utils.log("INFO"," *** Exit preProcessForAddResource *** ", isDebugEnabled) + logger.info(" *** Exit preProcessForAddResource *** ") } public void postProcessForAddResource(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessForAddResource ***** ", isDebugEnabled) + logger.info(" ***** postProcessForAddResource ***** ") execution.setVariable("operationType", "update") - utils.log("INFO"," *** Exit postProcessForAddResource *** ", isDebugEnabled) + logger.info(" *** Exit postProcessForAddResource *** ") } public void preProcessForDeleteResource(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** preProcessForDeleteResource ***** ", isDebugEnabled) + logger.info(" ***** preProcessForDeleteResource ***** ") execution.setVariable("operationType", "delete") @@ -259,22 +264,22 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("deleteResourceList", delResourceList) - utils.log("INFO"," *** Exit preProcessForDeleteResource *** ", isDebugEnabled) + logger.info(" *** Exit preProcessForDeleteResource *** ") } public void postProcessForDeleteResource(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessForDeleteResource ***** ", isDebugEnabled) + logger.info(" ***** postProcessForDeleteResource ***** ") execution.setVariable("operationType", "update") - utils.log("INFO"," *** Exit postProcessForDeleteResource *** ", isDebugEnabled) + logger.info(" *** Exit postProcessForDeleteResource *** ") } public void preProcessAAIPUT(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO","Entered " + method, isDebugEnabled) + logger.info("Entered " + method) String msg = "" String serviceInstanceVersion = execution.getVariable("serviceInstanceVersion") @@ -299,12 +304,12 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("serviceInstanceData", si) - utils.log("INFO", "Exited " + method, isDebugEnabled) + logger.info( "Exited " + method) } public void updateServiceInstance(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** createServiceInstance ***** ", isDebugEnabled) + logger.info(" ***** createServiceInstance ***** ") String msg = "" String serviceInstanceId = execution.getVariable("serviceInstanceId") try { @@ -327,52 +332,52 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("rollbackData", rollbackData) msg = "Exception in DoCreateServiceInstance.createServiceInstance. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - utils.log("INFO"," *** Exit createServiceInstance *** ", isDebugEnabled) + logger.info(" *** Exit createServiceInstance *** ") } public void preProcessRollback (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** preProcessRollback ***** ", isDebugEnabled) + logger.info(" ***** preProcessRollback ***** ") try { Object workflowException = execution.getVariable("WorkflowException"); if (workflowException instanceof WorkflowException) { - utils.log("INFO", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled) + logger.info( "Prev workflowException: " + workflowException.getErrorMessage()) execution.setVariable("prevWorkflowException", workflowException); //execution.setVariable("WorkflowException", null); } } catch (BpmnError e) { - utils.log("INFO", "BPMN Error during preProcessRollback", isDebugEnabled) + logger.info( "BPMN Error during preProcessRollback") } catch(Exception ex) { String msg = "Exception in preProcessRollback. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) } - utils.log("INFO"," *** Exit preProcessRollback *** ", isDebugEnabled) + logger.info(" *** Exit preProcessRollback *** ") } public void postProcessRollback (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessRollback ***** ", isDebugEnabled) + logger.info(" ***** postProcessRollback ***** ") String msg = "" try { Object workflowException = execution.getVariable("prevWorkflowException"); if (workflowException instanceof WorkflowException) { - utils.log("INFO", "Setting prevException to WorkflowException: ", isDebugEnabled) + logger.info( "Setting prevException to WorkflowException: ") execution.setVariable("WorkflowException", workflowException); } execution.setVariable("rollbackData", null) } catch (BpmnError b) { - utils.log("INFO", "BPMN Error during postProcessRollback", isDebugEnabled) + logger.info( "BPMN Error during postProcessRollback") throw b; } catch(Exception ex) { msg = "Exception in postProcessRollback. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) } - utils.log("INFO"," *** Exit postProcessRollback *** ", isDebugEnabled) + logger.info(" *** Exit postProcessRollback *** ") } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy index 949a566711..0a635c6bc6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 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 @@ -35,7 +37,8 @@ import org.onap.so.client.aai.AAIResourcesClient 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.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.onap.so.bpmn.common.scripts.ExceptionUtil; import groovy.json.* import org.onap.so.bpmn.common.scripts.AaiUtil; @@ -61,7 +64,7 @@ import org.onap.so.bpmn.common.scripts.AaiUtil; * */ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoUpdateE2EServiceInstanceRollback.class); + private static final Logger logger = LoggerFactory.getLogger( DoUpdateE2EServiceInstanceRollback.class); String Prefix="DUPDSIRB_" @@ -70,7 +73,7 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce public void preProcessRequest(DelegateExecution execution) { execution.setVariable("prefix",Prefix) String msg = "" - msoLogger.trace("preProcessRequest ") + logger.trace("preProcessRequest ") execution.setVariable("rollbackAAI",false) execution.setVariable("rollbackAdded",false) execution.setVariable("rollbackDeleted",false) @@ -85,7 +88,7 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce try { def rollbackData = execution.getVariable("rollbackData") - msoLogger.debug("RollbackData:" + rollbackData) + logger.debug("RollbackData:" + rollbackData) if (rollbackData != null) { if (rollbackData.hasType("SERVICEINSTANCE")) { @@ -140,14 +143,14 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce throw e; } catch (Exception ex){ msg = "Exception in Update ServiceInstance Rollback preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit preProcessRequest ") + logger.trace("Exit preProcessRequest ") } public void postProcessRequest(DelegateExecution execution) { - msoLogger.trace("postProcessRequest ") + logger.trace("postProcessRequest ") String msg = "" try { execution.setVariable("rollbackData", null) @@ -171,17 +174,17 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce if(!succInAAI){ execution.setVariable("rolledBack", false) //both sdnc and aai must be successful to declare rollback Succesful execution.setVariable("rollbackError", "Error deleting service-instance in AAI for rollback") - msoLogger.debug("Error deleting service-instance in AAI for rollback", + serviceInstanceId) + logger.debug("Error deleting service-instance in AAI for rollback", + serviceInstanceId) } } - msoLogger.trace("Exit postProcessRequest ") + logger.trace("Exit postProcessRequest ") } catch (BpmnError e) { msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + e.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } catch (Exception ex) { msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } } @@ -200,9 +203,9 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce public void preProcessAAIPUT(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' - msoLogger.info("Entered " + method) + logger.info("Entered " + method) String msg = "" - msoLogger.trace("preProcessAAIPUT ") + logger.trace("preProcessAAIPUT ") String serviceInstanceVersion = execution.getVariable("serviceInstanceVersion_n") // execution.setVariable("GENPS_serviceResourceVersion", serviceInstanceVersion) @@ -227,11 +230,11 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce execution.setVariable("serviceInstanceData", si) - msoLogger.info("Exited " + method) + logger.info("Exited " + method) } public void updateServiceInstance(DelegateExecution execution) { - msoLogger.trace("updateServiceInstance ") + logger.trace("updateServiceInstance ") String msg = "" try { String serviceInstanceId = execution.getVariable("serviceInstanceId") @@ -245,40 +248,40 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce throw e; } catch (Exception ex) { msg = "Exception in DoCreateServiceInstance.updateServiceInstance. " + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit updateServiceInstance ") + logger.trace("Exit updateServiceInstance ") } public void processRollbackException(DelegateExecution execution){ - msoLogger.trace("processRollbackException ") + logger.trace("processRollbackException ") try{ - msoLogger.debug("Caught an Exception in DoUpdateE2EServiceInstanceRollback") + logger.debug("Caught an Exception in DoUpdateE2EServiceInstanceRollback") execution.setVariable("rollbackData", null) execution.setVariable("rollbackError", "Caught exception in ServiceInstance Update Rollback") execution.setVariable("WorkflowException", null) }catch(BpmnError b){ - msoLogger.debug("BPMN Error during processRollbackExceptions Method: ") + logger.debug("BPMN Error during processRollbackExceptions Method: ") }catch(Exception e){ - msoLogger.debug("Caught Exception during processRollbackExceptions Method: " + e.getMessage()) + logger.debug("Caught Exception during processRollbackExceptions Method: " + e.getMessage()) } - msoLogger.debug(" Exit processRollbackException") + logger.debug(" Exit processRollbackException") } public void processRollbackJavaException(DelegateExecution execution){ - msoLogger.trace("processRollbackJavaException ") + logger.trace("processRollbackJavaException ") try{ execution.setVariable("rollbackData", null) execution.setVariable("rollbackError", "Caught Java exception in ServiceInstance Update Rollback") - msoLogger.debug("Caught Exception in processRollbackJavaException") + logger.debug("Caught Exception in processRollbackJavaException") }catch(Exception e){ - msoLogger.debug("Caught Exception in processRollbackJavaException " + e.getMessage()) + logger.debug("Caught Exception in processRollbackJavaException " + e.getMessage()) } - msoLogger.trace("Exit processRollbackJavaException ") + logger.trace("Exit processRollbackJavaException ") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy index 6dd8085bae..ce61595680 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy @@ -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 @@ -43,7 +45,8 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.aai.entities.AAIResultWrapper import org.onap.so.client.graphinventory.entities.uri.Depth import org.onap.so.constants.Defaults -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils import org.w3c.dom.Document @@ -68,7 +71,7 @@ import groovy.xml.XmlUtil * */ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoUpdateNetworkInstance.class); + private static final Logger logger = LoggerFactory.getLogger( DoUpdateNetworkInstance.class); String Prefix="UPDNETI_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -176,7 +179,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside preProcessRequest DoUpdateNetworkInstance Request ") + logger.trace("Inside preProcessRequest DoUpdateNetworkInstance Request ") try { // initialize flow variables @@ -190,12 +193,12 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { // JSON format request is sent, create xml try { def prettyJson = JsonOutput.prettyPrint(networkRequest.toString()) - msoLogger.debug(" Incoming message formatted . . . : " + '\n' + prettyJson) + logger.debug(" Incoming message formatted . . . : " + '\n' + prettyJson) networkRequest = vidUtils.createXmlNetworkRequestInfra(execution, networkRequest) } catch (Exception ex) { String dataErrorMessage = " Invalid json format Request - " + ex.getMessage() - msoLogger.debug(dataErrorMessage) + logger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } } else { @@ -208,32 +211,32 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } networkRequest = utils.formatXml(networkRequest) - msoLogger.debug(networkRequest) + logger.debug(networkRequest) execution.setVariable(Prefix + "networkRequest", networkRequest) - msoLogger.debug(" network-request - " + '\n' + networkRequest) + logger.debug(" network-request - " + '\n' + networkRequest) // validate 'disableRollback' (aka, 'suppressRollback') boolean rollbackEnabled = networkUtils.isRollbackEnabled(execution, networkRequest) execution.setVariable(Prefix + "rollbackEnabled", rollbackEnabled) - msoLogger.debug(Prefix + "rollbackEnabled - " + rollbackEnabled) + logger.debug(Prefix + "rollbackEnabled - " + rollbackEnabled) String networkInputs = utils.getNodeXml(networkRequest, "network-inputs", false).replace("tag0:","").replace(":tag0","") execution.setVariable(Prefix + "networkInputs", networkInputs) - msoLogger.debug(Prefix + "networkInputs - " + '\n' + networkInputs) + logger.debug(Prefix + "networkInputs - " + '\n' + networkInputs) // prepare messageId String messageId = execution.getVariable(Prefix + "messageId") // for testing if (messageId == null || messageId == "") { messageId = UUID.randomUUID() - msoLogger.debug(" UPDNETI_messageId, random generated: " + messageId) + logger.debug(" UPDNETI_messageId, random generated: " + messageId) } else { - msoLogger.debug(" UPDNETI_messageId, pre-assigned: " + messageId) + logger.debug(" UPDNETI_messageId, pre-assigned: " + messageId) } execution.setVariable(Prefix + "messageId", messageId) String source = utils.getNodeText(networkRequest, "source") execution.setVariable(Prefix + "source", source) - msoLogger.debug(Prefix + "source - " + source) + logger.debug(Prefix + "source - " + source) String networkId = "" if (utils.nodeExists(networkRequest, "network-id")) { @@ -242,7 +245,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { sendSyncError(execution) // missing value of networkId String dataErrorMessage = "Variable 'network-id' value/element is missing." - msoLogger.debug(" Invalid Request - " + dataErrorMessage) + logger.debug(" Invalid Request - " + dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } @@ -254,7 +257,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { if ((lcpCloudRegion == 'null') || (lcpCloudRegion == "")) { sendSyncError(execution) String dataErrorMessage = "requestDetails has missing 'aic-cloud-region' value/element." - msoLogger.debug(" Invalid Request - " + dataErrorMessage) + logger.debug(" Invalid Request - " + dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } } @@ -265,7 +268,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { if ((serviceInstanceId == 'null') || (lcpCloudRegion == "")) { sendSyncError(execution) String dataErrorMessage = "Variable 'serviceInstanceId' value/element is missing." - msoLogger.debug(" Invalid Request - " + dataErrorMessage) + logger.debug(" Invalid Request - " + dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } } @@ -282,18 +285,18 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } catch (IOException ex) { String exceptionMessage = "Exception Encountered in DoUpdateNetworkInstance, PreProcessRequest() - " String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage() - msoLogger.debug(dataErrorMessage) + logger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } // Set variables for Generic Get Sub Flow use execution.setVariable(Prefix + "serviceInstanceId", serviceInstanceId) - msoLogger.debug(Prefix + "serviceInstanceId - " + serviceInstanceId) + logger.debug(Prefix + "serviceInstanceId - " + serviceInstanceId) - msoLogger.debug(" Url for SDNC adapter: " + UrnPropertiesReader.getVariable("mso.adapters.sdnc.endpoint",execution)) + logger.debug(" Url for SDNC adapter: " + UrnPropertiesReader.getVariable("mso.adapters.sdnc.endpoint",execution)) String sdncVersion = execution.getVariable("sdncVersion") - msoLogger.debug("sdncVersion? : " + sdncVersion) + logger.debug("sdncVersion? : " + sdncVersion) // build 'networkOutputs' networkId = utils.getNodeText(networkRequest, "network-id") @@ -310,7 +313,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { <network-name>${MsoUtils.xmlEscape(networkName)}</network-name> </network-outputs>""" execution.setVariable(Prefix + "networkOutputs", networkOutputs) - msoLogger.debug(Prefix + "networkOutputs - " + '\n' + networkOutputs) + logger.debug(Prefix + "networkOutputs - " + '\n' + networkOutputs) execution.setVariable(Prefix + "networkId", networkId) execution.setVariable(Prefix + "networkName", networkName) @@ -322,7 +325,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { sendSyncError(execution) // caught exception String exceptionMessage = "Exception Encountered in DoUpdateNetworkInstance, PreProcessRequest() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -333,7 +336,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { * */ public void getServiceInstance(DelegateExecution execution) { - msoLogger.trace("getServiceInstance ") + logger.trace("getServiceInstance ") try { String serviceInstanceId = execution.getVariable('serviceInstanceId') @@ -352,7 +355,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { throw e; }catch (Exception ex){ String msg = "Exception in getServiceInstance. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } @@ -361,7 +364,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) - msoLogger.debug(" ***** Inside callRESTQueryAAICloudRegion of DoUpdateNetworkInstance ***** " ) + logger.debug(" ***** Inside callRESTQueryAAICloudRegion of DoUpdateNetworkInstance ***** " ) try { String networkInputs = execution.getVariable(Prefix + "networkInputs") @@ -386,12 +389,12 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } else { String dataErrorMessage = "QueryAAICloudRegion Unsuccessful. Return Code: " + execution.getVariable(Prefix + "queryCloudRegionReturnCode") - msoLogger.debug(dataErrorMessage) + logger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } - msoLogger.debug(" is Cloud Region Good: " + execution.getVariable(Prefix + "isCloudRegionGood")) + logger.debug(" is Cloud Region Good: " + execution.getVariable(Prefix + "isCloudRegionGood")) } catch (BpmnError e) { throw e; @@ -399,7 +402,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } catch (Exception ex) { // try error String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow - callRESTQueryAAICloudRegion() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -410,7 +413,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) - msoLogger.debug(" ***** Inside callRESTQueryAAINetworkId of DoUpdateNetworkInstance ***** " ) + logger.debug(" ***** Inside callRESTQueryAAINetworkId of DoUpdateNetworkInstance ***** " ) try { // get variables @@ -429,11 +432,11 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } catch (NotFoundException e) { String dataErrorMessage = "Response Error from QueryAAINetworkId is 404 (Not Found)." - msoLogger.debug(" AAI Query Failed. " + dataErrorMessage) + logger.debug(" AAI Query Failed. " + dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTQueryAAINetworkId() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -444,7 +447,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) - msoLogger.debug(" ***** Inside callRESTReQueryAAINetworkId of DoUpdateNetworkInstance ***** " ) + logger.debug(" ***** Inside callRESTReQueryAAINetworkId of DoUpdateNetworkInstance ***** " ) try { // get variables @@ -467,15 +470,15 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { <network-name>${MsoUtils.xmlEscape(netName)}</network-name> </network-outputs>""" execution.setVariable(Prefix + "networkOutputs", networkOutputs) - msoLogger.debug(" networkOutputs - " + '\n' + networkOutputs) + logger.debug(" networkOutputs - " + '\n' + networkOutputs) } catch (NotFoundException e) { String dataErrorMessage = "Response Error from ReQueryAAINetworkId is 404 (Not Found)." - msoLogger.debug(" AAI ReQuery Failed. - " + dataErrorMessage) + logger.debug(" AAI ReQuery Failed. - " + dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTReQueryAAINetworkId() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -486,7 +489,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) - msoLogger.debug(" ***** Inside callRESTQueryAAINetworkVpnBinding of DoUpdateNetworkInstance ***** " ) + logger.debug(" ***** Inside callRESTQueryAAINetworkVpnBinding of DoUpdateNetworkInstance ***** " ) try { @@ -495,7 +498,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { if(queryIdAAIResponse.getRelationships().isPresent()){ List<AAIResourceUri> uris = queryIdAAIResponse.getRelationships().get().getRelatedAAIUris(AAIObjectType.VPN_BINDING) - msoLogger.debug(Prefix + "vpnCount - " + uris.size()) + logger.debug(Prefix + "vpnCount - " + uris.size()) if (uris.size() > 0) { String routeTargets = "" @@ -522,7 +525,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } // end loop execution.setVariable(Prefix + "routeCollection", routeTargets) - msoLogger.debug(" UPDNETI_routeCollection - " + '\n' + routeTargets) + logger.debug(" UPDNETI_routeCollection - " + '\n' + routeTargets) } else { // reset return code to success @@ -538,17 +541,17 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse) execution.setVariable(Prefix + "queryVpnBindingAAIResponse", aaiStubResponseAsXml) execution.setVariable(Prefix + "routeCollection", "<routeTargets/>") - msoLogger.debug(" No vpnBinding, using this stub as response - " + '\n' + aaiStubResponseAsXml) + logger.debug(" No vpnBinding, using this stub as response - " + '\n' + aaiStubResponseAsXml) } } } catch (NotFoundException e) { - msoLogger.debug("Response Error from AAINetworkVpnBinding is 404 (Not Found).") + logger.debug("Response Error from AAINetworkVpnBinding is 404 (Not Found).") exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Response Error from AAINetworkVpnBinding is 404 (Not Found).") } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTQueryAAINetworkVpnBinding() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -559,7 +562,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) - msoLogger.debug(" ***** Inside callRESTQueryAAINetworkPolicy of DoUpdateNetworkInstance ***** " ) + logger.debug(" ***** Inside callRESTQueryAAINetworkPolicy of DoUpdateNetworkInstance ***** " ) try { // get variables @@ -568,7 +571,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { List<AAIResourceUri> uris = queryIdAAIResponse.getRelationships().get().getRelatedAAIUris(AAIObjectType.NETWORK_POLICY) execution.setVariable(Prefix + "networkPolicyCount", uris.size()) - msoLogger.debug(Prefix + "networkPolicyCount - " + uris.size()) + logger.debug(Prefix + "networkPolicyCount - " + uris.size()) if (uris.size() > 0) { @@ -587,7 +590,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } // end loop execution.setVariable(Prefix + "networkCollection", networkPolicies) - msoLogger.debug(" UPDNETI_networkCollection - " + '\n' + networkPolicies) + logger.debug(" UPDNETI_networkCollection - " + '\n' + networkPolicies) } else { // reset return code to success @@ -603,18 +606,18 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse) execution.setVariable(Prefix + "queryNetworkPolicyAAIResponse", aaiStubResponseAsXml) execution.setVariable(Prefix + "networkCollection", "<policyFqdns/>") - msoLogger.debug(" No net policies, using this stub as response - " + '\n' + aaiStubResponseAsXml) + logger.debug(" No net policies, using this stub as response - " + '\n' + aaiStubResponseAsXml) } } } catch (NotFoundException e) { String dataErrorMessage = "Response Error from QueryAAINetworkPolicy is 404 (Not Found)." - msoLogger.debug(dataErrorMessage) + logger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTQueryAAINetworkPolicy() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -625,7 +628,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) - msoLogger.debug(" ***** Inside callRESTQueryAAINetworkTableRef of DoUpdateNetworkInstance ***** " ) + logger.debug(" ***** Inside callRESTQueryAAINetworkTableRef of DoUpdateNetworkInstance ***** " ) try { AAIResultWrapper queryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse") @@ -633,9 +636,9 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { List<AAIResourceUri> uris = queryIdAAIResponse.getRelationships().get().getRelatedAAIUris(AAIObjectType.ROUTE_TABLE_REFERENCE) execution.setVariable(Prefix + "networkTableRefCount", uris.size()) - msoLogger.debug(Prefix + "networkTableRefCount - " + uris.size()) + logger.debug(Prefix + "networkTableRefCount - " + uris.size()) - msoLogger.debug(" UPDNETI_networkTableRefCount - " + uris.size()) + logger.debug(" UPDNETI_networkTableRefCount - " + uris.size()) if (uris.size() > 0) { execution.setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "200") @@ -653,7 +656,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } // end loop execution.setVariable(Prefix + "tableRefCollection", networkTableRefs) - msoLogger.debug(" UPDNETI_tableRefCollection - " + '\n' + networkTableRefs) + logger.debug(" UPDNETI_tableRefCollection - " + '\n' + networkTableRefs) } else { // reset return code to success @@ -669,19 +672,19 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse) execution.setVariable(Prefix + "queryNetworkTableRefAAIResponse", aaiStubResponseAsXml) execution.setVariable(Prefix + "tableRefCollection", "<routeTableFqdns/>") - msoLogger.debug(" No net table references, using this stub as response - " + '\n' + aaiStubResponseAsXml) + logger.debug(" No net table references, using this stub as response - " + '\n' + aaiStubResponseAsXml) } } } catch (NotFoundException e) { String dataErrorMessage = "Response Error from QueryAAINetworkTableRef is 404 (Not Found)." - msoLogger.debug(dataErrorMessage) + logger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTQueryAAINetworkTableRef() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -690,7 +693,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { public void callRESTUpdateContrailAAINetwork(DelegateExecution execution) { execution.setVariable("prefix", Prefix) - msoLogger.debug(" ***** Inside callRESTUpdateContrailAAINetwork of DoUpdateNetworkInstance ***** " ) + logger.debug(" ***** Inside callRESTUpdateContrailAAINetwork of DoUpdateNetworkInstance ***** " ) try { // get variables String networkRequest = execution.getVariable(Prefix + "networkRequest") @@ -754,11 +757,11 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { throw e; } catch (NotFoundException e) { String dataErrorMessage = " Response Error from UpdateContrailAAINetwork is 404 (Not Found)." - msoLogger.debug(dataErrorMessage) + logger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTUpdateContrailAAINetwork() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -769,7 +772,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) - msoLogger.trace("Inside prepareUpdateNetworkRequest of DoUpdateNetworkInstance ") + logger.trace("Inside prepareUpdateNetworkRequest of DoUpdateNetworkInstance ") try { @@ -791,14 +794,14 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { // Format Response String buildUpdateNetworkRequestAsString = utils.formatXml(updateNetworkRequest) buildUpdateNetworkRequestAsString = buildUpdateNetworkRequestAsString.replace(":w1aac13n0", "").replace("w1aac13n0:", "") - msoLogger.debug(buildUpdateNetworkRequestAsString) + logger.debug(buildUpdateNetworkRequestAsString) execution.setVariable(Prefix + "updateNetworkRequest", buildUpdateNetworkRequestAsString) - msoLogger.debug(" UPDNETI_updateNetworkRequest - " + "\n" + buildUpdateNetworkRequestAsString) + logger.debug(" UPDNETI_updateNetworkRequest - " + "\n" + buildUpdateNetworkRequestAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. prepareUpdateNetworkRequest() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -809,7 +812,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) - msoLogger.trace("Inside prepareSDNCRequest of DoUpdateNetworkInstance ") + logger.trace("Inside prepareSDNCRequest of DoUpdateNetworkInstance ") try { // get variables @@ -832,14 +835,14 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { String sndcTopologyCreateRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, updateNetworkInput, serviceInstanceId, sdncCallback, "changeassign", "NetworkActivateRequest", cloudRegionId, networkId, queryAAIResponse, null) String sndcTopologyUpdateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) - msoLogger.debug(sndcTopologyUpdateRequesAsString) + logger.debug(sndcTopologyUpdateRequesAsString) execution.setVariable(Prefix + "changeAssignSDNCRequest", sndcTopologyUpdateRequesAsString) - msoLogger.debug(" UPDNETI_changeAssignSDNCRequest - " + "\n" + sndcTopologyUpdateRequesAsString) + logger.debug(" UPDNETI_changeAssignSDNCRequest - " + "\n" + sndcTopologyUpdateRequesAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. prepareSDNCRequest() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -857,7 +860,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) - msoLogger.trace("Inside validateUpdateNetworkResponse of DoUpdateNetworkInstance ") + logger.trace("Inside validateUpdateNetworkResponse of DoUpdateNetworkInstance ") try { String returnCode = execution.getVariable(Prefix + "networkReturnCode") @@ -866,14 +869,14 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { networkResponse="" // reset } - msoLogger.debug(" Network Adapter update responseCode: " + returnCode) + logger.debug(" Network Adapter update responseCode: " + returnCode) String errorMessage = "" if (returnCode == "200") { execution.setVariable(Prefix + "isNetworkRollbackNeeded", true) - msoLogger.debug(networkResponse) + logger.debug(networkResponse) execution.setVariable(Prefix + "updateNetworkResponse", networkResponse) - msoLogger.debug(" Network Adapter update Success Response - " + "\n" + networkResponse) + logger.debug(" Network Adapter update Success Response - " + "\n" + networkResponse) // prepare rollback data String rollbackData = utils.getNodeXml(networkResponse, "rollback", false).replace("tag0:","").replace(":tag0","") @@ -884,7 +887,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { </rollbackNetworkRequest>""" String rollbackNetworkXml = utils.formatXml(rollbackNetwork) execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkXml) - msoLogger.debug(" Network Adapter rollback data - " + "\n" + rollbackNetworkXml) + logger.debug(" Network Adapter rollback data - " + "\n" + rollbackNetworkXml) } else { // network error if (returnCode.toInteger() > 399 && returnCode.toInteger() < 600) { //4xx, 5xx @@ -918,7 +921,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. validateUpdateNetworkResponse() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -930,7 +933,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) - msoLogger.trace("Inside validateSDNCResponse of DoUpdateNetworkInstance ") + logger.trace("Inside validateSDNCResponse of DoUpdateNetworkInstance ") String response = execution.getVariable(Prefix + "changeAssignSDNCResponse") WorkflowException workflowException = null @@ -938,7 +941,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { workflowException = execution.getVariable(Prefix + "WorkflowException") //execution.setVariable("WorkflowException", workflowException) } catch (Exception ex) { - msoLogger.debug(" Sdnc 'WorkflowException' object is empty or null. ") + logger.debug(" Sdnc 'WorkflowException' object is empty or null. ") } boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") @@ -952,10 +955,10 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { if (execution.getVariable(Prefix + "sdncResponseSuccess") == true) { // from sdnc util, prefix+'sdncResponseSuccess' execution.setVariable(Prefix + "isSdncRollbackNeeded", true) - msoLogger.debug("Successfully Validated SDNC Response") + logger.debug("Successfully Validated SDNC Response") } else { - msoLogger.debug("Did NOT Successfully Validated SDNC Response") + logger.debug("Did NOT Successfully Validated SDNC Response") throw new BpmnError("MSOWorkflowException") } @@ -966,10 +969,10 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) - msoLogger.trace("Inside postProcessResponse of DoUpdateNetworkInstance ") + logger.trace("Inside postProcessResponse of DoUpdateNetworkInstance ") try { - msoLogger.debug(" ***** Is Exception Encountered (isException)? : " + execution.getVariable(Prefix + "isException")) + logger.debug(" ***** Is Exception Encountered (isException)? : " + execution.getVariable(Prefix + "isException")) if (execution.getVariable(Prefix + "isException") == false) { // set rollback data execution.setVariable("orchestrationStatus", "") @@ -978,13 +981,13 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { prepareSuccessRollbackData(execution) // populate rollbackData execution.setVariable("WorkflowException", null) execution.setVariable(Prefix + "Success", true) - msoLogger.debug(" ***** postProcessResponse(), GOOD !!!") + logger.debug(" ***** postProcessResponse(), GOOD !!!") } else { execution.setVariable(Prefix + "Success", false) execution.setVariable("rollbackData", null) String exceptionMessage = " Exception encountered in MSO Bpmn. " if (execution.getVariable("workflowException") != null) { // Output of Rollback flow. - msoLogger.debug(" ***** workflowException: " + execution.getVariable("workflowException")) + logger.debug(" ***** workflowException: " + execution.getVariable("workflowException")) WorkflowException wfex = execution.getVariable("workflowException") exceptionMessage = wfex.getErrorMessage() } else { @@ -994,19 +997,19 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } } // going to the Main flow: a-la-carte or macro - msoLogger.debug(" ***** postProcessResponse(), BAD !!!") + logger.debug(" ***** postProcessResponse(), BAD !!!") exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) throw new BpmnError("MSOWorkflowException") } } catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") + logger.debug("Rethrowing MSOWorkflowException") throw b } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. postProcessResponse() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -1018,7 +1021,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) - msoLogger.trace("Inside prepareSDNCRollbackRequest of DoUpdateNetworkInstance ") + logger.trace("Inside prepareSDNCRollbackRequest of DoUpdateNetworkInstance ") try { // for some reason the WorkflowException object is null after the sdnc rollback call task, need to save WorkflowException. @@ -1036,11 +1039,11 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { String sndcTopologyRollbackRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, updateNetworkInput, serviceInstanceId, sdncCallback, "rollback", "NetworkActivateRequest", cloudRegionId, networkId, null, null) String sndcTopologyRollbackRequestAsString = utils.formatXml(sndcTopologyRollbackRequest) execution.setVariable(Prefix + "rollbackSDNCRequest", sndcTopologyRollbackRequestAsString) - msoLogger.debug(" Preparing request for SDNC Topology assign's rollback/compensation . . . - " + "\n" + sndcTopologyRollbackRequestAsString) + logger.debug(" Preparing request for SDNC Topology assign's rollback/compensation . . . - " + "\n" + sndcTopologyRollbackRequestAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. prepareSDNCRollbackRequest() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) } @@ -1051,7 +1054,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside prepareRollbackData() of DoUpdateNetworkInstance ") + logger.trace("Inside prepareRollbackData() of DoUpdateNetworkInstance ") try { @@ -1069,14 +1072,14 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } } execution.setVariable("rollbackData", rollbackData) - msoLogger.debug("** rollbackData : " + rollbackData) + logger.debug("** rollbackData : " + rollbackData) execution.setVariable("WorkflowException", execution.getVariable(Prefix + "WorkflowException")) - msoLogger.debug("** WorkflowException : " + execution.getVariable("WorkflowException")) + logger.debug("** WorkflowException : " + execution.getVariable("WorkflowException")) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. prepareRollbackData() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) } @@ -1087,7 +1090,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside prepareSuccessRollbackData() of DoUpdateNetworkInstance ") + logger.trace("Inside prepareSuccessRollbackData() of DoUpdateNetworkInstance ") try { @@ -1112,13 +1115,13 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } execution.setVariable("rollbackData", rollbackData) - msoLogger.debug("** 'rollbackData' for Full Rollback : " + rollbackData) + logger.debug("** 'rollbackData' for Full Rollback : " + rollbackData) execution.setVariable("WorkflowException", null) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. prepareSuccessRollbackData() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) } @@ -1129,7 +1132,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside setExceptionFlag() of DoUpdateNetworkInstance ") + logger.trace("Inside setExceptionFlag() of DoUpdateNetworkInstance ") try { @@ -1140,11 +1143,11 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } else { execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) } - msoLogger.debug(Prefix + "WorkflowException - " +execution.getVariable(Prefix + "WorkflowException")) + logger.debug(Prefix + "WorkflowException - " +execution.getVariable(Prefix + "WorkflowException")) } catch(Exception ex){ String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. setExceptionFlag(): " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) } @@ -1159,18 +1162,18 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) try{ - msoLogger.debug("Caught a Java Exception") - msoLogger.debug("Started processJavaException Method") - msoLogger.debug("Variables List: " + execution.getVariables()) + logger.debug("Caught a Java Exception") + logger.debug("Started processJavaException Method") + logger.debug("Variables List: " + execution.getVariables()) execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") }catch(Exception e){ - msoLogger.debug("Caught Exception during processJavaException Method: " + e) + logger.debug("Caught Exception during processJavaException Method: " + e) execution.setVariable("UnexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method") } - msoLogger.debug("Completed processJavaException Method") + logger.debug("Completed processJavaException Method") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy index eaba51ac6f..1b98451fbe 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy @@ -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,15 +44,15 @@ import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; import org.springframework.web.util.UriUtils -import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory /** * This groovy class supports the <class>DoCreateNetworkInstance.bpmn</class> process. * */ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoUpdateNetworkInstanceRollback.class); + private static final Logger logger = LoggerFactory.getLogger( DoUpdateNetworkInstanceRollback.class); String Prefix="UPDNETIR_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -96,7 +98,7 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside preProcessRequest() of " + className + ".groovy ") + logger.trace("Inside preProcessRequest() of " + className + ".groovy ") try { // initialize flow variables @@ -121,10 +123,10 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkRequest) execution.setVariable(Prefix + "rollbackSDNCRequest", rollbackSDNCRequest) - msoLogger.debug("'rollbackData': " + '\n' + execution.getVariable("rollbackData")) + logger.debug("'rollbackData': " + '\n' + execution.getVariable("rollbackData")) String sdncVersion = execution.getVariable("sdncVersion") - msoLogger.debug("sdncVersion? : " + sdncVersion) + logger.debug("sdncVersion? : " + sdncVersion) // PO Authorization Info / headers Authorization= String basicAuthValuePO = UrnPropertiesReader.getVariable("mso.adapters.po.auth",execution) @@ -137,7 +139,7 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso } catch (IOException ex) { String exceptionMessage = "Exception Encountered in DoCreateNetworkInstance, PreProcessRequest() - " String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage() - msoLogger.debug(dataErrorMessage ) + logger.debug(dataErrorMessage ) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } @@ -146,7 +148,7 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso } else { execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) } - msoLogger.debug("*** WorkflowException : " + execution.getVariable(Prefix + "WorkflowException")) + logger.debug("*** WorkflowException : " + execution.getVariable(Prefix + "WorkflowException")) if(execution.getVariable(Prefix + "WorkflowException") != null) { // called by: DoCreateNetworkInstance, partial rollback execution.setVariable(Prefix + "fullRollback", false) @@ -156,7 +158,7 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso execution.setVariable(Prefix + "fullRollback", true) } - msoLogger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback")) + logger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback")) } catch (BpmnError e) { @@ -166,7 +168,7 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso sendSyncError(execution) // caught exception String exceptionMessage = "Exception Encountered in PreProcessRequest() of " + className + ".groovy ***** : " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -177,7 +179,7 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside validateRollbackResponses() of DoUpdateNetworkInstanceRollback ") + logger.trace("Inside validateRollbackResponses() of DoUpdateNetworkInstanceRollback ") try { // validate PO network rollback response @@ -186,8 +188,8 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso if (execution.getVariable(Prefix + "rollbackNetworkRequest") != null) { rollbackNetworkReturnCode = execution.getVariable(Prefix + "rollbackNetworkReturnCode") String rollbackNetworkResponse = execution.getVariable(Prefix + "rollbackNetworkResponse") - msoLogger.debug(" NetworkRollback Code - " + rollbackNetworkReturnCode) - msoLogger.debug(" NetworkRollback Response - " + rollbackNetworkResponse) + logger.debug(" NetworkRollback Code - " + rollbackNetworkReturnCode) + logger.debug(" NetworkRollback Response - " + rollbackNetworkResponse) if (rollbackNetworkReturnCode != "200") { rollbackNetworkErrorMessages = " + PO Network rollback failed. " } else { @@ -218,13 +220,13 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso } else { rollbackSdncErrorMessages = " + SDNC changeassign rollback failed. " } - msoLogger.debug(" SDNC changeassign rollback Code - " + rollbackSDNCReturnCode) - msoLogger.debug(" SDNC changeassign rollback Response - " + rollbackSDNCResponse) + logger.debug(" SDNC changeassign rollback Code - " + rollbackSDNCReturnCode) + logger.debug(" SDNC changeassign rollback Response - " + rollbackSDNCResponse) } String statusMessage = "" int errorCode = 7000 - msoLogger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback")) + logger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback")) if (execution.getVariable(Prefix + "fullRollback") == false) { // original WorkflowException, WorkflowException wfe = execution.getVariable(Prefix + "WorkflowException") @@ -247,7 +249,7 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso } statusMessage = statusMessage + rollbackNetworkErrorMessages + rollbackSdncErrorMessages - msoLogger.debug("Final DoUpdateNetworkInstanceRollback status message: " + statusMessage) + logger.debug("Final DoUpdateNetworkInstanceRollback status message: " + statusMessage) String processKey = getProcessKey(execution); WorkflowException exception = new WorkflowException(processKey, errorCode, statusMessage); execution.setVariable("workflowException", exception); @@ -260,7 +262,7 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso execution.setVariable("rollbackError", false) } else { String exceptionMessage = "Network Update Rollback was not Successful. " - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) execution.setVariable("rollbackSuccessful", false) execution.setVariable("rollbackError", true) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) @@ -274,7 +276,7 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso execution.setVariable("WorkflowException", null) String errorMessage = "See Previous Camunda flows for cause of Error: Undetermined Exception." String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstanceRollback flow. validateRollbackResponses() - " + errorMessage + ": " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) execution.setVariable("WorkflowException", execution.getVariable("WorkflowException")) @@ -293,18 +295,18 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso execution.setVariable("prefix",Prefix) try{ - msoLogger.debug("Caught a Java Exception in " + Prefix) - msoLogger.debug("Started processJavaException Method") - msoLogger.debug("Variables List: " + execution.getVariables()) + logger.debug("Caught a Java Exception in " + Prefix) + logger.debug("Started processJavaException Method") + logger.debug("Variables List: " + execution.getVariables()) execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") }catch(Exception e){ - msoLogger.debug("Caught Exception during processJavaException Method: " + e) + logger.debug("Caught Exception during processJavaException Method: " + e) execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix) } - msoLogger.trace("Completed processJavaException Method in " + Prefix) + logger.trace("Completed processJavaException Method in " + Prefix) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy index 06c7002dff..641878be8e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy @@ -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 @@ -44,9 +46,11 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.constants.Defaults import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory public class DoUpdateVfModule extends VfModuleBase { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoUpdateVfModule.class); + private static final Logger logger = LoggerFactory.getLogger( DoUpdateVfModule.class); ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() @@ -106,13 +110,13 @@ public class DoUpdateVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { initProcessVariables(execution) def xml = getVariable(execution, 'DoUpdateVfModuleRequest') - msoLogger.debug("DoUpdateVfModule request: " + xml) - msoLogger.debug('Received request xml:\n' + xml) + logger.debug("DoUpdateVfModule request: " + xml) + logger.debug('Received request xml:\n' + xml) if (xml == null || xml.isEmpty()) { // Building Block-type request @@ -121,9 +125,9 @@ public class DoUpdateVfModule extends VfModuleBase { String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo") def serviceModelInfo = execution.getVariable("serviceModelInfo") - msoLogger.debug("serviceModelInfo: " + serviceModelInfo) + logger.debug("serviceModelInfo: " + serviceModelInfo) String modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") - msoLogger.debug("modelInvariantUuid: " + modelInvariantUuid) + logger.debug("modelInvariantUuid: " + modelInvariantUuid) def vnfModelInfo = execution.getVariable("vnfModelInfo") //tenantId @@ -138,32 +142,32 @@ public class DoUpdateVfModule extends VfModuleBase { def cloudSiteId = execution.getVariable("lcpCloudRegionId") execution.setVariable("DOUPVfMod_aicCloudRegion", cloudSiteId) - msoLogger.debug("cloudSiteId: " + cloudSiteId) + logger.debug("cloudSiteId: " + cloudSiteId) //vnfType def vnfType = execution.getVariable("vnfType") execution.setVariable("DOUPVfMod_vnfType", vnfType) - msoLogger.debug("vnfType: " + vnfType) + logger.debug("vnfType: " + vnfType) //vnfName def vnfName = execution.getVariable("vnfName") execution.setVariable("DOUPVfMod_vnfName", vnfName) - msoLogger.debug("vnfName: " + vnfName) + logger.debug("vnfName: " + vnfName) //vnfId def vnfId = execution.getVariable("vnfId") execution.setVariable("DOUPVfMod_vnfId", vnfId) - msoLogger.debug("vnfId: " + vnfId) + logger.debug("vnfId: " + vnfId) //vfModuleName def vfModuleName = execution.getVariable("vfModuleName") execution.setVariable("DOUPVfMod_vfModuleName", vfModuleName) - msoLogger.debug("vfModuleName: " + vfModuleName) + logger.debug("vfModuleName: " + vfModuleName) //vfModuleModelName def vfModuleModelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName") execution.setVariable("DOUPVfMod_vfModuleModelName", vfModuleModelName) - msoLogger.debug("vfModuleModelName: " + vfModuleModelName) + logger.debug("vfModuleModelName: " + vfModuleModelName) //modelCustomizationUuid def modelCustomizationUuid = jsonUtil.getJsonValue(vfModuleModelInfo, "modelCustomizationUuid") if (modelCustomizationUuid == null) { @@ -171,30 +175,30 @@ public class DoUpdateVfModule extends VfModuleBase { } execution.setVariable("DOUPVfMod_modelCustomizationUuid", modelCustomizationUuid) - msoLogger.debug("modelCustomizationUuid: " + modelCustomizationUuid) + logger.debug("modelCustomizationUuid: " + modelCustomizationUuid) //vfModuleId def vfModuleId = execution.getVariable("vfModuleId") execution.setVariable("DOUPVfMod_vfModuleId", vfModuleId) - msoLogger.debug("vfModuleId: " + vfModuleId) + logger.debug("vfModuleId: " + vfModuleId) def requestId = execution.getVariable("msoRequestId") execution.setVariable("DOUPVfMod_requestId", requestId) - msoLogger.debug("requestId: " + requestId) + logger.debug("requestId: " + requestId) // Set mso-request-id to request-id for VNF Adapter interface execution.setVariable("mso-request-id", requestId) //serviceId def serviceId = execution.getVariable("serviceId") execution.setVariable("DOUPVfMod_serviceId", serviceId) - msoLogger.debug("serviceId: " + serviceId) + logger.debug("serviceId: " + serviceId) //serviceInstanceId def serviceInstanceId = execution.getVariable("serviceInstanceId") execution.setVariable("DOUPVfMod_serviceInstanceId", serviceInstanceId) - msoLogger.debug("serviceInstanceId: " + serviceInstanceId) + logger.debug("serviceInstanceId: " + serviceInstanceId) //source - HARDCODED def source = "VID" execution.setVariable("DOUPVfMod_source", source) - msoLogger.debug("source: " + source) + logger.debug("source: " + source) //backoutOnFailure def disableRollback = execution.getVariable("disableRollback") def backoutOnFailure = true @@ -202,15 +206,15 @@ public class DoUpdateVfModule extends VfModuleBase { backoutOnFailure = false } execution.setVariable("DOUPVfMod_backoutOnFailure", backoutOnFailure) - msoLogger.debug("backoutOnFailure: " + backoutOnFailure) + logger.debug("backoutOnFailure: " + backoutOnFailure) //isBaseVfModule def isBaseVfModule = execution.getVariable("isBaseVfModule") execution.setVariable("DOUPVfMod_isBaseVfModule", isBaseVfModule) - msoLogger.debug("isBaseVfModule: " + isBaseVfModule) + logger.debug("isBaseVfModule: " + isBaseVfModule) //asdcServiceModelVersion def asdcServiceModelVersion = execution.getVariable("asdcServiceModelVersion") execution.setVariable("DOUPVfMod_asdcServiceModelVersion", asdcServiceModelVersion) - msoLogger.debug("asdcServiceModelVersion: " + asdcServiceModelVersion) + logger.debug("asdcServiceModelVersion: " + asdcServiceModelVersion) //personaModelId execution.setVariable("DOUPVfMod_personaModelId", jsonUtil.getJsonValue(vfModuleModelInfo, "modelInvariantUuid")) //personaModelVersion @@ -219,9 +223,9 @@ public class DoUpdateVfModule extends VfModuleBase { String uuid = execution.getVariable("DOUPVfMod_uuid") if(uuid == null){ uuid = UUID.randomUUID() - msoLogger.debug("Generated messageId (UUID) is: " + uuid) + logger.debug("Generated messageId (UUID) is: " + uuid) }else{ - msoLogger.debug("Found messageId (UUID) is: " + uuid) + logger.debug("Found messageId (UUID) is: " + uuid) } //isVidRequest String isVidRequest = execution.getVariable("isVidRequest") @@ -232,15 +236,15 @@ public class DoUpdateVfModule extends VfModuleBase { //usePreload def usePreload = execution.getVariable("usePreload") execution.setVariable("DOUPVfMod_usePreload", usePreload) - msoLogger.debug("usePreload: " + usePreload) + logger.debug("usePreload: " + usePreload) //globalSubscriberId String globalSubscriberId = execution.getVariable("globalSubscriberId") execution.setVariable("DOUPVfMod_globalSubscriberId", globalSubscriberId) - msoLogger.debug("globalSubsrciberId: " + globalSubscriberId) + logger.debug("globalSubsrciberId: " + globalSubscriberId) //vnfQueryPath String vnfQueryPath = execution.getVariable("vnfQueryPath") execution.setVariable("DOUPVfMod_vnfQueryPath", vnfQueryPath) - msoLogger.debug("vnfQueryPath: " + vnfQueryPath) + logger.debug("vnfQueryPath: " + vnfQueryPath) Map<String,String> vfModuleInputParams = execution.getVariable("vfModuleInputParams") if (vfModuleInputParams != null) { @@ -258,7 +262,7 @@ public class DoUpdateVfModule extends VfModuleBase { throw e } catch (Exception ex){ String msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } @@ -271,7 +275,7 @@ public class DoUpdateVfModule extends VfModuleBase { workloadContext = aaiJson.getOrDefault("workload-context","") }catch (Exception ex) { - msoLogger.debug("Error retreiving parent service instance information") + logger.debug("Error retreiving parent service instance information") } execution.setVariable("DCVFM_environmentContext",environmentContext) @@ -307,7 +311,7 @@ public class DoUpdateVfModule extends VfModuleBase { isBaseVfModule = utils.getNodeText(xml, "is-base-vf-module") execution.setVariable("DOUPVfMod_isBaseVfModule", isBaseVfModule) } - msoLogger.debug("isBaseVfModule: " + isBaseVfModule) + logger.debug("isBaseVfModule: " + isBaseVfModule) NetworkUtils networkUtils = new NetworkUtils() def backoutOnFailure = networkUtils.isRollbackEnabled(execution, xml) @@ -322,15 +326,18 @@ public class DoUpdateVfModule extends VfModuleBase { def sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) } } @@ -346,7 +353,7 @@ public class DoUpdateVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def vnfId = execution.getVariable('DOUPVfMod_vnfId') @@ -362,14 +369,16 @@ public class DoUpdateVfModule extends VfModuleBase { """ prepareUpdateAAIVfModuleRequest = utils.formatXml(prepareUpdateAAIVfModuleRequest) execution.setVariable('DOUPVfMod_prepareUpdateAAIVfModuleRequest', prepareUpdateAAIVfModuleRequest) - msoLogger.debug("DoUpdateAAIVfModule request: " + prepareUpdateAAIVfModuleRequest) - msoLogger.debug('Request for PrepareUpdateAAIVfModule:\n' + prepareUpdateAAIVfModuleRequest) + logger.debug("DoUpdateAAIVfModule request: " + prepareUpdateAAIVfModuleRequest) + logger.debug('Request for PrepareUpdateAAIVfModule:\n' + prepareUpdateAAIVfModuleRequest) - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preparePrepareUpdateAAIVfModule(): ' + e.getMessage()) } } @@ -387,7 +396,7 @@ public class DoUpdateVfModule extends VfModuleBase { def prefix = execution.getVariable("prefix") - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { String cloudRegion = execution.getVariable(prefix + "aicCloudRegion") @@ -411,22 +420,26 @@ public class DoUpdateVfModule extends VfModuleBase { execution.setVariable(prefix + "isCloudRegionGood", true) } else { String errorMessage = "AAI Query Cloud Region Unsuccessful. AAI Response Code: " + execution.getVariable(prefix + "queryCloudRegionReturnCode") - msoLogger.debug(errorMessage) + logger.debug(errorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) execution.setVariable(prefix + "isCloudRegionGood", false) } - msoLogger.debug(" is Cloud Region Good: " + execution.getVariable(prefix + "isCloudRegionGood")) + logger.debug(" is Cloud Region Good: " + execution.getVariable(prefix + "isCloudRegionGood")) } catch(BpmnError b){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + b); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + b); throw b }catch (Exception e) { // try error String errorMessage = "Bpmn error encountered in CreateVfModule flow. Unexpected Response from AAI - " + e.getMessage() - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " AAI Query Cloud Region Failed. Exception - " + "\n" + errorMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "AAI Query Cloud Region Failed. Exception - " + "\n" + errorMessage, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during prepConfirmVolumeGroupTenant(): " + e.getMessage()) } - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } @@ -441,7 +454,7 @@ public class DoUpdateVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def requestId = execution.getVariable('DOUPVfMod_requestId') @@ -521,14 +534,16 @@ public class DoUpdateVfModule extends VfModuleBase { """ sdncTopologyRequest = utils.formatXml(sdncTopologyRequest) execution.setVariable('DOUPVfMod_sdncChangeAssignRequest', sdncTopologyRequest) - msoLogger.debug("sdncChangeAssignRequest : " + sdncTopologyRequest) - msoLogger.debug('Request for SDNCAdapter topology/changeassign:\n' + sdncTopologyRequest) + logger.debug("sdncChangeAssignRequest : " + sdncTopologyRequest) + logger.debug('Request for SDNCAdapter topology/changeassign:\n' + sdncTopologyRequest) - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyChg(): ' + e.getMessage()) } } @@ -544,7 +559,7 @@ public class DoUpdateVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { String uuid = execution.getVariable('testReqId') // for junits @@ -583,14 +598,16 @@ public class DoUpdateVfModule extends VfModuleBase { """ sdncTopologyRequest = utils.formatXml(sdncTopologyRequest) execution.setVariable('DOUPVfMod_sdncTopologyRequest', sdncTopologyRequest) - msoLogger.debug("sdncTopologyRequest : " + sdncTopologyRequest) - msoLogger.debug('Request for SDNCAdapter query:\n' + sdncTopologyRequest) + logger.debug("sdncTopologyRequest : " + sdncTopologyRequest) + logger.debug('Request for SDNCAdapter query:\n' + sdncTopologyRequest) - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyQuery(): ' + e.getMessage()) } } @@ -605,7 +622,7 @@ public class DoUpdateVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def requestId = execution.getVariable('DOUPVfMod_requestId') @@ -641,8 +658,8 @@ public class DoUpdateVfModule extends VfModuleBase { String environmentContext = execution.getVariable("DOUPVEnvironment_context") String workloadContext = execution.getVariable("DOUPVWorkload_context") - msoLogger.debug("workloadContext: " + workloadContext) - msoLogger.debug("environmentContext: " + environmentContext) + logger.debug("workloadContext: " + workloadContext) + logger.debug("environmentContext: " + environmentContext) Map<String, String> vnfParamsMap = execution.getVariable("DOUPVfMod_vnfParamsMap") @@ -683,14 +700,16 @@ public class DoUpdateVfModule extends VfModuleBase { """ vnfAdapterRestRequest = utils.formatXml(vnfAdapterRestRequest) execution.setVariable('DOUPVfMod_vnfAdapterRestRequest', vnfAdapterRestRequest) - msoLogger.debug("vnfAdapterRestRequest : " + vnfAdapterRestRequest) - msoLogger.debug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest) + logger.debug("vnfAdapterRestRequest : " + vnfAdapterRestRequest) + logger.debug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest) - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepVnfAdapterRest(): ' + e.getMessage()) } } @@ -704,7 +723,7 @@ public class DoUpdateVfModule extends VfModuleBase { def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' + 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def vnfId = execution.getVariable('DOUPVfMod_vnfId') @@ -713,7 +732,7 @@ public class DoUpdateVfModule extends VfModuleBase { def personaModelId = utils.getNodeText(vnfInputs, 'vnf-persona-model-id') def personaModelVersion = utils.getNodeText(vnfInputs, 'vnf-persona-model-version') if ((personaModelId == null) || (personaModelVersion == null)) { - msoLogger.debug("Skipping update for Generic VNF ' + vnfId + ' because either \'vnf-persona-model-id\' or \'vnf-persona-model-version\' is absent") + logger.debug("Skipping update for Generic VNF ' + vnfId + ' because either \'vnf-persona-model-id\' or \'vnf-persona-model-version\' is absent") execution.setVariable('DOUPVfMod_skipUpdateGenericVnf', true) } else { def personaModelIdElement = '<model-invariant-id>' + personaModelId + '</model-invariant-id>' @@ -728,15 +747,17 @@ public class DoUpdateVfModule extends VfModuleBase { """ updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest) execution.setVariable('DOUPVfMod_updateAAIGenericVnfRequest', updateAAIGenericVnfRequest) - msoLogger.debug("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest) - msoLogger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest) + logger.debug("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest) + logger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest) } - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) } } @@ -751,7 +772,7 @@ public class DoUpdateVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def vnfId = execution.getVariable('DOUPVfMod_vnfId') @@ -798,17 +819,19 @@ public class DoUpdateVfModule extends VfModuleBase { </UpdateAAIVfModuleRequest> """ - msoLogger.debug('Unformatted updateAAIVfModuleRequest: ' + updateAAIVfModuleRequest) + logger.debug('Unformatted updateAAIVfModuleRequest: ' + updateAAIVfModuleRequest) updateAAIVfModuleRequest = utils.formatXml(updateAAIVfModuleRequest) execution.setVariable('DOUPVfMod_updateAAIVfModuleRequest', updateAAIVfModuleRequest) - msoLogger.debug("updateAAIVfModuleRequest : " + updateAAIVfModuleRequest) - msoLogger.debug('Request for UpdateAAIVfModule:\n' + updateAAIVfModuleRequest) + logger.debug("updateAAIVfModuleRequest : " + updateAAIVfModuleRequest) + logger.debug('Request for UpdateAAIVfModule:\n' + updateAAIVfModuleRequest) - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIVfModule(): ' + e.getMessage()) } } @@ -824,7 +847,7 @@ public class DoUpdateVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { String uuid = execution.getVariable('testReqId') // for junits @@ -901,15 +924,17 @@ public class DoUpdateVfModule extends VfModuleBase { """ sdncTopologyRequest = utils.formatXml(sdncTopologyRequest) execution.setVariable('DOUPVfMod_sdncActivateRequest', sdncTopologyRequest) - msoLogger.debug("sdncActivateRequest : " + sdncTopologyRequest) - msoLogger.debug('Request for SDNCAdapter topology/activate:\n' + sdncTopologyRequest) + logger.debug("sdncActivateRequest : " + sdncTopologyRequest) + logger.debug('Request for SDNCAdapter topology/activate:\n' + sdncTopologyRequest) - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyAct(): ' + e.getMessage()) } } @@ -924,17 +949,21 @@ public class DoUpdateVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def WorkflowException workflowException = (WorkflowException) execution.getVariable('WorkflowException') - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, method + ' caught WorkflowException: ' + workflowException.getErrorMessage(), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + method + ' caught WorkflowException: ' + workflowException.getErrorMessage(), "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue()); - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildWorkflowException(execution, 1002, 'Error in handleWorkflowException(): ' + e.getMessage()) } } @@ -943,26 +972,26 @@ public class DoUpdateVfModule extends VfModuleBase { def prefix = execution.getVariable("prefix") - msoLogger.trace("STARTED ValidateSDNCResponse Process") + logger.trace("STARTED ValidateSDNCResponse Process") WorkflowException workflowException = execution.getVariable("WorkflowException") boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - msoLogger.debug("workflowException: " + workflowException) + logger.debug("workflowException: " + workflowException) SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - msoLogger.debug("SDNCResponse: " + response) + logger.debug("SDNCResponse: " + response) String sdncResponse = response if(execution.getVariable(prefix + 'sdncResponseSuccess') == true){ - msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse) + logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse) }else{ - msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") + logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") throw new BpmnError("MSOWorkflowException") } - msoLogger.trace("COMPLETED ValidateSDNCResponse Process") + logger.trace("COMPLETED ValidateSDNCResponse Process") } /** @@ -976,7 +1005,7 @@ public class DoUpdateVfModule extends VfModuleBase { def method = getClass().getSimpleName() + '.getVfModule(' + 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def vnfId = execution.getVariable('DOUPVfMod_vnfId') @@ -988,30 +1017,32 @@ public class DoUpdateVfModule extends VfModuleBase { execution.setVariable('DOUPVfMod_queryAAIVfModuleResponseCode', 200) execution.setVariable('DOUPVfMod_queryAAIVfModuleResponse', genericVnf.get()) // Parse the VNF record from A&AI to find base module info - msoLogger.debug('Parsing the VNF data to find base module info') + logger.debug('Parsing the VNF data to find base module info') if (genericVnf.get().getVfModules()!=null && !genericVnf.get().getVfModules().getVfModule().isEmpty()) { Optional<org.onap.aai.domain.yang.VfModule> vfmodule = genericVnf.get().getVfModules().getVfModule().stream(). filter{v-> v.isIsBaseVfModule()}.findFirst() if (vfmodule.isPresent()) { String baseModuleId = vfmodule.get().getVfModuleId() execution.setVariable("DOUPVfMod_baseVfModuleId", baseModuleId) - msoLogger.debug('Received baseVfModuleId: ' + baseModuleId) + logger.debug('Received baseVfModuleId: ' + baseModuleId) String baseModuleHeatStackId = vfmodule.get().getHeatStackId() execution.setVariable("DOUPVfMod_baseVfModuleHeatStackId", baseModuleHeatStackId) - msoLogger.debug('Received baseVfModuleHeatStackId: ' + baseModuleHeatStackId) + logger.debug('Received baseVfModuleHeatStackId: ' + baseModuleHeatStackId) } } } } catch (Exception ex) { ex.printStackTrace() - msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) } - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy index 9eb05cf64a..0781553879 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy @@ -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 @@ -40,6 +42,8 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.onap.so.utils.TargetEntity /** @@ -47,7 +51,7 @@ import org.onap.so.utils.TargetEntity * with the update of a generic vnf and related VF modules. */ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoUpdateVnfAndModules.class); + private static final Logger logger = LoggerFactory.getLogger( DoUpdateVnfAndModules.class); String Prefix="DUVAM_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -63,7 +67,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { public void preProcessRequest(DelegateExecution execution) { execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED DoUpdateVnfAndModules PreProcessRequest Process") + logger.trace("STARTED DoUpdateVnfAndModules PreProcessRequest Process") try{ // Get Variables @@ -71,24 +75,24 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { String requestId = execution.getVariable("msoRequestId") execution.setVariable("requestId", requestId) execution.setVariable("mso-request-id", requestId) - msoLogger.debug("Incoming Request Id is: " + requestId) + logger.debug("Incoming Request Id is: " + requestId) String serviceInstanceId = execution.getVariable("serviceInstanceId") - msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) + logger.debug("Incoming Service Instance Id is: " + serviceInstanceId) String vnfId = execution.getVariable("vnfId") - msoLogger.debug("Incoming Vnf Id is: " + vnfId) + logger.debug("Incoming Vnf Id is: " + vnfId) String source = "VID" execution.setVariable("DUVAM_source", source) - msoLogger.debug("Incoming Source is: " + source) + logger.debug("Incoming Source is: " + source) String sdncVersion = execution.getVariable("sdncVersion") if (sdncVersion == null) { sdncVersion = "1702" } execution.setVariable("DUVAM_sdncVersion", sdncVersion) - msoLogger.debug("Incoming Sdnc Version is: " + sdncVersion) + logger.debug("Incoming Sdnc Version is: " + sdncVersion) VnfResource vnfResource = (VnfResource) execution.getVariable("vnfResourceDecomposition") @@ -97,44 +101,44 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { String serviceId = execution.getVariable("productFamilyId") execution.setVariable("DUVAM_serviceId", serviceId) - msoLogger.debug("Incoming Service Id is: " + serviceId) + logger.debug("Incoming Service Id is: " + serviceId) String modelUuid = jsonUtil.getJsonValue(vnfModelInfo, "modelUuid") execution.setVariable("DUVAM_modelUuid", modelUuid) - msoLogger.debug("Incoming modelUuid is: " + modelUuid) + logger.debug("Incoming modelUuid is: " + modelUuid) String modelCustomizationUuid = jsonUtil.getJsonValue(vnfModelInfo, "modelCustomizationUuid") execution.setVariable("DUVAM_modelCustomizationUuid", modelCustomizationUuid) - msoLogger.debug("Incoming Model Customization Uuid is: " + modelCustomizationUuid) + logger.debug("Incoming Model Customization Uuid is: " + modelCustomizationUuid) String cloudSiteId = execution.getVariable("lcpCloudRegionId") execution.setVariable("DUVAM_cloudSiteId", cloudSiteId) - msoLogger.debug("Incoming Cloud Site Id is: " + cloudSiteId) + logger.debug("Incoming Cloud Site Id is: " + cloudSiteId) String tenantId = execution.getVariable("tenantId") execution.setVariable("DUVAM_tenantId", tenantId) - msoLogger.debug("Incoming Tenant Id is: " + tenantId) + logger.debug("Incoming Tenant Id is: " + tenantId) String globalSubscriberId = execution.getVariable("globalSubscriberId") if (globalSubscriberId == null) { globalSubscriberId = "" } execution.setVariable("DUVAM_globalSubscriberId", globalSubscriberId) - msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) + logger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) execution.setVariable("DUVAM_moduleCount", 0) execution.setVariable("DUVAM_nextModule", 0) }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") + logger.debug("Rethrowing MSOWorkflowException") throw b }catch(Exception e){ - msoLogger.debug(" Error Occured in DoUpdateVnfAndModules PreProcessRequest method!" + e.getMessage()) + logger.debug(" Error Occured in DoUpdateVnfAndModules PreProcessRequest method!" + e.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoUpdateVnfAndModules PreProcessRequest") } - msoLogger.trace("COMPLETED DoUpdateVnfAndModules PreProcessRequest Process ") + logger.trace("COMPLETED DoUpdateVnfAndModules PreProcessRequest Process ") } /** @@ -148,7 +152,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { def method = getClass().getSimpleName() + '.queryAAIVfModule(' + 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def vnfId = execution.getVariable('vnfId') @@ -156,7 +160,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { AaiUtil aaiUriUtil = new AaiUtil(this) AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE) String endPoint = aaiUriUtil.createAaiUri(uri) - msoLogger.debug("AAI endPoint: " + endPoint) + logger.debug("AAI endPoint: " + endPoint) try { HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), TargetEntity.AAI) @@ -167,33 +171,33 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { def responseData = '' - msoLogger.debug('sending GET to AAI endpoint \'' + endPoint + '\'') + logger.debug('sending GET to AAI endpoint \'' + endPoint + '\'') Response response = client.get() - msoLogger.debug("createVfModule - invoking httpGet() to AAI") + logger.debug("createVfModule - invoking httpGet() to AAI") responseData = response.readEntity(String.class) if (responseData != null) { - msoLogger.debug("Received generic VNF data: " + responseData) + logger.debug("Received generic VNF data: " + responseData) } - msoLogger.debug("createVfModule - queryAAIVfModule Response: " + responseData) - msoLogger.debug("createVfModule - queryAAIVfModule ResponseCode: " + response.getStatus()) + logger.debug("createVfModule - queryAAIVfModule Response: " + responseData) + logger.debug("createVfModule - queryAAIVfModule ResponseCode: " + response.getStatus()) execution.setVariable('DUVAM_queryAAIVfModuleResponseCode', response.getStatus()) execution.setVariable('DUVAM_queryAAIVfModuleResponse', responseData) - msoLogger.debug('Response code:' + response.getStatus()) - msoLogger.debug('Response:' + System.lineSeparator() + responseData) + logger.debug('Response code:' + response.getStatus()) + logger.debug('Response:' + System.lineSeparator() + responseData) //Map<String, String>[] vfModules = new HashMap<String,String>[] def vfModulesList = new ArrayList<Map<String,String>>() def vfModules = null def vfModuleBaseEntry = null if (response.getStatus() == 200) { // Parse the VNF record from A&AI to find base module info - msoLogger.debug('Parsing the VNF data to find base module info') + logger.debug('Parsing the VNF data to find base module info') if (responseData != null) { def vfModulesText = utils.getNodeXml(responseData, "vf-modules") - msoLogger.debug("vModulesText: " + vfModulesText) + logger.debug("vModulesText: " + vfModulesText) if (vfModulesText != null && !vfModulesText.trim().isEmpty()) { def xmlVfModules= new XmlSlurper().parseText(vfModulesText) vfModules = xmlVfModules.'**'.findAll {it.name() == "vf-module"} @@ -219,7 +223,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { String volumeGroupId = '' - msoLogger.debug("Next module!") + logger.debug("Next module!") def vfModuleRelationships = vfModules[i].'**'.findAll {it.name() == 'relationship-data'} if (vfModuleRelationships.size() > 0) { for (j in 0..vfModuleRelationships.size()-1) { @@ -237,7 +241,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { } vfModuleEntry.put("volumeGroupId", volumeGroupId) - msoLogger.debug("volumeGroupId is: " + volumeGroupId) + logger.debug("volumeGroupId is: " + volumeGroupId) // Save base vf module to add it to the start of the list later if (isBaseVfModule == "true") { @@ -256,20 +260,22 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { } } else { - msoLogger.debug('Response code from AAI GET is: ' + response.getStatusCode()) + logger.debug('Response code from AAI GET is: ' + response.getStatusCode()) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Response code from AAI GET is: ' + response.getStatusCode()) } execution.setVariable("DUVAM_vfModules", vfModulesList) } catch (Exception ex) { ex.printStackTrace() - msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) } - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) } } @@ -277,7 +283,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { public void prepareNextModuleToUpdate(DelegateExecution execution){ execution.setVariable("prefix", Prefix) - msoLogger.trace("STARTED prepareNextModuleToUpdate ") + logger.trace("STARTED prepareNextModuleToUpdate ") try { int i = execution.getVariable("DUVAM_nextModule") @@ -294,7 +300,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { execution.setVariable("DUVAM_isBaseVfModule", isBaseVfModule) String modelInvariantUuid = vfModule.get("modelInvariantUuid") - msoLogger.debug("ModelInvariantUuid: " + modelInvariantUuid) + logger.debug("ModelInvariantUuid: " + modelInvariantUuid) def volumeGroupId = vfModule.get("volumeGroupId") execution.setVariable("DUVAM_volumeGroupId", volumeGroupId) @@ -309,13 +315,13 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { for (j in 0..moduleResources.size()-1) { ModelInfo modelInfo = moduleResources[j].getModelInfo() String modelInvariantUuidFromDecomposition = modelInfo.getModelInvariantUuid() - msoLogger.debug("modelInvariantUuidFromDecomposition: " + modelInvariantUuidFromDecomposition) + logger.debug("modelInvariantUuidFromDecomposition: " + modelInvariantUuidFromDecomposition) if (modelInvariantUuid.equals(modelInvariantUuidFromDecomposition)) { String vfModuleModelInfo = modelInfo.toJsonString() String vfModuleModelInfoValue = jsonUtil.getJsonValue(vfModuleModelInfo, "modelInfo") execution.setVariable("DUVAM_vfModuleModelInfo", vfModuleModelInfoValue) - msoLogger.debug("vfModuleModelInfo: " + vfModuleModelInfoValue) + logger.debug("vfModuleModelInfo: " + vfModuleModelInfoValue) break } @@ -323,10 +329,12 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { } }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessAddOnModule. Exception is:\n" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing preProcessAddOnModule. Exception is:\n" + e, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareNextModuleToUpdate Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED prepareNextModuleToUpdate ") + logger.trace("COMPLETED prepareNextModuleToUpdate ") } @@ -340,7 +348,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def vnfId = execution.getVariable('vnfId') @@ -389,15 +397,17 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { """ updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest) execution.setVariable('DUVAM_updateAAIGenericVnfRequest', updateAAIGenericVnfRequest) - msoLogger.debug("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest) - msoLogger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest) + logger.debug("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest) + logger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest) - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) } } @@ -412,6 +422,6 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HealchCheckActivate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HealchCheckActivate.groovy index 4deb53f0ce..dfd021702a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HealchCheckActivate.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HealchCheckActivate.groovy @@ -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 @@ -24,15 +26,11 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; import org.apache.commons.lang3.* -import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger public class HealthCheckActivate extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, HealthCheckActivate.class); - /** * Validates the request message and sets up the workflow. * @param execution the execution diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy index 671796f27f..0454bb4876 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -34,12 +36,14 @@ import org.onap.so.client.appc.ApplicationControllerOrchestrator import org.onap.so.client.appc.ApplicationControllerSupport import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import groovy.json.JsonOutput import groovy.json.JsonSlurper public class ReplaceVnfInfra extends VnfCmBase { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ReplaceVnfInfra.class); + private static final Logger logger = LoggerFactory.getLogger( ReplaceVnfInfra.class); ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtils = new JsonUtils() @@ -93,18 +97,18 @@ public class ReplaceVnfInfra extends VnfCmBase { ')' initProcessVariables(execution) - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) initProcessVariables(execution) def incomingRequest = execution.getVariable('bpmnRequest') - msoLogger.debug("Incoming Infra Request: " + incomingRequest) + logger.debug("Incoming Infra Request: " + incomingRequest) try { def jsonSlurper = new JsonSlurper() def jsonOutput = new JsonOutput() Map reqMap = jsonSlurper.parseText(incomingRequest) - msoLogger.debug(" Request is in JSON format.") + logger.debug(" Request is in JSON format.") def serviceInstanceId = execution.getVariable('serviceInstanceId') def vnfId = execution.getVariable('vnfId') @@ -129,12 +133,12 @@ public class ReplaceVnfInfra extends VnfCmBase { if (relatedInstanceList != null) { relatedInstanceList.each { if (it.relatedInstance.modelInfo?.modelType == 'service') { - msoLogger.debug("PROCESSING SERVICE INFO") + logger.debug("PROCESSING SERVICE INFO") asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion serviceModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo) - msoLogger.debug("ServiceModelInfo: " + serviceModelInfo) + logger.debug("ServiceModelInfo: " + serviceModelInfo) def modelInvariant = jsonUtils.getJsonValue(serviceModelInfo, "modelInvariantUuid") - msoLogger.debug("modelInvariant: " + modelInvariant) + logger.debug("modelInvariant: " + modelInvariant) } } @@ -146,7 +150,7 @@ public class ReplaceVnfInfra extends VnfCmBase { execution.setVariable('vnfModelInfo', vnfModelInfo) def vnfModelInvariantUuid = jsonUtils.getJsonValue(vnfModelInfo, "modelInvariantUuid") execution.setVariable('vnfModelInvariantUuid', vnfModelInvariantUuid) - msoLogger.debug("vnfModelInvariantUuid: " + vnfModelInvariantUuid) + logger.debug("vnfModelInvariantUuid: " + vnfModelInvariantUuid) def vnfType = execution.getVariable('vnfType') execution.setVariable('vnfType', vnfType) @@ -155,7 +159,7 @@ public class ReplaceVnfInfra extends VnfCmBase { def controllerType = reqMap.requestDetails?.requestParameters?.controllerType execution.setVariable('controllerType', controllerType) - msoLogger.debug('Controller Type: ' + controllerType) + logger.debug('Controller Type: ' + controllerType) def userParams = reqMap.requestDetails?.requestParameters?.userParams @@ -166,13 +170,13 @@ public class ReplaceVnfInfra extends VnfCmBase { } } - msoLogger.debug('Processed user params: ' + userParamsMap) + logger.debug('Processed user params: ' + userParamsMap) execution.setVariable('vfModuleInputParams', userParamsMap) def requestId = execution.getVariable("requestId") execution.setVariable('msoRequestId', requestId) - msoLogger.debug("requestId is: " + requestId) + logger.debug("requestId is: " + requestId) def vnfName = reqMap.requestDetails?.requestInfo?.instanceName ?: null execution.setVariable('vnfName', vnfName) @@ -217,19 +221,21 @@ public class ReplaceVnfInfra extends VnfCmBase { execution.setVariable("requestInfo", requestInfo) - msoLogger.debug('RequestInfo: ' + execution.getVariable("requestInfo")) + logger.debug('RequestInfo: ' + execution.getVariable("requestInfo")) - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch(groovy.json.JsonException je) { - msoLogger.debug(" Request is not in JSON format.") + logger.debug(" Request is not in JSON format.") exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format") } catch(Exception e) { String restFaultMessage = e.getMessage() - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) } } @@ -244,7 +250,7 @@ public class ReplaceVnfInfra extends VnfCmBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { @@ -266,11 +272,13 @@ public class ReplaceVnfInfra extends VnfCmBase { sendWorkflowResponse(execution, 200, synchResponse) - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) } } @@ -288,25 +296,25 @@ public class ReplaceVnfInfra extends VnfCmBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") String vnfModelInvariantUuid = execution.getVariable('vnfModelInvariantUuid') - msoLogger.debug("vnfModelInvariantUuid: " + vnfModelInvariantUuid) + logger.debug("vnfModelInvariantUuid: " + vnfModelInvariantUuid) List<VnfResource> vnfResources = serviceDecomposition.getVnfResources() for (i in 0..vnfResources.size()-1) { ModelInfo modelInfo = vnfResources[i].getModelInfo() String modelInvariantUuidFromDecomposition = modelInfo.getModelInvariantUuid() - msoLogger.debug("modelInvariantUuidFromDecomposition: " + modelInvariantUuidFromDecomposition) + logger.debug("modelInvariantUuidFromDecomposition: " + modelInvariantUuidFromDecomposition) if (vnfModelInvariantUuid.equals(modelInvariantUuidFromDecomposition)) { VnfResource vnfResourceDecomposition = vnfResources[i] execution.setVariable('vnfResourceDecomposition', vnfResourceDecomposition) def nfRole = vnfResourceDecomposition.getNfRole() execution.setVariable('nfRole', nfRole) - msoLogger.debug("vnfResourceDecomposition: " + vnfResourceDecomposition.toJsonString()) + logger.debug("vnfResourceDecomposition: " + vnfResourceDecomposition.toJsonString()) break } else { @@ -315,11 +323,13 @@ public class ReplaceVnfInfra extends VnfCmBase { } - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage()) } } @@ -338,7 +348,7 @@ public class ReplaceVnfInfra extends VnfCmBase { execution.setVariable('errorCode', "0") execution.setVariable("workStep", "checkIfVnfInMaintInAAI") execution.setVariable("failedActivity", "AAI") - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { AAIRestClientImpl client = new AAIRestClientImpl() @@ -346,7 +356,7 @@ public class ReplaceVnfInfra extends VnfCmBase { aaiValidator.setClient(client) def vnfId = execution.getVariable("vnfId") boolean isInMaint = aaiValidator.isVNFLocked(vnfId) - msoLogger.debug("isInMaint result: " + isInMaint) + logger.debug("isInMaint result: " + isInMaint) execution.setVariable('isVnfInMaintenance', isInMaint) if (isInMaint) { @@ -355,11 +365,13 @@ public class ReplaceVnfInfra extends VnfCmBase { } - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) @@ -379,7 +391,7 @@ public class ReplaceVnfInfra extends VnfCmBase { ')' execution.setVariable('errorCode', "0") - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable("workStep", "checkIfPserversInMaintInAAI") execution.setVariable("failedActivity", "AAI") @@ -389,7 +401,7 @@ public class ReplaceVnfInfra extends VnfCmBase { aaiValidator.setClient(client) def vnfId = execution.getVariable("vnfId") boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId) - msoLogger.debug("areLocked result: " + areLocked) + logger.debug("areLocked result: " + areLocked) execution.setVariable('arePserversLocked', areLocked) if (areLocked) { @@ -397,11 +409,13 @@ public class ReplaceVnfInfra extends VnfCmBase { execution.setVariable("errorText", "pServers are locked in A&AI") } - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage()) @@ -421,7 +435,7 @@ public class ReplaceVnfInfra extends VnfCmBase { ')' execution.setVariable('errorCode', "0") - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) if (inMaint) { execution.setVariable("workStep", "setVnfInMaintFlagInAAI") } @@ -443,11 +457,13 @@ public class ReplaceVnfInfra extends VnfCmBase { aaiUpdator.updateVnfToUnLocked(vnfId) } - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } @@ -466,10 +482,10 @@ public class ReplaceVnfInfra extends VnfCmBase { ')' execution.setVariable('errorCode', "0") - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { - msoLogger.debug("Running APP-C action: " + action.toString()) + logger.debug("Running APP-C action: " + action.toString()) String vnfId = execution.getVariable('vnfId') String msoRequestId = execution.getVariable('requestId') execution.setVariable('msoRequestId', msoRequestId) @@ -504,26 +520,32 @@ public class ReplaceVnfInfra extends VnfCmBase { default: break } - msoLogger.debug("Completed AppC request") + logger.debug("Completed AppC request") int appcCode = appcStatus.getCode() - msoLogger.debug("AppC status code is: " + appcCode) - msoLogger.debug("AppC status message is: " + appcStatus.getMessage()) + logger.debug("AppC status code is: " + appcCode) + logger.debug("AppC status message is: " + appcStatus.getMessage()) if (support.getCategoryOf(appcStatus) == ApplicationControllerSupport.StatusCategory.ERROR) { execution.setVariable("errorCode", Integer.toString(appcCode)) execution.setVariable("errorText", appcStatus.getMessage()) } - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } catch (java.lang.NoSuchMethodError e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } @@ -543,10 +565,10 @@ public class ReplaceVnfInfra extends VnfCmBase { ')' execution.setVariable('errorCode', "0") - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable("workStep", "doDeleteVnfAndModules") execution.setVariable("failedActivity", "MSO Delete VNF") - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } @@ -562,10 +584,10 @@ public class ReplaceVnfInfra extends VnfCmBase { ')' execution.setVariable('errorCode', "0") - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable("workStep", "doCreateVnfAndModules") execution.setVariable("failedActivity", "MSO Create VNF") - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } @@ -580,7 +602,7 @@ public class ReplaceVnfInfra extends VnfCmBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) def errorText = execution.getVariable("errorText") def errorCode = execution.getVariable("errorCode") @@ -598,7 +620,7 @@ public class ReplaceVnfInfra extends VnfCmBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) def taskId = execution.getVariable("taskId") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy index 22b44c9ead..5b0b92415d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy @@ -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 @@ -54,9 +56,11 @@ import org.onap.appc.client.lcm.model.Action; import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory public class RollbackVnf extends VnfCmBase { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, RollbackVnf.class); + private static final Logger logger = LoggerFactory.getLogger( RollbackVnf.class); ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtils = new JsonUtils() @@ -92,7 +96,7 @@ public class RollbackVnf extends VnfCmBase { ')' initProcessVariables(execution) - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) initProcessVariables(execution) @@ -101,16 +105,18 @@ public class RollbackVnf extends VnfCmBase { execution.setVariable("rollbackErrorCode", "0") if (execution.getVariable("rollbackSetClosedLoopDisabledFlag") == true) { - msoLogger.debug("Will call setClosedLoopDisabledFlag") + logger.debug("Will call setClosedLoopDisabledFlag") } - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch(Exception e) { String restFaultMessage = e.getMessage() - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("rollbackErrorCode", "1") exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) } @@ -127,19 +133,19 @@ public class RollbackVnf extends VnfCmBase { ')' initProcessVariables(execution) - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) def rollbackErrorCode = execution.getVariable('rollbackErrorCode') if (rollbackErrorCode == "0") { execution.setVariable('rollbackSuccessful', true) - msoLogger.debug("rollback successful") + logger.debug("rollback successful") } else { execution.setVariable('rollbackSuccessful', false) - msoLogger.debug("rollback unsuccessful") + logger.debug("rollback unsuccessful") } - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy index 687ac215a5..010f3d77f3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 CMCC. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -32,6 +34,8 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.onap.so.utils.UUIDChecker import org.springframework.web.util.UriUtils @@ -41,7 +45,7 @@ import org.springframework.web.util.UriUtils * */ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ScaleCustomE2EServiceInstance.class); + private static final Logger logger = LoggerFactory.getLogger( ScaleCustomE2EServiceInstance.class); String Prefix = "CRESI_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -50,22 +54,22 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor public void preProcessRequest(DelegateExecution execution) { execution.setVariable("prefix", Prefix) String msg = "" - msoLogger.trace("preProcessRequest() ") + logger.trace("preProcessRequest() ") try { String siRequest = execution.getVariable("bpmnRequest") - msoLogger.debug(siRequest) + logger.debug(siRequest) String requestId = execution.getVariable("mso-request-id") execution.setVariable("msoRequestId", requestId) - msoLogger.debug("Input Request:" + siRequest + " reqId:" + requestId) + logger.debug("Input Request:" + siRequest + " reqId:" + requestId) String serviceInstanceId = execution.getVariable("serviceInstanceId") if (isBlank(serviceInstanceId)) { serviceInstanceId = "NULL".toString() } - msoLogger.debug("Generated new Service Instance:" + serviceInstanceId) + logger.debug("Generated new Service Instance:" + serviceInstanceId) serviceInstanceId = UriUtils.encode(serviceInstanceId, "UTF-8") execution.setVariable("serviceInstanceId", serviceInstanceId) @@ -83,7 +87,7 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor //String operationKey = UUIDChecker.generateUUID(msoLogger) String operationId = jsonUtil.getJsonValue(siRequest, "operationId") execution.setVariable("operationId", operationId) - msoLogger.debug("Input Request:" + siRequest + " operationId:" + operationId) + logger.debug("Input Request:" + siRequest + " operationId:" + operationId) String resources = jsonUtil.getJsonValue(siRequest, "service.resources") @@ -110,35 +114,35 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor throw e; } catch (Exception ex) { msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit preProcessRequest ") + logger.trace("Exit preProcessRequest ") } public void sendSyncResponse(DelegateExecution execution) { - msoLogger.trace("sendSyncResponse ") + logger.trace("sendSyncResponse ") try { String operationId = execution.getVariable("operationId") String serviceInstanceId = execution.getVariable("serviceInstanceId") // RESTResponse for API Handler (APIH) Reply Task String scaleServiceRestRequest = """{"operationId":"${operationId}"}""".trim() - msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + scaleServiceRestRequest) + logger.debug(" sendSyncResponse to APIH:" + "\n" + scaleServiceRestRequest) sendWorkflowResponse(execution, 202, scaleServiceRestRequest) execution.setVariable("sentSyncResponse", true) } catch (Exception ex) { String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit sendSyncResopnse ") + logger.trace("Exit sendSyncResopnse ") } public void sendSyncError(DelegateExecution execution) { - msoLogger.trace("sendSyncError ") + logger.trace("sendSyncError ") try { String errorMessage = "" @@ -155,17 +159,17 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor <aetgt:ErrorCode>7000</aetgt:ErrorCode> </aetgt:WorkflowException>""" - msoLogger.debug(buildworkflowException) + logger.debug(buildworkflowException) sendWorkflowResponse(execution, 500, buildworkflowException) } catch (Exception ex) { - msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + logger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) } } public void prepareCompletionRequest(DelegateExecution execution) { - msoLogger.trace("prepareCompletion ") + logger.trace("prepareCompletion ") try { String requestId = execution.getVariable("msoRequestId") @@ -189,22 +193,22 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) execution.setVariable("CompleteMsoProcessRequest", xmlMsoCompletionRequest) - msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + logger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) } catch (Exception ex) { String msg = " Exception in prepareCompletion:" + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit prepareCompletionRequest ") + logger.trace("Exit prepareCompletionRequest ") } public void prepareFalloutRequest(DelegateExecution execution) { - msoLogger.trace("prepareFalloutRequest ") + logger.trace("prepareFalloutRequest ") try { WorkflowException wfex = execution.getVariable("WorkflowException") - msoLogger.debug(" Input Workflow Exception: " + wfex.toString()) + logger.debug(" Input Workflow Exception: " + wfex.toString()) String requestId = execution.getVariable("msoRequestId") String source = execution.getVariable("source") String requestInfo = @@ -217,7 +221,7 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) execution.setVariable("falloutRequest", falloutRequest) } catch (Exception ex) { - msoLogger.debug("Exception prepareFalloutRequest:" + ex.getMessage()) + logger.debug("Exception prepareFalloutRequest:" + ex.getMessage()) String errorException = " Bpmn error encountered in ScaleGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() String requestId = execution.getVariable("msoRequestId") String falloutRequest = @@ -237,7 +241,7 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor execution.setVariable("falloutRequest", falloutRequest) } - msoLogger.trace("Exit prepareFalloutRequest ") + logger.trace("Exit prepareFalloutRequest ") } @@ -245,7 +249,7 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor * Init the service Operation Status */ public void prepareInitServiceOperationStatus(DelegateExecution execution){ - msoLogger.trace("STARTED prepareInitServiceOperationStatus Process ") + logger.trace("STARTED prepareInitServiceOperationStatus Process ") try{ String serviceId = execution.getVariable("serviceInstanceId") //String serviceName = execution.getVariable("serviceInstanceName") @@ -262,7 +266,7 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - msoLogger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint) + logger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint) String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" @@ -285,13 +289,15 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor payload = utils.formatXml(payload) execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) - msoLogger.info("Outgoing updateServiceOperStatusRequest: \n" + payload) - msoLogger.debug("Scale network service updateServiceOperStatusRequest Request: " + payload) + logger.info("Outgoing updateServiceOperStatusRequest: \n" + payload) + logger.debug("Scale network service updateServiceOperStatusRequest Request: " + payload) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED prepareInitServiceOperationStatus Process ") + logger.trace("COMPLETED prepareInitServiceOperationStatus Process ") } -}
\ No newline at end of file +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy index 4127c3a913..4e3517e5b5 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 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 @@ -43,6 +45,8 @@ 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.springframework.web.util.UriUtils +import org.slf4j.Logger +import org.slf4j.LoggerFactory import groovy.json.* @@ -52,6 +56,8 @@ import groovy.json.* * */ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor { + private static final Logger logger = LoggerFactory.getLogger( UpdateCustomE2EServiceInstance.class); + String Prefix="UPDSI_" ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() @@ -61,7 +67,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) String msg = "" - utils.log("INFO", " *** preProcessRequest() *** ", isDebugEnabled) + logger.info( " *** preProcessRequest() *** ") try { @@ -70,7 +76,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor String requestId = execution.getVariable("mso-request-id") execution.setVariable("msoRequestId", requestId) - utils.log("INFO", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled) + logger.info( "Input Request:" + siRequest + " reqId:" + requestId) String serviceInstanceId = execution.getVariable("serviceInstanceId") if (isBlank(serviceInstanceId)) { @@ -95,32 +101,32 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor if (isBlank(productFamilyId)) { msg = "Input productFamilyId is null" - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) } else { execution.setVariable("productFamilyId", productFamilyId) } //user params String userParams = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams") - utils.log("INFO", "userParams:" + userParams, isDebugEnabled) + logger.info( "userParams:" + userParams) List<String> paramList = jsonUtil.StringArrayToList(execution, userParams) String uuiRequest = jsonUtil.getJsonValue(paramList.get(0), "UUIRequest") if (isBlank(uuiRequest)) { msg = "Input uuiRequest is null" - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } else { execution.setVariable("uuiRequest", uuiRequest) } - utils.log("INFO", "uuiRequest:\n" + uuiRequest, isDebugEnabled) + logger.info( "uuiRequest:\n" + uuiRequest) //serviceType for aai String serviceType = jsonUtil.getJsonValue(uuiRequest, "service.serviceType") if (isBlank(serviceType)) { msg = "Input serviceType is null" - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } else { execution.setVariable("serviceType", serviceType) @@ -128,17 +134,17 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor // target model info String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid") - utils.log("INFO","modelInvariantUuid: " + modelInvariantUuid, isDebugEnabled) + logger.info("modelInvariantUuid: " + modelInvariantUuid) execution.setVariable("modelInvariantUuid", modelInvariantUuid) execution.setVariable("model-invariant-id-target", modelInvariantUuid) String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid") - utils.log("INFO","modelUuid: " + modelUuid, isDebugEnabled) + logger.info("modelUuid: " + modelUuid) execution.setVariable("modelUuid", modelUuid) execution.setVariable("model-version-id-target", modelUuid) String serviceModelName = jsonUtil.getJsonValue(uuiRequest, "service.parameters.templateName") - utils.log("INFO","serviceModelName: " + serviceModelName, isDebugEnabled) + logger.info("serviceModelName: " + serviceModelName) if(serviceModelName == null) { serviceModelName = "" } @@ -157,10 +163,10 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) + logger.info(" ***** Exit preProcessRequest *****") } /** @@ -203,7 +209,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor public void postCompareModelVersions(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " ======== STARTED postCompareModelVersions Process ======== ", isDebugEnabled) + logger.debug( " ======== STARTED postCompareModelVersions Process ======== ") def hasResourcetoUpdate = false def hasResourcetoAdd = false @@ -222,7 +228,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor hasResourcetoUpdate = hasResourcetoAdd || hasResourcetoDelete execution.setVariable("hasResourcetoUpdate", hasResourcetoUpdate) - utils.log("DEBUG", "======== COMPLETED postCompareModelVersions Process ======== ", isDebugEnabled) + logger.debug( "======== COMPLETED postCompareModelVersions Process ======== ") } /** @@ -230,7 +236,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor */ public void prepareInitServiceOperationStatus(DelegateExecution execution){ def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " ======== STARTED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) + logger.debug( " ======== STARTED prepareInitServiceOperationStatus Process ======== ") try{ String serviceId = execution.getVariable("serviceInstanceId") String operationId = execution.getVariable("operationId") @@ -240,7 +246,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor String progress = "0" String reason = "" String operationContent = "Prepare service updating" - utils.log("DEBUG", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled) + logger.debug( "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId) serviceId = UriUtils.encode(serviceId,"UTF-8") execution.setVariable("serviceInstanceId", serviceId) execution.setVariable("operationId", operationId) @@ -248,7 +254,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) + logger.debug( "DB Adapter Endpoint is: " + dbAdapterEndpoint) String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" @@ -270,14 +276,14 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor payload = utils.formatXml(payload) execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) - utils.log("DEBUG", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled) + logger.error( "Outgoing updateServiceOperStatusRequest: \n" + payload) utils.logAudit("CreateVfModuleInfra Outgoing updateServiceOperStatusRequest Request: " + payload) }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e, isDebugEnabled) + logger.debug( "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e) execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) } - utils.log("DEBUG", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) + logger.debug( "======== COMPLETED prepareInitServiceOperationStatus Process ======== ") } /** @@ -286,7 +292,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor public void preUpdateServiceOperationStatus(DelegateExecution execution){ def method = getClass().getSimpleName() + '.preUpdateServiceOperationStatus(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO","Entered " + method, isDebugEnabled) + logger.info("Entered " + method) try{ String serviceId = execution.getVariable("serviceInstanceId") @@ -297,11 +303,11 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor String progress = execution.getVariable("progress") String reason = execution.getVariable("operationReason") String userId = "" - utils.log("INFO", "progress: " + progress , isDebugEnabled) + logger.info( "progress: " + progress ) String operationContent = "Prepare service : " + execution.getVariable("operationStatus") - utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled) + logger.info( "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId) serviceId = UriUtils.encode(serviceId,"UTF-8") execution.setVariable("serviceInstanceId", serviceId) execution.setVariable("operationId", operationId) @@ -309,7 +315,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) + logger.info( "DB Adapter Endpoint is: " + dbAdapterEndpoint) String payload = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" @@ -331,20 +337,20 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor payload = utils.formatXml(payload) execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) - utils.log("INFO", "Outgoing preUpdateServiceOperationStatus: \n" + payload, isDebugEnabled) + logger.error( "Outgoing preUpdateServiceOperationStatus: \n" + payload) }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing preUpdateServiceOperationStatus. Exception is:\n" + e, isDebugEnabled) + logger.info( "Exception Occured Processing preUpdateServiceOperationStatus. Exception is:\n" + e) execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preUpdateServiceOperationStatus Method:\n" + e.getMessage()) } - utils.log("INFO", "======== COMPLETED preUpdateServiceOperationStatus Process ======== ", isDebugEnabled) - utils.log("INFO", "Exited " + method, isDebugEnabled) + logger.info( "======== COMPLETED preUpdateServiceOperationStatus Process ======== ") + logger.info( "Exited " + method) } public void sendSyncResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " *** sendSyncResponse *** ", isDebugEnabled) + logger.info( " *** sendSyncResponse *** ") try { String operationId = execution.getVariable("operationId") @@ -359,21 +365,21 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor updateServiceResp = """{"OperationResult":"No Resource to Add or Delete or Service Instance not found in AAI."}""" } - utils.log("INFO", " sendSyncResponse to APIH:" + "\n" + updateServiceResp, isDebugEnabled) + logger.info( " sendSyncResponse to APIH:" + "\n" + updateServiceResp) sendWorkflowResponse(execution, 202, updateServiceResp) execution.setVariable("sentSyncResponse", true) } catch (Exception ex) { String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - utils.log("INFO"," ***** Exit sendSyncResopnse *****", isDebugEnabled) + logger.info(" ***** Exit sendSyncResopnse *****") } public void sendSyncError (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " *** sendSyncError *** ", isDebugEnabled) + logger.info( " *** sendSyncError *** ") try { String errorMessage = "" @@ -396,14 +402,14 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor sendWorkflowResponse(execution, 500, buildworkflowException) } catch (Exception ex) { - utils.log("INFO", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) + logger.info( " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) } } public void prepareCompletionRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " *** prepareCompletion *** ", isDebugEnabled) + logger.info( " *** prepareCompletion *** ") try { String requestId = execution.getVariable("msoRequestId") @@ -427,23 +433,23 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) execution.setVariable("completionRequest", xmlMsoCompletionRequest) - utils.log("INFO", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) + logger.info( " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) } catch (Exception ex) { String msg = " Exception in prepareCompletion:" + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - utils.log("INFO", "*** Exit prepareCompletionRequest ***", isDebugEnabled) + logger.info( "*** Exit prepareCompletionRequest ***") } public void prepareFalloutRequest(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " *** prepareFalloutRequest *** ", isDebugEnabled) + logger.info( " *** prepareFalloutRequest *** ") try { WorkflowException wfex = execution.getVariable("WorkflowException") - utils.log("INFO", " Input Workflow Exception: " + wfex.toString(), isDebugEnabled) + logger.info( " Input Workflow Exception: " + wfex.toString()) String requestId = execution.getVariable("msoRequestId") String source = execution.getVariable("source") String requestInfo = @@ -456,7 +462,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) execution.setVariable("falloutRequest", falloutRequest) } catch (Exception ex) { - utils.log("INFO", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled) + logger.info( "Exception prepareFalloutRequest:" + ex.getMessage()) String errorException = " Bpmn error encountered in UpdateCustomE2EServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() String requestId = execution.getVariable("msoRequestId") String falloutRequest = @@ -476,6 +482,6 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor execution.setVariable("falloutRequest", falloutRequest) } - utils.log("INFO", "*** Exit prepareFalloutRequest ***", isDebugEnabled) + logger.info( "*** Exit prepareFalloutRequest ***") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy index 329d58aa58..0b46a5a849 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy @@ -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,7 +30,8 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import groovy.json.* @@ -37,7 +40,7 @@ import groovy.json.* * */ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateNetworkInstance.class); + private static final Logger logger = LoggerFactory.getLogger( UpdateNetworkInstance.class); String Prefix="UPDNI_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -70,7 +73,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside preProcessRequest() of UpdateNetworkInstance Request") + logger.trace("Inside preProcessRequest() of UpdateNetworkInstance Request") try { // initialize flow variables @@ -85,20 +88,20 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { String disableRollback = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.requestInfo.suppressRollback") if (disableRollback != null) { execution.setVariable("disableRollback", disableRollback) - msoLogger.debug("Received 'suppressRollback': " + disableRollback ) + logger.debug("Received 'suppressRollback': " + disableRollback ) } else { execution.setVariable("disableRollback", false) } - msoLogger.debug(" Set 'disableRollback' : " + execution.getVariable("disableRollback") ) + logger.debug(" Set 'disableRollback' : " + execution.getVariable("disableRollback") ) } else { String dataErrorMessage = " Invalid 'bpmnRequest' request." - msoLogger.debug(dataErrorMessage) + logger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } } else { // 'macro' TEST ONLY, sdncVersion = '1702' - msoLogger.debug(" \'disableRollback\' : " + execution.getVariable("disableRollback") ) + logger.debug(" \'disableRollback\' : " + execution.getVariable("disableRollback") ) } String requestId = execution.getVariable("msoRequestId") @@ -143,7 +146,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { sendSyncError(execution) // caught exception String exceptionMessage = "Exception Encountered in UpdateNetworkInstance, PreProcessRequest() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -153,7 +156,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside sendSyncResponse() of UpdateNetworkInstance") + logger.trace("Inside sendSyncResponse() of UpdateNetworkInstance") try { String requestId = execution.getVariable("mso-request-id") @@ -162,12 +165,12 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { // RESTResponse (for API Handler (APIH) Reply Task) String updateNetworkRestRequest = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() - msoLogger.debug(" sendSyncResponse to APIH - " + "\n" + updateNetworkRestRequest) + logger.debug(" sendSyncResponse to APIH - " + "\n" + updateNetworkRestRequest) sendWorkflowResponse(execution, 202, updateNetworkRestRequest) } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in UpdateNetworkInstance flow. sendSyncResponse() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -178,7 +181,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) - msoLogger.trace("Inside getNetworkModelInfo() of UpdateNetworkInstance") + logger.trace("Inside getNetworkModelInfo() of UpdateNetworkInstance") try { @@ -191,7 +194,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { } catch (Exception ex) { sendSyncError(execution) String exceptionMessage = "Bpmn error encountered in UpdateNetworkInstance flow. getNetworkModelInfo() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -203,7 +206,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) - msoLogger.trace("Inside sendSyncError() of UpdateNetworkInstance") + logger.trace("Inside sendSyncError() of UpdateNetworkInstance") try { @@ -216,7 +219,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { sendWorkflowResponse(execution, 500, syncError) } catch (Exception ex) { - msoLogger.debug(" Bpmn error encountered in UpdateNetworkInstance flow. sendSyncError() - " + ex.getMessage()) + logger.debug(" Bpmn error encountered in UpdateNetworkInstance flow. sendSyncError() - " + ex.getMessage()) } } @@ -225,7 +228,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside prepareCompletion() of UpdateNetworkInstance") + logger.trace("Inside prepareCompletion() of UpdateNetworkInstance") try { @@ -250,11 +253,11 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { // normal path execution.setVariable(Prefix + "Success", true) execution.setVariable(Prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest) - msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + logger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in UpdateNetworkInstance flow. prepareCompletion() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -273,25 +276,25 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) - msoLogger.trace("Inside postProcessResponse() of UpdateNetworkInstance") + logger.trace("Inside postProcessResponse() of UpdateNetworkInstance") try { if (execution.getVariable("CMSO_ResponseCode") == "200") { execution.setVariable(Prefix + "Success", true) - msoLogger.trace("UpdateNetworkInstance Success ") + logger.trace("UpdateNetworkInstance Success ") // Place holder for additional code. } else { execution.setVariable(Prefix + "Success", false) - msoLogger.trace("UpdateNetworkInstance Failed in CompletionMsoProces flow!. ") + logger.trace("UpdateNetworkInstance Failed in CompletionMsoProces flow!. ") } } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in UpdateNetworkInstance flow. postProcessResponse() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } @@ -307,7 +310,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) - msoLogger.trace("Inside processRollbackData() of UpdateNetworkInstance") + logger.trace("Inside processRollbackData() of UpdateNetworkInstance") try { //execution.getVariable("orchestrationStatus") @@ -318,7 +321,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { //rolledBack } catch (Exception ex) { - msoLogger.debug(" Bpmn error encountered in UpdateNetworkInstance flow. callDBCatalog() - " + ex.getMessage()) + logger.debug(" Bpmn error encountered in UpdateNetworkInstance flow. callDBCatalog() - " + ex.getMessage()) } } @@ -328,7 +331,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix", Prefix) - msoLogger.trace("Prepare for FalloutHandler. FAILURE - prepare request for sub-process FalloutHandler. ") + logger.trace("Prepare for FalloutHandler. FAILURE - prepare request for sub-process FalloutHandler. ") String falloutHandlerRequest = "" String requestId = execution.getVariable("mso-request-id") @@ -353,13 +356,13 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { </aetgt:WorkflowException> </aetgt:FalloutHandlerRequest>""" - msoLogger.debug(falloutHandlerRequest) + logger.debug(falloutHandlerRequest) execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) - msoLogger.debug(" Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest) + logger.debug(" Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest) } catch (Exception ex) { String errorException = " Bpmn error encountered in UpdateNetworkInstance flow. FalloutHandlerRequest, buildErrorResponse() - " - msoLogger.debug("Exception error in UpdateNetworkInstance flow, buildErrorResponse(): " + ex.getMessage()) + logger.debug("Exception error in UpdateNetworkInstance flow, buildErrorResponse(): " + ex.getMessage()) falloutHandlerRequest = """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:ns="http://org.onap/so/request/types/v1" @@ -376,7 +379,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { </aetgt:FalloutHandlerRequest>""" execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) - msoLogger.debug(" Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest) + logger.debug(" Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest) } @@ -386,18 +389,18 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) try{ - msoLogger.debug("Caught a Java Exception in " + Prefix) - msoLogger.debug("Started processJavaException Method") - msoLogger.debug("Variables List: " + execution.getVariables()) + logger.debug("Caught a Java Exception in " + Prefix) + logger.debug("Started processJavaException Method") + logger.debug("Variables List: " + execution.getVariables()) execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") }catch(Exception e){ - msoLogger.debug("Caught Exception during processJavaException Method: " + e) + logger.debug("Caught Exception during processJavaException Method: " + e) execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix) } - msoLogger.debug("Completed processJavaException Method in " + Prefix) + logger.debug("Completed processJavaException Method in " + Prefix) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy index b1aaf5ea5f..35947ee4da 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy @@ -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,12 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory public class UpdateVfModule extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateVfModule.class); + private static final Logger logger = LoggerFactory.getLogger( UpdateVfModule.class); ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -66,13 +70,13 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { initProcessVariables(execution) String request = validateRequest(execution) - msoLogger.debug("UpdateVfModule request: " + request) + logger.debug("UpdateVfModule request: " + request) def requestInfo = getRequiredNodeXml(execution, request, 'request-info') execution.setVariable('UPDVfMod_requestInfo', requestInfo) execution.setVariable('UPDVfMod_requestId', getRequiredNodeText(execution, requestInfo, 'request-id')) @@ -88,11 +92,13 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { def vnfParams = utils.getNodeXml(request, 'vnf-params') execution.setVariable('UPDVfMod_vnfParams', vnfParams) - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) } } @@ -107,7 +113,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def requestInfo = execution.getVariable('UPDVfMod_requestInfo') @@ -140,12 +146,14 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { synchResponse = utils.formatXml(synchResponse) sendWorkflowResponse(execution, 200, synchResponse) - msoLogger.debug("UpdateVfModule Synch Response: " + synchResponse) - msoLogger.trace('Exited ' + method) + logger.debug("UpdateVfModule Synch Response: " + synchResponse) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendSynchResponse(): ' + e.getMessage()) } } @@ -165,15 +173,17 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoUpdateVfModule(): ' + e.getMessage()) } } @@ -188,7 +198,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def requestId = execution.getVariable('UPDVfMod_requestId') @@ -220,14 +230,16 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { updateInfraRequest = utils.formatXml(updateInfraRequest) execution.setVariable('UPDVfMod_updateInfraRequest', updateInfraRequest) - msoLogger.debug('Request for Update Infra Request:\n' + updateInfraRequest) + logger.debug('Request for Update Infra Request:\n' + updateInfraRequest) - msoLogger.debug("UpdateVfModule Infra Request: " + updateInfraRequest) - msoLogger.trace('Exited ' + method) + logger.debug("UpdateVfModule Infra Request: " + updateInfraRequest) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateInfraRequest(): ' + e.getMessage()) } } @@ -244,7 +256,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { ', resultVar=' + resultVar + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def requestInfo = getVariable(execution, 'UPDVfMod_requestInfo') @@ -258,15 +270,17 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { """ content = utils.formatXml(content) - msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content) + logger.debug(resultVar + ' = ' + System.lineSeparator() + content) execution.setVariable(resultVar, content) - msoLogger.debug("UpdateVfModule CompletionHandler Request: " + content) - msoLogger.trace('Exited ' + method) + logger.debug("UpdateVfModule CompletionHandler Request: " + content) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') } } @@ -283,7 +297,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { ', resultVar=' + resultVar + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def prefix = execution.getVariable('prefix') @@ -311,15 +325,17 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { </sdncadapterworkflow:FalloutHandlerRequest> """ content = utils.formatXml(content) - msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content) + logger.debug(resultVar + ' = ' + System.lineSeparator() + content) execution.setVariable(resultVar, content) - msoLogger.debug("UpdateVfModule fallOutHandler Request: " + content) - msoLogger.trace('Exited ' + method) + logger.debug("UpdateVfModule fallOutHandler Request: " + content) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy index 566afb0d9c..b4914c8cd5 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy @@ -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,20 +22,21 @@ package org.onap.so.bpmn.infrastructure.scripts +import groovy.json.JsonOutput +import groovy.json.JsonSlurper import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger - -import groovy.json.JsonOutput -import groovy.json.JsonSlurper +import org.slf4j.Logger +import org.slf4j.LoggerFactory public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateVfModuleInfra.class); + private static final Logger logger = LoggerFactory.getLogger(UpdateVfModuleInfra.class) ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -69,7 +72,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) initProcessVariables(execution) @@ -77,12 +80,12 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { def incomingRequest = execution.getVariable('bpmnRequest') - msoLogger.debug("Incoming Infra Request: " + incomingRequest) + logger.debug("Incoming Infra Request: {}", incomingRequest) try { def jsonSlurper = new JsonSlurper() def jsonOutput = new JsonOutput() Map reqMap = jsonSlurper.parseText(incomingRequest) - msoLogger.debug(" Request is in JSON format.") + logger.debug(" Request is in JSON format.") def serviceInstanceId = execution.getVariable('serviceInstanceId') def vnfId = execution.getVariable('vnfId') @@ -130,9 +133,9 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { userParams.each { userParam -> userParamsMap.put(userParam.name, userParam.value.toString()) } - } - - msoLogger.debug('Processed user params: ' + userParamsMap) + } + + logger.debug('Processed user params: {}', userParamsMap) execution.setVariable(prefix + 'vfModuleInputParams', userParamsMap) @@ -207,19 +210,20 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { //backoutOnFailure - msoLogger.debug('RequestInfo: ' + execution.getVariable(prefix + "requestInfo")) - - msoLogger.trace('Exited ' + method) + logger.debug('RequestInfo: {}', execution.getVariable(prefix + "requestInfo")) + + logger.trace('Exited {}', method) } catch(groovy.json.JsonException je) { - msoLogger.debug(" Request is not in JSON format.") + logger.debug(" Request is not in JSON format.") exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format") } catch(Exception e) { String restFaultMessage = e.getMessage() - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Exception Encountered - \n{}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e) exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) } } @@ -234,8 +238,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) - + logger.trace('Entered {}', method) try { def requestInfo = execution.getVariable('UPDVfModI_requestInfo') @@ -256,11 +259,12 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { sendWorkflowResponse(execution, 200, synchResponse) - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) } } @@ -280,15 +284,16 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) try { - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoUpdateVfModule(): ' + e.getMessage()) } } @@ -303,7 +308,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) try { def requestId = execution.getVariable('UPDVfModI_requestId') @@ -335,13 +340,14 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { updateInfraRequest = utils.formatXml(updateInfraRequest) execution.setVariable('UPDVfModI_updateInfraRequest', updateInfraRequest) - msoLogger.debug('Request for Update Infra Request:\n' + updateInfraRequest) + logger.debug('Request for Update Infra Request:\n{}', updateInfraRequest) - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateInfraRequest(): ' + e.getMessage()) } } @@ -358,7 +364,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { ', resultVar=' + resultVar + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) try { def requestInfo = getVariable(execution, 'UPDVfModI_requestInfo') @@ -372,14 +378,15 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { """ content = utils.formatXml(content) - msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content) + logger.debug('{} = {}{}', resultVar, System.lineSeparator(), content) execution.setVariable(resultVar, content) - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') } } @@ -396,7 +403,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { ', resultVar=' + resultVar + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) try { def prefix = execution.getVariable('prefix') @@ -424,14 +431,15 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { </sdncadapterworkflow:FalloutHandlerRequest> """ content = utils.formatXml(content) - msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content) + logger.debug('{} = {}{}', resultVar, System.lineSeparator(), content) execution.setVariable(resultVar, content) - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') } } @@ -448,7 +456,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) String processKey = getProcessKey(execution); def prefix = execution.getVariable("prefix") @@ -494,13 +502,14 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { utils.logContext(requestId, serviceInstanceId) */ - msoLogger.debug('Incoming message: ' + System.lineSeparator() + request) - msoLogger.trace('Exited ' + method) + logger.debug('Incoming message: {}{}', System.lineSeparator(), request) + logger.trace('Exited {}', method) return request } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy index 1a8df1664f..f04fa002fe 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy @@ -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 @@ -19,8 +21,9 @@ */ package org.onap.so.bpmn.infrastructure.scripts - +import groovy.json.JsonOutput +import groovy.json.JsonSlurper import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.ExceptionUtil @@ -28,13 +31,11 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.client.aai.AAIValidatorImpl import org.onap.so.client.appc.ApplicationControllerClient -import org.onap.so.logger.MsoLogger - -import groovy.json.JsonOutput -import groovy.json.JsonSlurper +import org.slf4j.Logger +import org.slf4j.LoggerFactory public class UpdateVfModuleInfraV2 { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateVfModuleInfraV2.class); + private static final Logger logger = LoggerFactory.getLogger(UpdateVfModuleInfraV2.class) ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -79,13 +80,13 @@ public class UpdateVfModuleInfraV2 { * @param execution The flow's execution instance. */ public void preProcessRequest(DelegateExecution execution) { - System.out.print("*****************************PreProcessRequest**************************") + logger.debug("*****************************PreProcessRequest**************************") def method = getClass().getSimpleName() + '.preProcessRequest(' + 'execution=' + execution.getId() + ')' - //msoLogger.trace('Entered ' + method) + //logger.trace('Entered ' + method) initProcessVariables(execution) @@ -93,12 +94,12 @@ public class UpdateVfModuleInfraV2 { def incomingRequest = execution.getVariable('bpmnRequest') - //msoLogger.debug("Incoming Infra Request: " + incomingRequest) + //logger.debug("Incoming Infra Request: " + incomingRequest) try { def jsonSlurper = new JsonSlurper() def jsonOutput = new JsonOutput() Map reqMap = jsonSlurper.parseText(incomingRequest) - //msoLogger.debug(" Request is in JSON format.") + //logger.debug(" Request is in JSON format.") def serviceInstanceId = execution.getVariable('serviceInstanceId') def vnfId = execution.getVariable('vnfId') @@ -148,7 +149,7 @@ public class UpdateVfModuleInfraV2 { } } - //msoLogger.debug('Processed user params: ' + userParamsMap) + //logger.debug('Processed user params: ' + userParamsMap) execution.setVariable(prefix + 'vfModuleInputParams', userParamsMap) @@ -223,18 +224,18 @@ public class UpdateVfModuleInfraV2 { //backoutOnFailure - //msoLogger.debug('RequestInfo: ' + execution.getVariable(prefix + "requestInfo")) + //logger.debug('RequestInfo: ' + execution.getVariable(prefix + "requestInfo")) - //msoLogger.trace('Exited ' + method) + //logger.trace('Exited ' + method) } catch(groovy.json.JsonException je) { - //msoLogger.debug(" Request is not in JSON format.") + //logger.debug(" Request is not in JSON format.") exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format") } catch(Exception e) { String restFaultMessage = e.getMessage() - //msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + //logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) } } @@ -245,13 +246,13 @@ public class UpdateVfModuleInfraV2 { * @param execution The flow's execution instance. */ public void sendSynchResponse(DelegateExecution execution) { - System.out.print("*****************************SendSynchResponse**************************") + logger.debug("*****************************SendSynchResponse**************************") def method = getClass().getSimpleName() + '.sendSynchResponse(' + 'execution=' + execution.getId() + ')' - //msoLogger.trace('Entered ' + method) + //logger.trace('Entered ' + method) try { @@ -271,11 +272,11 @@ public class UpdateVfModuleInfraV2 { def vfModuleId = execution.getVariable("vfModuleId") String synchResponse = """{"requestReferences":{"instanceId":"${vfModuleId}","requestId":"${requestId}"}}""".trim() sendWorkflowResponse(execution, 200, synchResponse) - //msoLogger.trace('Exited ' + method) + //logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - //msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + //logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) } } @@ -283,7 +284,7 @@ public class UpdateVfModuleInfraV2 { //check to see if the Pserver Flag is locked public void checkPserverFlag(DelegateExecution execution) { - System.out.println("*****************************CheckingPserverFlag*************************") + logger.debug("*****************************CheckingPserverFlag*************************") String vnfId = (String)execution.getVariable('vnfId') AAIValidatorImpl aaiVI = new AAIValidatorImpl() boolean flag = aaiVI.isPhysicalServerLocked(vnfId) @@ -292,7 +293,7 @@ public class UpdateVfModuleInfraV2 { //check to see if the VFFlag is locked public void vfFlagCheck(DelegateExecution execution) { - System.out.print("*****************************VfFlagCheck*************************") + logger.debug("*****************************VfFlagCheck*************************") String vnfId = (String)execution.getVariable('vnfId') AAIValidatorImpl aaiVI = new AAIValidatorImpl() boolean flag = aaiVI.isVNFLocked(vnfId) @@ -301,7 +302,7 @@ public class UpdateVfModuleInfraV2 { //lock the VF Flag public void vfFlagSet(DelegateExecution execution) { - System.out.print("*****************************VfFlagSet*************************") + logger.debug("*****************************VfFlagSet*************************") String vnfId = (String)execution.getVariable('vnfId') String uuid = (String)execution.getVariable('moduleUuid') AAIValidatorImpl aaiVI = new AAIValidatorImpl() @@ -312,7 +313,7 @@ public class UpdateVfModuleInfraV2 { //Lock AppC public void lockAppC(DelegateExecution execution) { - System.out.print("*****************************lockAppC*************************") + logger.debug("*****************************lockAppC*************************") def vfModuleId = "" ApplicationControllerClient aCC = new ApplicationControllerClient(getLCMProperties()) def status = aCC.runCommand("Lock",vfModuleId) @@ -322,7 +323,7 @@ public class UpdateVfModuleInfraV2 { //run health check public void healthCheckAppC(DelegateExecution execution) { - System.out.print("*****************************healthCheckAppC*************************") + logger.debug("*****************************healthCheckAppC*************************") def vfModuleId = "" ApplicationControllerClient aCC = new ApplicationControllerClient(getLCMProperties()) def status = aCC.runCommand("HealthCheck",vfModuleId) @@ -331,14 +332,14 @@ public class UpdateVfModuleInfraV2 { //SDNO health diagnostic public void healthDiagnosticSDNO(DelegateExecution execution) { - System.out.print("*****************************healthDiagnosticSDNO is currently ignored*************************") + logger.debug("*****************************healthDiagnosticSDNO is currently ignored*************************") //SDNOValidatorImpl.healthDiagnostic("",""); } //stop VF module controller public void stopVfModuleController(DelegateExecution execution) { - System.out.print("*****************************stopVfModuleController*************************") + logger.debug("*****************************stopVfModuleController*************************") def vfModuleId = "" ApplicationControllerClient aCC = new ApplicationControllerClient(getLCMProperties()) def status = aCC.runCommand("Stop",vfModuleId) @@ -348,20 +349,20 @@ public class UpdateVfModuleInfraV2 { public void doUpdateVfModulePrep(DelegateExecution execution) { - System.out.print("*****************************doUpdateVfModulePrep*************************") + logger.debug("*****************************doUpdateVfModulePrep*************************") def method = getClass().getSimpleName() + '.prepDoUpdateVfModule(' + 'execution=' + execution.getId() + ')' - //msoLogger.trace('Entered ' + method) + //logger.trace('Entered ' + method) try { - //msoLogger.trace('Exited ' + method) + //logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - //msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + //logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoUpdateVfModule(): ' + e.getMessage()) } @@ -370,13 +371,13 @@ public class UpdateVfModuleInfraV2 { public void completionHandlerPrep(DelegateExecution execution,String resultVar) { - System.out.print("*****************************completionHandlerPrep*************************") + logger.debug("*****************************completionHandlerPrep*************************") def method = getClass().getSimpleName() + '.completionHandlerPrep(' + 'execution=' + execution.getId() + ', resultVar=' + resultVar + ')' - //msoLogger.trace('Entered ' + method) + //logger.trace('Entered ' + method) try { def requestInfo = getVariable(execution, 'UPDVfModI_requestInfo') @@ -390,14 +391,14 @@ public class UpdateVfModuleInfraV2 { """ content = utils.formatXml(content) - //msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content) + //logger.debug(resultVar + ' = ' + System.lineSeparator() + content) execution.setVariable(resultVar, content) - //msoLogger.trace('Exited ' + method) + //logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - //msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + //logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') } @@ -406,7 +407,7 @@ public class UpdateVfModuleInfraV2 { public void healthCheckController(DelegateExecution execution) { - System.out.print("*****************************healthCheckController*************************") + logger.debug("*****************************healthCheckController*************************") def vfModuleId = "" ApplicationControllerClient aCC = new ApplicationControllerClient(getLCMProperties()) def status = aCC.runCommand("HealthCheck",vfModuleId) @@ -415,7 +416,7 @@ public class UpdateVfModuleInfraV2 { public void startVfModuleController(DelegateExecution execution) { - System.out.print("*****************************startVfModuleController*************************") + logger.debug("*****************************startVfModuleController*************************") def vfModuleId = "" ApplicationControllerClient aCC = new ApplicationControllerClient(getLCMProperties()) def status = aCC.runCommand("Start",vfModuleId) @@ -424,7 +425,7 @@ public class UpdateVfModuleInfraV2 { public void vFFlagUnset(DelegateExecution execution) { - System.out.print("*****************************vFFlagUnset*************************") + logger.debug("*****************************vFFlagUnset*************************") String vnfId = (String)execution.getVariable('vnfId') String uuid = (String)execution.getVariable('moduleUuid') AAIValidatorImpl aaiVI = new AAIValidatorImpl() @@ -435,7 +436,7 @@ public class UpdateVfModuleInfraV2 { public void unlockAppC(DelegateExecution execution) { - System.out.print("*****************************unlockAppC*************************") + logger.debug("*****************************unlockAppC*************************") def vfModuleId = "" ApplicationControllerClient aCC = new ApplicationControllerClient(getLCMProperties()) def status = aCC.runCommand("Unlock",vfModuleId) @@ -444,7 +445,7 @@ public class UpdateVfModuleInfraV2 { public void postUpgradeHealthCheckController(DelegateExecution execution) { - System.out.print("*****************************postUpgradeHealthCheckController*************************") + logger.debug("*****************************postUpgradeHealthCheckController*************************") def vfModuleId = "" ApplicationControllerClient aCC = new ApplicationControllerClient(getLCMProperties()) def status = aCC.runCommand("HealthCheck",vfModuleId) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy index 5b1270a947..69bb4fd0c4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy @@ -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,10 +39,13 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger -import static org.apache.commons.lang.StringUtils.isEmpty +import org.slf4j.Logger +import org.slf4j.LoggerFactory + +import static org.apache.commons.lang.StringUtils.isEmpty class UpdateVfModuleVolume extends VfModuleBase { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateVfModuleVolume.class) + private static final Logger logger = LoggerFactory.getLogger(UpdateVfModuleVolume.class) ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -78,7 +83,7 @@ class UpdateVfModuleVolume extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) try { initProcessVariables(execution) @@ -100,12 +105,13 @@ class UpdateVfModuleVolume extends VfModuleBase { def volumeParams = utils.getNodeXml(request, 'volume-params') execution.setVariable('UPDVfModVol_volumeParams', volumeParams) - msoLogger.trace('Exited ' + method) - msoLogger.debug("UpdateVfModuleVolume request: " + request) + logger.trace('Exited {}', method) + logger.debug("UpdateVfModuleVolume request: {}", request) } catch (BpmnError bpmnError) { throw bpmnError } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e) + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) } } @@ -120,7 +126,7 @@ class UpdateVfModuleVolume extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) try { def requestInfo = execution.getVariable('UPDVfModVol_requestInfo') @@ -152,11 +158,12 @@ class UpdateVfModuleVolume extends VfModuleBase { synchResponse = utils.formatXml(synchResponse) sendWorkflowResponse(execution, 200, synchResponse) - msoLogger.debug("UpdateVfModuleVolume Synch Response: " + synchResponse) + logger.debug("UpdateVfModuleVolume Synch Response: {}", synchResponse) } catch (BpmnError e) { throw e } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e) + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendSynchResponse(): ' + e.getMessage()) } } @@ -172,7 +179,7 @@ class UpdateVfModuleVolume extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) try { def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId') @@ -193,7 +200,8 @@ class UpdateVfModuleVolume extends VfModuleBase { exceptionUtil.buildAndThrowWorkflowException(execution,2500,"Could not find Tenant Id element in Volume Group with Volume Group Id" + volumeGroupId + ", AIC Cloud Region" + aicCloudRegion) } execution.setVariable('UPDVfModVol_volumeGroupTenantId', volumeGroupTenantId) - msoLogger.debug("Received Tenant Id: " + volumeGroupTenantId + "from AAI for Volume Group with Volume Group Id: " + volumeGroupId + ", AIC Cloud Region" + aicCloudRegion) + logger.debug("Received Tenant Id: {} from AAI for Volume Group with Volume Group Id: {}, AIC Cloud Region", + volumeGroupTenantId, volumeGroupId, aicCloudRegion) }else{ exceptionUtil.buildAndThrowWorkflowException(execution,2500,"Could not find Tenant Id element in Volume Group with Volume Group Id" + volumeGroupId + ", AIC Cloud Region" + aicCloudRegion) } @@ -201,11 +209,12 @@ class UpdateVfModuleVolume extends VfModuleBase { }else{ exceptionUtil.buildAndThrowWorkflowException(execution,2500,"Volume Group" + volumeGroupId + " not found at AAI") } - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e) + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVolumeGroup(): ' + e.getMessage()) } } @@ -221,7 +230,7 @@ class UpdateVfModuleVolume extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) try { def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion') @@ -266,14 +275,15 @@ class UpdateVfModuleVolume extends VfModuleBase { """ vnfAdapterRestRequest = utils.formatXml(vnfAdapterRestRequest) execution.setVariable('UPDVfModVol_vnfAdapterRestRequest', vnfAdapterRestRequest) - msoLogger.debug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest) + logger.debug('Request for VNFAdapter Rest:\n{}', vnfAdapterRestRequest) - msoLogger.debug("UpdateVfModuleVolume Request for VNFAdapter Rest: " + vnfAdapterRestRequest) - msoLogger.trace('Exited ' + method) + logger.debug("UpdateVfModuleVolume Request for VNFAdapter Rest: {}", vnfAdapterRestRequest) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e) + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepVnfAdapterRest(): ' + e.getMessage()) } } @@ -288,7 +298,7 @@ class UpdateVfModuleVolume extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) try { def requestId = execution.getVariable('UPDVfMod_requestId') @@ -310,14 +320,15 @@ class UpdateVfModuleVolume extends VfModuleBase { updateInfraRequest = utils.formatXml(updateInfraRequest) execution.setVariable('UPDVfModVol_updateInfraRequest', updateInfraRequest) - msoLogger.debug('Request for Update Infra Request:\n' + updateInfraRequest) + logger.debug('Request for Update Infra Request:\n{}', updateInfraRequest) - msoLogger.debug("UpdateVfModuleVolume Request for Updating DB for Infra: " + updateInfraRequest) - msoLogger.trace('Exited ' + method) + logger.debug("UpdateVfModuleVolume Request for Updating DB for Infra: {}", updateInfraRequest) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e) + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildWorkflowException(execution, 1002, 'Error in prepDbInfraDbRequest(): ' + e.getMessage()) } } @@ -332,7 +343,7 @@ class UpdateVfModuleVolume extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) try { def requestInfo = execution.getVariable('UPDVfModVol_requestInfo') @@ -346,15 +357,16 @@ class UpdateVfModuleVolume extends VfModuleBase { """ content = utils.formatXml(content) - msoLogger.debug('Request for Completion Handler:\n' + content) - msoLogger.debug("UpdateVfModuleVolume Completion Handler request: " + content) + logger.debug('Request for Completion Handler:\n{}', content) + logger.debug("UpdateVfModuleVolume Completion Handler request: {}", content) execution.setVariable('UPDVfModVol_CompletionHandlerRequest', content) - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e) + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepCompletionHandlerRequest(): ' + e.getMessage()) } } @@ -369,7 +381,7 @@ class UpdateVfModuleVolume extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) try { def requestInfo = execution.getVariable('UPDVfModVol_requestInfo') @@ -395,15 +407,16 @@ class UpdateVfModuleVolume extends VfModuleBase { </sdncadapterworkflow:FalloutHandlerRequest> """ content = utils.formatXml(content) - msoLogger.debug('Request for Fallout Handler:\n' + content) - msoLogger.debug("UpdateVfModuleVolume Fallout request: " + content) + logger.debug('Request for Fallout Handler:\n{}', content) + logger.debug("UpdateVfModuleVolume Fallout request: {}", content) execution.setVariable('UPDVfModVol_FalloutHandlerRequest', content) - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e) + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildWorkflowException(execution, 1002, 'Error in prepFalloutHandler(): ' + e.getMessage()) } } @@ -419,7 +432,7 @@ class UpdateVfModuleVolume extends VfModuleBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) String processKey = getProcessKey(execution) def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId') @@ -430,12 +443,13 @@ class UpdateVfModuleVolume extends VfModuleBase { def String errorMessage = 'TenantId \'' + tenantId + '\' in incoming request does not match Tenant Id \'' + volumeGroupTenantId + '\' retrieved from AAI for Volume Group Id \'' + volumeGroupId + '\', AIC Cloud Region \'' + aicCloudRegion + '\'' - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Error in UpdateVfModuleVol: ' + errorMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception") + logger.error("{} {} {} Error in UpdateVfModuleVol: {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), errorMessage) WorkflowException exception = new WorkflowException(processKey, 5000, errorMessage) execution.setVariable("WorkflowException", exception) - msoLogger.trace('Exited ' + method) - msoLogger.debug("UpdateVfModuleVolume workflowException in Tenant Mismatch: " + errorMessage) + logger.trace('Exited ' + method) + logger.debug("UpdateVfModuleVolume workflowException in Tenant Mismatch: " + errorMessage) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy index 49da398a87..e9121aa420 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy @@ -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 @@ -21,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.scripts import groovy.json.JsonException +import groovy.json.JsonSlurper import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf @@ -40,14 +43,15 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger -import static org.apache.cxf.common.util.CollectionUtils.isEmpty - -import groovy.json.JsonSlurper +import org.slf4j.Logger +import org.slf4j.LoggerFactory import javax.ws.rs.core.UriBuilder +import static org.apache.cxf.common.util.CollectionUtils.isEmpty + class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateVfModuleVolumeInfraV1.class) + private static final Logger logger = LoggerFactory.getLogger(UpdateVfModuleVolumeInfraV1.class) private ExceptionUtil exceptionUtil = new ExceptionUtil() /** @@ -108,11 +112,11 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { def modelInvariantId = reqMap.requestDetails.modelInfo.modelInvariantUuid ?: '' execution.setVariable('UPDVfModVol_modelInvariantId', modelInvariantId) - msoLogger.debug("modelInvariantId from request: " + modelInvariantId) - msoLogger.debug("XML request:\n" + request) + logger.debug("modelInvariantId from request: {}", modelInvariantId) + logger.debug("XML request:\n{}", request) } catch (JsonException je) { - msoLogger.debug(" Request is in XML format.") + logger.debug(" Request is in XML format.") // assume request is in XML format - proceed as usual to process XML request } @@ -186,7 +190,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { syncResponse = utils.formatXml(xmlSyncResponse) } - msoLogger.debug('Sync response: ' + syncResponse) + logger.debug('Sync response: {}', syncResponse) execution.setVariable('UPDVfModVol_syncResponseSent', true) sendWorkflowResponse(execution, 200, syncResponse) } @@ -213,7 +217,8 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { if (!isEmpty(tenantURIList)) { String volumeGroupTenantId = tenantURIList.get(0).getURIKeys().get("tenant-id") execution.setVariable('UPDVfModVol_volumeGroupTenantId', volumeGroupTenantId) - msoLogger.debug("Received Tenant Id " + volumeGroupTenantId + " from AAI for Volume Group with Volume Group Id " + volumeGroupId + ", AIC Cloud Region " + aicCloudRegion) + logger.debug("Received Tenant Id {} from AAI for Volume Group with Volume Group Id {}, AIC Cloud Region ", + volumeGroupTenantId, volumeGroupId, aicCloudRegion) } else { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Could not find Tenant Id element in Volume Group with Volume Group Id " + volumeGroupId + ", AIC Cloud Region " + aicCloudRegion) @@ -363,7 +368,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { """ vnfAdapterRestRequest = utils.formatXml(vnfAdapterRestRequest) execution.setVariable('UPDVfModVol_vnfAdapterRestRequest', vnfAdapterRestRequest) - msoLogger.debug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest) + logger.debug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest) } /** @@ -392,7 +397,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { updateInfraRequest = utils.formatXml(updateInfraRequest) execution.setVariable('UPDVfModVol_updateInfraRequest', updateInfraRequest) - msoLogger.debug('Request for Update Infra Request:\n' + updateInfraRequest) + logger.debug('Request for Update Infra Request:\n' + updateInfraRequest) } /** @@ -414,7 +419,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { """ content = utils.formatXml(content) - msoLogger.debug('Request for Completion Handler:\n' + content) + logger.debug('Request for Completion Handler:\n' + content) execution.setVariable('UPDVfModVol_CompletionHandlerRequest', content) } @@ -454,7 +459,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { </sdncadapterworkflow:FalloutHandlerRequest> """ content = utils.formatXml(content) - msoLogger.debug('Request for Fallout Handler:\n' + content) + logger.debug('Request for Fallout Handler:\n' + content) execution.setVariable('UPDVfModVol_FalloutHandlerRequest', content) } @@ -474,7 +479,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { " retrieved from AAI for Volume Group Id " + volumeGroupId + ", AIC Cloud Region " + aicCloudRegion ExceptionUtil exceptionUtil = new ExceptionUtil() - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Error in UpdateVfModuleVol: ' + errorMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception") + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Error in UpdateVfModuleVol: ' + errorMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception") exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) } @@ -492,7 +497,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { " retrieved from AAI for Volume Group Id " ExceptionUtil exceptionUtil = new ExceptionUtil() - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Error in UpdateVfModuleVol: ' + errorMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception") + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Error in UpdateVfModuleVol: ' + errorMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception") exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy index f8d73ce020..1a62ad60f9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy @@ -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 @@ -19,24 +21,27 @@ package org.onap.so.bpmn.infrastructure.scripts +import groovy.json.JsonOutput +import groovy.json.JsonSlurper import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.appc.client.lcm.model.Action; +import org.onap.appc.client.lcm.model.Action import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.domain.ModelInfo import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.* +import org.onap.so.client.aai.AAIRestClientImpl +import org.onap.so.client.aai.AAIUpdatorImpl +import org.onap.so.client.aai.AAIValidatorImpl import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger - -import groovy.json.JsonOutput -import groovy.json.JsonSlurper +import org.slf4j.Logger +import org.slf4j.LoggerFactory public class UpdateVnfInfra extends VnfCmBase { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateVnfInfra.class); + private static final Logger logger = LoggerFactory.getLogger(UpdateVnfInfra.class) ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtils = new JsonUtils() @@ -83,18 +88,18 @@ public class UpdateVnfInfra extends VnfCmBase { ')' initProcessVariables(execution) - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) initProcessVariables(execution) def incomingRequest = execution.getVariable('bpmnRequest') - msoLogger.debug("Incoming Infra Request: " + incomingRequest) + logger.debug("Incoming Infra Request: {}", incomingRequest) try { def jsonSlurper = new JsonSlurper() def jsonOutput = new JsonOutput() Map reqMap = jsonSlurper.parseText(incomingRequest) - msoLogger.debug(" Request is in JSON format.") + logger.debug(" Request is in JSON format.") execution.setVariable("isVidRequest", "true") execution.setVariable('serviceType', 'Mobility') @@ -112,12 +117,12 @@ public class UpdateVnfInfra extends VnfCmBase { if (relatedInstanceList != null) { relatedInstanceList.each { if (it.relatedInstance.modelInfo?.modelType == 'service') { - msoLogger.debug("PROCESSING SERVICE INFO") + logger.debug("PROCESSING SERVICE INFO") asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion serviceModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo) - msoLogger.debug("ServiceModelInfo: " + serviceModelInfo) + logger.debug("ServiceModelInfo: {}", serviceModelInfo) def modelInvariant = jsonUtils.getJsonValue(serviceModelInfo, "modelInvariantUuid") - msoLogger.debug("modelInvariant: " + modelInvariant) + logger.debug("modelInvariant: {}", modelInvariant) } } @@ -128,8 +133,8 @@ public class UpdateVnfInfra extends VnfCmBase { def vnfModelInfo = jsonOutput.toJson(reqMap.requestDetails?.modelInfo) execution.setVariable('vnfModelInfo', vnfModelInfo) def vnfModelInvariantUuid = jsonUtils.getJsonValue(vnfModelInfo, "modelInvariantUuid") - execution.setVariable('vnfModelInvariantUuid', vnfModelInvariantUuid) - msoLogger.debug("vnfModelInvariantUuid: " + vnfModelInvariantUuid) + execution.setVariable('vnfModelInvariantUuid', vnfModelInvariantUuid) + logger.debug("vnfModelInvariantUuid: {}", vnfModelInvariantUuid) def vnfType = execution.getVariable('vnfType') execution.setVariable('vnfType', vnfType) @@ -137,8 +142,8 @@ public class UpdateVnfInfra extends VnfCmBase { def controllerType = reqMap.requestDetails?.requestParameters?.controllerType execution.setVariable('controllerType', controllerType) - - msoLogger.debug('Controller Type: ' + controllerType) + + logger.debug('Controller Type: {}', controllerType) def userParams = reqMap.requestDetails?.requestParameters?.userParams @@ -147,9 +152,9 @@ public class UpdateVnfInfra extends VnfCmBase { userParams.each { userParam -> userParamsMap.put(userParam.name, userParam.value.toString()) } - } - - msoLogger.debug('Processed user params: ' + userParamsMap) + } + + logger.debug('Processed user params: {}', userParamsMap) execution.setVariable('vfModuleInputParams', userParamsMap) @@ -195,21 +200,21 @@ public class UpdateVnfInfra extends VnfCmBase { <source>${MsoUtils.xmlEscape(source)}</source> </request-info>""" - execution.setVariable("requestInfo", requestInfo) - - msoLogger.debug('RequestInfo: ' + execution.getVariable("requestInfo")) - - msoLogger.trace('Exited ' + method) + execution.setVariable("requestInfo", requestInfo) + + logger.debug('RequestInfo: {}', execution.getVariable("requestInfo")) + logger.trace('Exited {}', method) } catch(groovy.json.JsonException je) { - msoLogger.debug(" Request is not in JSON format.") + logger.debug(" Request is not in JSON format.") exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format") } catch(Exception e) { String restFaultMessage = e.getMessage() - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Exception Encountered - \n{}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e) exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) } } @@ -224,8 +229,7 @@ public class UpdateVnfInfra extends VnfCmBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) - + logger.trace('Entered {}', method) try { def requestInfo = execution.getVariable('requestInfo') @@ -246,11 +250,12 @@ public class UpdateVnfInfra extends VnfCmBase { sendWorkflowResponse(execution, 200, synchResponse) - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) } } @@ -268,25 +273,25 @@ public class UpdateVnfInfra extends VnfCmBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) try { ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") String vnfModelInvariantUuid = execution.getVariable('vnfModelInvariantUuid') - msoLogger.debug("vnfModelInvariantUuid: " + vnfModelInvariantUuid) + logger.debug("vnfModelInvariantUuid: {}", vnfModelInvariantUuid) List<VnfResource> vnfResources = serviceDecomposition.getVnfResources() for (i in 0..vnfResources.size()-1) { ModelInfo modelInfo = vnfResources[i].getModelInfo() String modelInvariantUuidFromDecomposition = modelInfo.getModelInvariantUuid() - msoLogger.debug("modelInvariantUuidFromDecomposition: " + modelInvariantUuidFromDecomposition) - + logger.debug("modelInvariantUuidFromDecomposition: {}", modelInvariantUuidFromDecomposition) + if (vnfModelInvariantUuid.equals(modelInvariantUuidFromDecomposition)) { VnfResource vnfResourceDecomposition = vnfResources[i] execution.setVariable('vnfResourceDecomposition', vnfResourceDecomposition) def nfRole = vnfResourceDecomposition.getNfRole() execution.setVariable('nfRole', nfRole) - msoLogger.debug("vnfResourceDecomposition: " + vnfResourceDecomposition.toJsonString()) + logger.debug("vnfResourceDecomposition: {}", vnfResourceDecomposition.toJsonString()) break } else { @@ -295,11 +300,12 @@ public class UpdateVnfInfra extends VnfCmBase { } - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage()) } } @@ -318,7 +324,7 @@ public class UpdateVnfInfra extends VnfCmBase { execution.setVariable('errorCode', "0") execution.setVariable("workStep", "checkIfVnfInMaintInAAI") execution.setVariable("failedActivity", "AAI") - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) try { AAIRestClientImpl client = new AAIRestClientImpl() @@ -326,7 +332,7 @@ public class UpdateVnfInfra extends VnfCmBase { aaiValidator.setClient(client) def vnfId = execution.getVariable("vnfId") boolean isInMaint = aaiValidator.isVNFLocked(vnfId) - msoLogger.debug("isInMaint result: " + isInMaint) + logger.debug("isInMaint result: {}", isInMaint) execution.setVariable('isVnfInMaintenance', isInMaint) if (isInMaint) { @@ -335,11 +341,12 @@ public class UpdateVnfInfra extends VnfCmBase { } - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) @@ -359,7 +366,7 @@ public class UpdateVnfInfra extends VnfCmBase { ')' execution.setVariable('errorCode', "0") - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) execution.setVariable("workStep", "checkIfPserversInMaintInAAI") execution.setVariable("failedActivity", "AAI") @@ -369,7 +376,7 @@ public class UpdateVnfInfra extends VnfCmBase { aaiValidator.setClient(client) def vnfId = execution.getVariable("vnfId") boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId) - msoLogger.debug("areLocked result: " + areLocked) + logger.debug("areLocked result: {}", areLocked) execution.setVariable('arePserversLocked', areLocked) if (areLocked) { @@ -377,11 +384,12 @@ public class UpdateVnfInfra extends VnfCmBase { execution.setVariable("errorText", "pServers are locked in A&AI") } - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage()) @@ -401,7 +409,7 @@ public class UpdateVnfInfra extends VnfCmBase { ')' execution.setVariable('errorCode', "0") - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) if (inMaint) { execution.setVariable("workStep", "setVnfInMaintFlagInAAI") } @@ -422,12 +430,13 @@ public class UpdateVnfInfra extends VnfCmBase { else { aaiUpdator.updateVnfToUnLocked(vnfId) } - - msoLogger.trace('Exited ' + method) + + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } @@ -447,11 +456,10 @@ public class UpdateVnfInfra extends VnfCmBase { ')' execution.setVariable('errorCode', "0") - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) execution.setVariable("workStep", "doUpdateVnfAndModules") execution.setVariable("failedActivity", "MSO Update VNF") - msoLogger.trace('Exited ' + method) - + logger.trace('Exited {}', method) } @@ -465,7 +473,7 @@ public class UpdateVnfInfra extends VnfCmBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) def errorText = execution.getVariable("errorText") def errorCode = execution.getVariable("errorCode") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy index 32fc46a84f..01f0e246af 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy @@ -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 @@ -19,15 +21,16 @@ package org.onap.so.bpmn.infrastructure.scripts +import groovy.json.JsonSlurper import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONArray import org.json.JSONObject -import org.onap.appc.client.lcm.model.Action; +import org.onap.appc.client.lcm.model.Action import org.onap.appc.client.lcm.model.ActionIdentifiers import org.onap.appc.client.lcm.model.Flags import org.onap.appc.client.lcm.model.Status -import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException @@ -41,18 +44,18 @@ import org.onap.so.client.aai.entities.Relationships import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUri import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.client.appc.ApplicationControllerClient; -import org.onap.so.client.appc.ApplicationControllerSupport; +import org.onap.so.client.appc.ApplicationControllerClient +import org.onap.so.client.appc.ApplicationControllerSupport import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger - -import groovy.json.JsonSlurper +import org.slf4j.Logger +import org.slf4j.LoggerFactory public abstract class VnfCmBase extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfCmBase.class); + private static final Logger logger = LoggerFactory.getLogger(VnfCmBase.class) ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtils = new JsonUtils() + JsonUtils jsonUtils = new JsonUtils() def prefix = "VnfIPU_" /** @@ -71,8 +74,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) - + logger.trace('Entered {}', method) try { def requestInfo = execution.getVariable('requestInfo') @@ -93,11 +95,12 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { sendWorkflowResponse(execution, 200, synchResponse) - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) } } @@ -114,25 +117,25 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { def method = getClass().getSimpleName() + '.getVnfResourceDecomposition(' + 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) try { ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") String vnfModelInvariantUuid = execution.getVariable('vnfModelInvariantUuid') - msoLogger.debug("vnfModelInvariantUuid: " + vnfModelInvariantUuid) + logger.debug("vnfModelInvariantUuid: {}", vnfModelInvariantUuid) List<VnfResource> vnfResources = serviceDecomposition.getVnfResources() for (i in 0..vnfResources.size()-1) { ModelInfo modelInfo = vnfResources[i].getModelInfo() String modelInvariantUuidFromDecomposition = modelInfo.getModelInvariantUuid() - msoLogger.debug("modelInvariantUuidFromDecomposition: " + modelInvariantUuidFromDecomposition) + logger.debug("modelInvariantUuidFromDecomposition: {}", modelInvariantUuidFromDecomposition) if (vnfModelInvariantUuid.equals(modelInvariantUuidFromDecomposition)) { VnfResource vnfResourceDecomposition = vnfResources[i] execution.setVariable('vnfResourceDecomposition', vnfResourceDecomposition) - def nfRole = vnfResourceDecomposition.getNfRole() + def nfRole = vnfResourceDecomposition.getNfRole() execution.setVariable('nfRole', nfRole) - msoLogger.debug("vnfResourceDecomposition: " + vnfResourceDecomposition.toJsonString()) + logger.debug("vnfResourceDecomposition: {}", vnfResourceDecomposition.toJsonString()) break } else { @@ -141,11 +144,12 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { } - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage()) } } @@ -164,7 +168,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { execution.setVariable('errorCode', "0") execution.setVariable("workStep", "checkIfVnfInMaintInAAI") execution.setVariable("failedActivity", "AAI") - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) try { AAIRestClientImpl client = new AAIRestClientImpl() @@ -172,7 +176,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { aaiValidator.setClient(client) def vnfId = execution.getVariable("vnfId") boolean isInMaint = aaiValidator.isVNFLocked(vnfId) - msoLogger.debug("isInMaint result: " + isInMaint) + logger.debug("isInMaint result: {}", isInMaint) execution.setVariable('isVnfInMaintenance', isInMaint) if (isInMaint) { @@ -181,11 +185,12 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { } - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) @@ -203,20 +208,20 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) try { def transactionLoggingUuid = UUID.randomUUID().toString() def vnfId = execution.getVariable("vnfId") - msoLogger.debug("vnfId is: " + vnfId) + logger.debug("vnfId is: {}", vnfId) def cloudRegionId = execution.getVariable("lcpCloudRegionId") - msoLogger.debug("cloudRegionId is: " + cloudRegionId) + logger.debug("cloudRegionId is: {}", cloudRegionId) AAIResourcesClient client = new AAIResourcesClient() AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) // Check if this VNF exists if (!client.exists(genericVnfUri)) { - msoLogger.debug("VNF with vnfId " + vnfId + " does not exist in A&AI") + logger.debug("VNF with vnfId {} does not exist in A&AI", vnfId) exceptionUtil.buildAndThrowWorkflowException(execution, 404, "VNF with vnfId " + vnfId + " does not exist in A&AI") } @@ -225,13 +230,13 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { Map<String, Object> result = aaiRW.asMap() String vnfName = result.get("vnf-name") - msoLogger.debug("vnfName from A&AI is: " + vnfName) + logger.debug("vnfName from A&AI is: {}", vnfName) execution.setVariable("vnfName", vnfName) String nfRole = result.get("nf-role") - msoLogger.debug("nfRole from A&AI is: " + nfRole) + logger.debug("nfRole from A&AI is: {}", nfRole) execution.setVariable("nfRole", nfRole) String vnfHostIpAddress = result.get("ipv4-oam-address") - msoLogger.debug("vnfHostIpAddress from A&AI is: " + vnfHostIpAddress) + logger.debug("vnfHostIpAddress from A&AI is: {}", vnfHostIpAddress) execution.setVariable("vnfHostIpAddress", vnfHostIpAddress) execution.setVariable("vmIdList", null) if (aaiRW.getRelationships() != null) { @@ -246,8 +251,8 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { String vserverId = j.getURIKeys().get('vserver-id') String vserverJson = client.get(j).getJson() - msoLogger.debug("Retrieved vserverJson from AAI: " + vserverJson) - String vserverSelfLink = jsonUtils.getJsonValue(vserverJson, "vserver-selflink") + logger.debug("Retrieved vserverJson from AAI: {}", vserverJson) + String vserverSelfLink = jsonUtils.getJsonValue(vserverJson, "vserver-selflink") vserverIds.put(vserverId) vserverSelfLinks.put(vserverSelfLink) @@ -256,10 +261,10 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { JSONObject vmidsArray = new JSONObject() JSONObject vserveridsArray = new JSONObject() vmidsArray.put("vmIds", vserverSelfLinks.toString()) - vserveridsArray.put("vserverIds", vserverIds.toString()) - - msoLogger.debug("vmidsArray is: " + vmidsArray.toString()) - msoLogger.debug("vserveridsArray is: " + vserveridsArray.toString()) + vserveridsArray.put("vserverIds", vserverIds.toString()) + + logger.debug("vmidsArray is: {}", vmidsArray.toString()) + logger.debug("vserveridsArray is: {}", vserveridsArray.toString()) execution.setVariable("vmIdList", vmidsArray.toString()) execution.setVariable("vserverIdList", vserveridsArray.toString()) @@ -270,7 +275,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { Optional<Relationships> relationships = aaiRW.getRelationships() if(relationships.isPresent()) { - msoLogger.debug("relationships are present") + logger.debug("relationships are present") String rs = relationships.get().getJson() def jsonSlurper = new JsonSlurper() def map = jsonSlurper.parseText(rs) @@ -280,25 +285,25 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { final String relatedTo = (String)relationship.get("related-to"); if (relatedTo.equals("platform")) { List<Map<String, Object>> relationshipDataList = (List<Map<String, Object>>)relationship.get("relationship-data") - msoLogger.debug("Found platform entry") + logger.debug("Found platform entry") for (Map<String, Object> relationshipData : relationshipDataList) { String relationshipKey = (String)relationshipData.get("relationship-key"); if (relationshipKey.equals("platform.platform-name")) { String platformName = (String) relationshipData.get("relationship-value") - msoLogger.debug("platform from A&AI is: " + platformName) + logger.debug("platform from A&AI is: {}", platformName) execution.setVariable("platform", platformName) - break + break } - } + } } if (relatedTo.equals("line-of-business")) { List<Map<String, Object>> relationshipDataList = (List<Map<String, Object>>)relationship.get("relationship-data") - msoLogger.debug("Found line-of-business entry") + logger.debug("Found line-of-business entry") for (Map<String, Object> relationshipData : relationshipDataList) { String relationshipKey = (String)relationshipData.get("relationship-key"); if (relationshipKey.equals("line-of-business.line-of-business-name")) { String lineOfBusinessName = (String) relationshipData.get("relationship-value") - msoLogger.debug("lineOfBusiness from A&AI is: " + lineOfBusinessName) + logger.debug("lineOfBusiness from A&AI is: {}", lineOfBusinessName) execution.setVariable("lineOfBusiness", lineOfBusinessName) break } @@ -310,11 +315,12 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { } - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVnf(): ' + e.getMessage()) } } @@ -333,7 +339,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { ')' execution.setVariable('errorCode', "0") - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) execution.setVariable("workStep", "checkIfPserversInMaintInAAI") execution.setVariable("failedActivity", "AAI") @@ -341,21 +347,22 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { AAIRestClientImpl client = new AAIRestClientImpl() AAIValidatorImpl aaiValidator = new AAIValidatorImpl() aaiValidator.setClient(client) - def vnfId = execution.getVariable("vnfId") + def vnfId = execution.getVariable("vnfId") boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId) - msoLogger.debug("areLocked result: " + areLocked) + logger.debug("areLocked result: {}", areLocked) execution.setVariable('arePserversLocked', areLocked) if (areLocked) { execution.setVariable("errorCode", "1003") execution.setVariable("errorText", "pServers are locked in A&AI") - } + } - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage()) @@ -375,7 +382,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { ')' execution.setVariable('errorCode', "0") - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) if (inMaint) { execution.setVariable("workStep", "setVnfInMaintFlagInAAI") } @@ -396,12 +403,13 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { else { aaiUpdator.updateVnfToUnLocked(vnfId) } - - msoLogger.trace('Exited ' + method) + + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } @@ -421,19 +429,19 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { execution.setVariable('errorCode', "0") execution.setVariable("workStep", "checkClosedLoopDisabledFlagInAAI") execution.setVariable("failedActivity", "AAI") - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) try { - def transactionLoggingUuid = UUID.randomUUID().toString() + def transactionLoggingUuid = UUID.randomUUID().toString() def vnfId = execution.getVariable("vnfId") - msoLogger.debug("vnfId is: " + vnfId) - AAIResourcesClient client = new AAIResourcesClient() + logger.debug("vnfId is: {}", vnfId) + AAIResourcesClient client = new AAIResourcesClient() AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) AAIResultWrapper aaiRW = client.get(genericVnfUri) Map<String, Object> result = aaiRW.asMap() boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false) - - msoLogger.debug("isClosedLoopDisabled result: " + isClosedLoopDisabled) + + logger.debug("isClosedLoopDisabled result: {}", isClosedLoopDisabled) execution.setVariable('isClosedLoopDisabled', isClosedLoopDisabled) if (isClosedLoopDisabled) { @@ -441,11 +449,12 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { execution.setVariable("errorText", "closedLoop is disabled in A&AI") } - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } @@ -473,26 +482,27 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { } execution.setVariable("failedActivity", "AAI") - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) try { def transactionLoggingUuid = UUID.randomUUID().toString() def vnfId = execution.getVariable("vnfId") - AAIResourcesClient client = new AAIResourcesClient() + AAIResourcesClient client = new AAIResourcesClient() AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) Map<String, Boolean> request = new HashMap<>() request.put("is-closed-loop-disabled", setDisabled) client.update(genericVnfUri, request) - msoLogger.debug("set isClosedLoop to: " + setDisabled) + logger.debug("set isClosedLoop to: {}", setDisabled) - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") - execution.setVariable("errorText", e.getMessage()) + execution.setVariable("errorText", e.getMessage()) } } @@ -512,12 +522,12 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { ')' execution.setVariable('errorCode', "0") - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) ApplicationControllerClient appcClient = null try { - msoLogger.debug("Running APP-C action: " + action.toString()) + logger.debug("Running APP-C action: {}", action.toString()) String vnfId = execution.getVariable('vnfId') String msoRequestId = execution.getVariable('requestId') execution.setVariable('msoRequestId', msoRequestId) @@ -557,28 +567,31 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { default: break } - msoLogger.debug("Completed AppC request") + logger.debug("Completed AppC request") int appcCode = appcStatus.getCode() - msoLogger.debug("AppC status code is: " + appcCode) - msoLogger.debug("AppC status message is: " + appcStatus.getMessage()) + logger.debug("AppC status code is: {}", appcCode) + logger.debug("AppC status message is: {}", appcStatus.getMessage()) if (support.getCategoryOf(appcStatus) == ApplicationControllerSupport.StatusCategory.ERROR) { execution.setVariable("errorCode", Integer.toString(appcCode)) execution.setVariable("errorText", appcStatus.getMessage()) } - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } catch (java.lang.NoSuchMethodError e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) @@ -598,7 +611,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { ')' execution.setVariable('errorCode', "0") - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) execution.setVariable("failedActivity", "APP-C") execution.setVariable("workStep", action) } @@ -621,7 +634,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { ', resultVar=' + resultVar + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) try { @@ -637,14 +650,15 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { """ content = utils.formatXml(content) - msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content) + logger.debug('{} = {}{}', resultVar, System.lineSeparator(), content) execution.setVariable(resultVar, content) - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') } } @@ -661,10 +675,10 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { ')' execution.setVariable('errorCode', "0") - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) execution.setVariable("workStep", "doUpdateVnfAndModules") execution.setVariable("failedActivity", "MSO Update VNF") - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } @@ -680,7 +694,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { ', resultVar=' + resultVar + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) try { def prefix = execution.getVariable('prefix') @@ -707,14 +721,15 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { </sdncadapterworkflow:FalloutHandlerRequest> """ content = utils.formatXml(content) - msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content) + logger.debug('{} = {}{}', resultVar, System.lineSeparator(), content) execution.setVariable(resultVar, content) - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') } } @@ -729,7 +744,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) def errorText = execution.getVariable("errorText") def errorCode = execution.getVariable("errorCode") @@ -747,7 +762,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) String retryCountVariableName = execution.getVariable("workStep") + "RetryCount" execution.setVariable("retryCountVariableName", retryCountVariableName) @@ -762,52 +777,48 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { retryCount += 1 execution.setVariable(retryCountVariableName, retryCount) - - msoLogger.debug("value of " + retryCountVariableName + " is " + retryCount) - msoLogger.trace('Exited ' + method) - - - } + + logger.debug("value of {} is {}", retryCountVariableName, retryCount) + logger.trace('Exited {}', method) + } - public void preProcessRollback (DelegateExecution execution) { - msoLogger.trace("preProcessRollback ") + public void preProcessRollback (DelegateExecution execution) { + logger.trace("preProcessRollback ") try { Object workflowException = execution.getVariable("WorkflowException"); if (workflowException instanceof WorkflowException) { - msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage()) + logger.debug("Prev workflowException: {}", workflowException.getErrorMessage()) execution.setVariable("prevWorkflowException", workflowException); //execution.setVariable("WorkflowException", null); } } catch (BpmnError e) { - msoLogger.debug("BPMN Error during preProcessRollback") + logger.debug("BPMN Error during preProcessRollback") } catch(Exception ex) { - String msg = "Exception in preProcessRollback. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug("Exception in preProcessRollback. {}", ex.getMessage()) } - msoLogger.trace("Exit preProcessRollback ") + logger.trace("Exit preProcessRollback ") } public void postProcessRollback (DelegateExecution execution) { - msoLogger.trace("postProcessRollback ") + logger.trace("postProcessRollback ") String msg = "" try { Object workflowException = execution.getVariable("prevWorkflowException"); if (workflowException instanceof WorkflowException) { - msoLogger.debug("Setting prevException to WorkflowException: ") + logger.debug("Setting prevException to WorkflowException: ") execution.setVariable("WorkflowException", workflowException); } } catch (BpmnError b) { - msoLogger.debug("BPMN Error during postProcessRollback") + logger.debug("BPMN Error during postProcessRollback") throw b; } catch(Exception ex) { - msg = "Exception in postProcessRollback. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug("Exception in postProcessRollback. {}", ex.getMessage()) } - msoLogger.trace("Exit postProcessRollback ") - } - -} + logger.trace("Exit postProcessRollback ") + } + +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy index 89f40ed680..6075f0df96 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy @@ -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 @@ -19,9 +21,11 @@ package org.onap.so.bpmn.infrastructure.scripts +import groovy.json.JsonOutput +import groovy.json.JsonSlurper import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.appc.client.lcm.model.Action; +import org.onap.appc.client.lcm.model.Action import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.json.JsonUtils @@ -31,15 +35,14 @@ import org.onap.so.client.aai.entities.uri.AAIUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger - -import groovy.json.JsonOutput -import groovy.json.JsonSlurper +import org.slf4j.Logger +import org.slf4j.LoggerFactory public class VnfConfigUpdate extends VnfCmBase { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfConfigUpdate.class); + private static final Logger logger = LoggerFactory.getLogger( VnfConfigUpdate.class) ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtils = new JsonUtils() + JsonUtils jsonUtils = new JsonUtils() def prefix = "VnfIPU_" /** @@ -49,9 +52,9 @@ public class VnfConfigUpdate extends VnfCmBase { */ public void initProcessVariables(DelegateExecution execution) { execution.setVariable('prefix', 'VnfCU_') - execution.setVariable('Request', null) - execution.setVariable('source', null) - execution.setVariable('controllerType', null) + execution.setVariable('Request', null) + execution.setVariable('source', null) + execution.setVariable('controllerType', null) execution.setVariable('UpdateVnfSuccessIndicator', false) execution.setVariable('serviceType', null) execution.setVariable('nfRole', null) @@ -83,56 +86,56 @@ public class VnfConfigUpdate extends VnfCmBase { ')' initProcessVariables(execution) - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) - initProcessVariables(execution) + initProcessVariables(execution) def incomingRequest = execution.getVariable('bpmnRequest') - msoLogger.debug("Incoming Infra Request: " + incomingRequest) + logger.debug("Incoming Infra Request: {}", incomingRequest) try { def jsonSlurper = new JsonSlurper() def jsonOutput = new JsonOutput() Map reqMap = jsonSlurper.parseText(incomingRequest) - msoLogger.debug(" Request is in JSON format.") + logger.debug(" Request is in JSON format.") def serviceInstanceId = execution.getVariable('serviceInstanceId') def vnfId = execution.getVariable('vnfId') - + execution.setVariable('serviceInstanceId', serviceInstanceId) - execution.setVariable('vnfId', vnfId) + execution.setVariable('vnfId', vnfId) execution.setVariable('serviceType', 'Mobility') execution.setVariable('payload', "") execution.setVariable('actionHealthCheck', Action.HealthCheck) - execution.setVariable('actionConfigModify', Action.ConfigModify) - + execution.setVariable('actionConfigModify', Action.ConfigModify) + def controllerType = reqMap.requestDetails?.requestParameters?.controllerType execution.setVariable('controllerType', controllerType) - - msoLogger.debug('Controller Type: ' + controllerType) - + + logger.debug('Controller Type: {}', controllerType) + def payload = reqMap.requestDetails?.requestParameters?.payload execution.setVariable('payload', payload) - - msoLogger.debug('Processed payload: ' + payload) - + + logger.debug('Processed payload: {}', payload) + def requestId = execution.getVariable("mso-request-id") execution.setVariable('requestId', requestId) - execution.setVariable('msoRequestId', requestId) - + execution.setVariable('msoRequestId', requestId) + def requestorId = reqMap.requestDetails?.requestInfo?.requestorId ?: null execution.setVariable('requestorId', requestorId) - + execution.setVariable('sdncVersion', '1702') execution.setVariable("UpdateVnfInfraSuccessIndicator", false) - - + + def source = reqMap.requestDetails?.requestInfo?.source execution.setVariable("source", source) - + //For Completion Handler & Fallout Handler String requestInfo = """<request-info xmlns="http://org.onap/so/infra/vnf-request/v1"> @@ -140,24 +143,25 @@ public class VnfConfigUpdate extends VnfCmBase { <action>UPDATE</action> <source>${MsoUtils.xmlEscape(source)}</source> </request-info>""" - - execution.setVariable("requestInfo", requestInfo) - - msoLogger.debug('RequestInfo: ' + execution.getVariable("requestInfo")) - - msoLogger.trace('Exited ' + method) + + execution.setVariable("requestInfo", requestInfo) + + logger.debug('RequestInfo: {}', execution.getVariable("requestInfo")) + + logger.trace('Exited {}', method) } catch(groovy.json.JsonException je) { - msoLogger.debug(" Request is not in JSON format.") + logger.debug(" Request is not in JSON format.") exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format") } catch(Exception e) { String restFaultMessage = e.getMessage() - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Exception Encountered - \n {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e) exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) - } + } } /** @@ -170,7 +174,7 @@ public class VnfConfigUpdate extends VnfCmBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) try { @@ -192,16 +196,17 @@ public class VnfConfigUpdate extends VnfCmBase { sendWorkflowResponse(execution, 200, synchResponse) - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) } - } - - + } + + /** * Check if this VNF is already in maintenance in A&AI. * @@ -216,7 +221,7 @@ public class VnfConfigUpdate extends VnfCmBase { execution.setVariable('errorCode', "0") execution.setVariable("workStep", "checkIfVnfInMaintInAAI") execution.setVariable("failedActivity", "AAI") - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) try { AAIRestClientImpl client = new AAIRestClientImpl() @@ -224,26 +229,27 @@ public class VnfConfigUpdate extends VnfCmBase { aaiValidator.setClient(client) def vnfId = execution.getVariable("vnfId") boolean isInMaint = aaiValidator.isVNFLocked(vnfId) - msoLogger.debug("isInMaint result: " + isInMaint) + logger.debug("isInMaint result: {}", isInMaint) execution.setVariable('isVnfInMaintenance', isInMaint) - + if (isInMaint) { execution.setVariable("errorCode", "1003") execution.setVariable("errorText", "VNF is in maintenance in A&AI") } - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) } } - - + + /** * Check if this VNF's pservers are locked in A&AI. * @@ -256,7 +262,7 @@ public class VnfConfigUpdate extends VnfCmBase { ')' execution.setVariable('errorCode', "0") - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) execution.setVariable("workStep", "checkIfPserversInMaintInAAI") execution.setVariable("failedActivity", "AAI") @@ -264,28 +270,28 @@ public class VnfConfigUpdate extends VnfCmBase { AAIRestClientImpl client = new AAIRestClientImpl() AAIValidatorImpl aaiValidator = new AAIValidatorImpl() aaiValidator.setClient(client) - def vnfId = execution.getVariable("vnfId") + def vnfId = execution.getVariable("vnfId") boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId) - msoLogger.debug("areLocked result: " + areLocked) + logger.debug("areLocked result: {}", areLocked) execution.setVariable('arePserversLocked', areLocked) - + if (areLocked) { execution.setVariable("errorCode", "1003") execution.setVariable("errorText", "pServers are locked in A&AI") } - - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage()) } } - + /** * Set inMaint flag for this VNF to the specified value in A&AI. * @@ -299,7 +305,7 @@ public class VnfConfigUpdate extends VnfCmBase { ')' execution.setVariable('errorCode', "0") - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) if (inMaint) { execution.setVariable("workStep", "setVnfInMaintFlagInAAI") execution.setVariable("rollbackSetVnfInMaintenanceFlag", true) @@ -321,17 +327,18 @@ public class VnfConfigUpdate extends VnfCmBase { else { aaiUpdator.updateVnfToUnLocked(vnfId) } - - msoLogger.trace('Exited ' + method) + + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } } - + /** * Check if VF Closed Loop Disabled in A&AI. * @@ -346,37 +353,38 @@ public class VnfConfigUpdate extends VnfCmBase { execution.setVariable('errorCode', "0") execution.setVariable("workStep", "checkClosedLoopDisabledFlagInAAI") execution.setVariable("failedActivity", "AAI") - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) try { def transactionLoggingUuid = UUID.randomUUID().toString() def vnfId = execution.getVariable("vnfId") - msoLogger.debug("vnfId is: " + vnfId) - AAIResourcesClient client = new AAIResourcesClient() + logger.debug("vnfId is: {}", vnfId) + AAIResourcesClient client = new AAIResourcesClient() AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) AAIResultWrapper aaiRW = client.get(genericVnfUri) Map<String, Object> result = aaiRW.asMap() boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false) - - msoLogger.debug("isClosedLoopDisabled result: " + isClosedLoopDisabled) + + logger.debug("isClosedLoopDisabled result: {}", isClosedLoopDisabled) execution.setVariable('isClosedLoopDisabled', isClosedLoopDisabled) - + if (isClosedLoopDisabled) { execution.setVariable("errorCode", "1004") execution.setVariable("errorText", "closedLoop is disabled in A&AI") } - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) } } - + /** * Set VF Closed Loop Disabled Flag in A&AI. * @@ -396,52 +404,52 @@ public class VnfConfigUpdate extends VnfCmBase { else { execution.setVariable("workStep", "unsetClosedLoopDisabledFlagInAAI") } - + execution.setVariable("failedActivity", "AAI") - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) try { def transactionLoggingUuid = UUID.randomUUID().toString() def vnfId = execution.getVariable("vnfId") - AAIResourcesClient client = new AAIResourcesClient() + AAIResourcesClient client = new AAIResourcesClient() AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) - + Map<String, Boolean> request = new HashMap<>() request.put("is-closed-loop-disabled", setDisabled) client.update(genericVnfUri, request) - msoLogger.debug("set isClosedLoop to: " + setDisabled) + logger.debug("set isClosedLoop to: {}", setDisabled) - - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) } - } + } + - /** * Handle Abort disposition from RainyDayHandler * - * @param execution The flow's execution instance. + * @param execution The flow's execution instance. */ public void abortProcessing(DelegateExecution execution) { def method = getClass().getSimpleName() + '.abortProcessing(' + 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) - + logger.trace('Entered {}', method) + def errorText = execution.getVariable("errorText") def errorCode = execution.getVariable("errorCode") - + exceptionUtil.buildAndThrowWorkflowException(execution, errorCode as Integer, errorText) } - + /** * Increment Retry Count for Current Work Step * @@ -452,28 +460,24 @@ public class VnfConfigUpdate extends VnfCmBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) - + logger.trace('Entered {}', method) + String retryCountVariableName = execution.getVariable("workStep") + "RetryCount" execution.setVariable("retryCountVariableName", retryCountVariableName) - + def retryCountVariable = execution.getVariable(retryCountVariableName) int retryCount = 0 - + if (retryCountVariable != null) { retryCount = (int) retryCountVariable - } - + } + retryCount += 1 - + execution.setVariable(retryCountVariableName, retryCount) - - msoLogger.debug("value of " + retryCountVariableName + " is " + retryCount) - msoLogger.trace('Exited ' + method) - - - } - - - + + logger.debug("value of {} is {}", retryCountVariableName, retryCount) + logger.trace('Exited {}', method) + } + } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy index 84668a5c61..cd89d2a2ef 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy @@ -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 @@ -19,6 +21,8 @@ package org.onap.so.bpmn.infrastructure.scripts +import groovy.json.JsonOutput +import groovy.json.JsonSlurper import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.appc.client.lcm.model.Action @@ -32,16 +36,15 @@ import org.onap.so.client.aai.* import org.onap.so.client.aai.entities.AAIResultWrapper import org.onap.so.client.aai.entities.uri.AAIUri import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.client.appc.ApplicationControllerClient; -import org.onap.so.client.appc.ApplicationControllerSupport; +import org.onap.so.client.appc.ApplicationControllerClient +import org.onap.so.client.appc.ApplicationControllerSupport import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger - -import groovy.json.JsonOutput -import groovy.json.JsonSlurper +import org.slf4j.Logger +import org.slf4j.LoggerFactory public class VnfInPlaceUpdate extends VnfCmBase { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfInPlaceUpdate.class); + private static final Logger logger = LoggerFactory.getLogger(VnfInPlaceUpdate.class) ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtils = new JsonUtils() @@ -90,18 +93,18 @@ public class VnfInPlaceUpdate extends VnfCmBase { ')' initProcessVariables(execution) - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) initProcessVariables(execution) def incomingRequest = execution.getVariable('bpmnRequest') - msoLogger.debug("Incoming Infra Request: " + incomingRequest) + logger.debug("Incoming Infra Request: {}", incomingRequest) try { def jsonSlurper = new JsonSlurper() def jsonOutput = new JsonOutput() Map reqMap = jsonSlurper.parseText(incomingRequest) - msoLogger.debug(" Request is in JSON format.") + logger.debug(" Request is in JSON format.") def serviceInstanceId = execution.getVariable('serviceInstanceId') def vnfId = execution.getVariable('vnfId') @@ -124,14 +127,13 @@ public class VnfInPlaceUpdate extends VnfCmBase { def controllerType = reqMap.requestDetails?.requestParameters?.controllerType execution.setVariable('controllerType', controllerType) - - msoLogger.debug('Controller Type: ' + controllerType) + + logger.debug('Controller Type: {}', controllerType) def payload = reqMap.requestDetails?.requestParameters?.payload execution.setVariable('payload', payload) - msoLogger.debug('Processed payload: ' + payload) - + logger.debug('Processed payload: {}', payload) def requestId = execution.getVariable("mso-request-id") execution.setVariable('requestId', requestId) @@ -165,18 +167,19 @@ public class VnfInPlaceUpdate extends VnfCmBase { execution.setVariable("requestInfo", requestInfo) - msoLogger.debug('RequestInfo: ' + execution.getVariable("requestInfo")) + logger.debug('RequestInfo: {}', execution.getVariable("requestInfo")) - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch(groovy.json.JsonException je) { - msoLogger.debug(" Request is not in JSON format.") + logger.debug(" Request is not in JSON format.") exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format") } catch(Exception e) { String restFaultMessage = e.getMessage() - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Exception Encountered - {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e) exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) } } @@ -191,8 +194,7 @@ public class VnfInPlaceUpdate extends VnfCmBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) - + logger.trace('Entered {}', method) try { def requestInfo = execution.getVariable('requestInfo') @@ -213,11 +215,12 @@ public class VnfInPlaceUpdate extends VnfCmBase { sendWorkflowResponse(execution, 200, synchResponse) - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) } } @@ -237,7 +240,7 @@ public class VnfInPlaceUpdate extends VnfCmBase { execution.setVariable('errorCode', "0") execution.setVariable("workStep", "checkIfVnfInMaintInAAI") execution.setVariable("failedActivity", "AAI") - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) try { AAIRestClientImpl client = new AAIRestClientImpl() @@ -245,7 +248,7 @@ public class VnfInPlaceUpdate extends VnfCmBase { aaiValidator.setClient(client) def vnfId = execution.getVariable("vnfId") boolean isInMaint = aaiValidator.isVNFLocked(vnfId) - msoLogger.debug("isInMaint result: " + isInMaint) + logger.debug("isInMaint result: {}", isInMaint) execution.setVariable('isVnfInMaintenance', isInMaint) if (isInMaint) { @@ -254,11 +257,12 @@ public class VnfInPlaceUpdate extends VnfCmBase { } - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) @@ -278,7 +282,7 @@ public class VnfInPlaceUpdate extends VnfCmBase { ')' execution.setVariable('errorCode', "0") - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) execution.setVariable("workStep", "checkIfPserversInMaintInAAI") execution.setVariable("failedActivity", "AAI") @@ -288,7 +292,7 @@ public class VnfInPlaceUpdate extends VnfCmBase { aaiValidator.setClient(client) def vnfId = execution.getVariable("vnfId") boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId) - msoLogger.debug("areLocked result: " + areLocked) + logger.debug("areLocked result: {}", areLocked) execution.setVariable('arePserversLocked', areLocked) if (areLocked) { @@ -296,11 +300,12 @@ public class VnfInPlaceUpdate extends VnfCmBase { execution.setVariable("errorText", "pServers are locked in A&AI") } - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} Caught exception in {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e) execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage()) @@ -320,7 +325,7 @@ public class VnfInPlaceUpdate extends VnfCmBase { ')' execution.setVariable('errorCode', "0") - msoLogger.trace('Entered ' + method) + logger.trace('Entered {}', method) if (inMaint) { execution.setVariable("workStep", "setVnfInMaintFlagInAAI") } @@ -342,11 +347,11 @@ public class VnfInPlaceUpdate extends VnfCmBase { aaiUpdator.updateVnfToUnLocked(vnfId) } - msoLogger.trace('Exited ' + method) + logger.trace('Exited {}', method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } @@ -366,19 +371,19 @@ public class VnfInPlaceUpdate extends VnfCmBase { execution.setVariable('errorCode', "0") execution.setVariable("workStep", "checkClosedLoopDisabledFlagInAAI") execution.setVariable("failedActivity", "AAI") - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def transactionLoggingUuid = UUID.randomUUID().toString() def vnfId = execution.getVariable("vnfId") - msoLogger.debug("vnfId is: " + vnfId) + logger.debug("vnfId is: " + vnfId) AAIResourcesClient client = new AAIResourcesClient() AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) AAIResultWrapper aaiRW = client.get(genericVnfUri) Map<String, Object> result = aaiRW.asMap() boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false) - msoLogger.debug("isClosedLoopDisabled result: " + isClosedLoopDisabled) + logger.debug("isClosedLoopDisabled result: " + isClosedLoopDisabled) execution.setVariable('isClosedLoopDisabled', isClosedLoopDisabled) if (isClosedLoopDisabled) { @@ -386,11 +391,11 @@ public class VnfInPlaceUpdate extends VnfCmBase { execution.setVariable("errorText", "closedLoop is disabled in A&AI") } - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } @@ -417,7 +422,7 @@ public class VnfInPlaceUpdate extends VnfCmBase { } execution.setVariable("failedActivity", "AAI") - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) try { def transactionLoggingUuid = UUID.randomUUID().toString() @@ -428,13 +433,13 @@ public class VnfInPlaceUpdate extends VnfCmBase { Map<String, Boolean> request = new HashMap<>() request.put("is-closed-loop-disabled", setDisabled) client.update(genericVnfUri, request) - msoLogger.debug("set isClosedLoop to: " + setDisabled) + logger.debug("set isClosedLoop to: " + setDisabled) - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } @@ -456,12 +461,12 @@ public class VnfInPlaceUpdate extends VnfCmBase { ')' execution.setVariable('errorCode', "0") - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) ApplicationControllerClient appcClient = null try { - msoLogger.debug("Running APP-C action: " + action.toString()) + logger.debug("Running APP-C action: " + action.toString()) String vnfId = execution.getVariable('vnfId') String msoRequestId = execution.getVariable('requestId') execution.setVariable('msoRequestId', msoRequestId) @@ -501,26 +506,26 @@ public class VnfInPlaceUpdate extends VnfCmBase { default: break } - msoLogger.debug("Completed AppC request") + logger.debug("Completed AppC request") int appcCode = appcStatus.getCode() - msoLogger.debug("AppC status code is: " + appcCode) - msoLogger.debug("AppC status message is: " + appcStatus.getMessage()) + logger.debug("AppC status code is: " + appcCode) + logger.debug("AppC status message is: " + appcStatus.getMessage()) if (support.getCategoryOf(appcStatus) == ApplicationControllerSupport.StatusCategory.ERROR) { execution.setVariable("errorCode", Integer.toString(appcCode)) execution.setVariable("errorText", appcStatus.getMessage()) } - msoLogger.trace('Exited ' + method) + logger.trace('Exited ' + method) } catch (BpmnError e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } catch (java.lang.NoSuchMethodError e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } @@ -539,7 +544,7 @@ public class VnfInPlaceUpdate extends VnfCmBase { ')' execution.setVariable('errorCode', "0") - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) execution.setVariable("failedActivity", "APP-C") execution.setVariable("workStep", action) } @@ -556,7 +561,7 @@ public class VnfInPlaceUpdate extends VnfCmBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) def errorText = execution.getVariable("errorText") def errorCode = execution.getVariable("errorCode") @@ -574,7 +579,7 @@ public class VnfInPlaceUpdate extends VnfCmBase { 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) String retryCountVariableName = execution.getVariable("workStep") + "RetryCount" execution.setVariable("retryCountVariableName", retryCountVariableName) @@ -590,8 +595,8 @@ public class VnfInPlaceUpdate extends VnfCmBase { execution.setVariable(retryCountVariableName, retryCount) - msoLogger.debug("value of " + retryCountVariableName + " is " + retryCount) - msoLogger.trace('Exited ' + method) + logger.debug("value of " + retryCountVariableName + " is " + retryCount) + logger.trace('Exited ' + method) } } |