From e708ead3ae0be922b62dc8d6ad1271e3ac82b9b5 Mon Sep 17 00:00:00 2001 From: Ficio Date: Thu, 7 Mar 2019 13:34:51 +0100 Subject: Remove MsoLogger from BPMN VCPE scripts Replaced MsoLogger with plain slf4j. Refactored login output. Fixed imports. Replaced utils.log() with respective logger calls. Issue-ID: LOG-631 Signed-off-by: Witold Kopel Change-Id: I7c0f0e4a6b46e9e99f58e7c287b19bb93abc8677 --- .../vcpe/scripts/CreateVcpeResCustService.groovy | 206 +++++++++++---------- .../vcpe/scripts/DeleteVcpeResCustService.groovy | 90 ++++----- .../scripts/DoCreateAllottedResourceBRG.groovy | 166 +++++++++-------- .../DoCreateAllottedResourceBRGRollback.groovy | 82 ++++---- .../scripts/DoCreateAllottedResourceTXC.groovy | 154 +++++++-------- .../DoCreateAllottedResourceTXCRollback.groovy | 82 ++++---- .../scripts/DoDeleteAllottedResourceBRG.groovy | 91 ++++----- .../scripts/DoDeleteAllottedResourceTXC.groovy | 93 +++++----- 8 files changed, 508 insertions(+), 456 deletions(-) (limited to 'bpmn') diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy index 13d5aad2b0..0af1bcb00e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.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,7 +35,9 @@ 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.springframework.web.util.UriUtils; +import org.springframework.web.util.UriUtils +import org.slf4j.Logger +import org.slf4j.LoggerFactory import groovy.json.* @@ -46,7 +50,7 @@ import groovy.json.* * */ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateVcpeResCustService.class); + private static final Logger logger = LoggerFactory.getLogger(CreateVcpeResCustService.class); private static final String DebugFlag = "isDebugLogEnabled" @@ -90,7 +94,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { def isDebugEnabled = execution.getVariable(DebugFlag) execution.setVariable("prefix", Prefix) - msoLogger.trace("Inside preProcessRequest CreateVcpeResCustService Request ") + logger.trace("Inside preProcessRequest CreateVcpeResCustService Request ") try { // initialize flow variables @@ -100,15 +104,15 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { String aaiDistDelay = UrnPropertiesReader.getVariable("aai.workflowAaiDistributionDelay", execution) if (isBlank(aaiDistDelay)) { String msg = "workflowAaiDistributionDelay is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } execution.setVariable("aaiDistDelay", aaiDistDelay) - msoLogger.debug("AAI distribution delay: " + aaiDistDelay) + logger.debug("AAI distribution delay: " + aaiDistDelay) // check for incoming json message/input String createVcpeServiceRequest = execution.getVariable("bpmnRequest") - msoLogger.debug(createVcpeServiceRequest) + logger.debug(createVcpeServiceRequest) execution.setVariable("createVcpeServiceRequest", createVcpeServiceRequest); println 'createVcpeServiceRequest - ' + createVcpeServiceRequest @@ -120,18 +124,18 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { if ((serviceInstanceId == null) || (serviceInstanceId.isEmpty())) { serviceInstanceId = UUID.randomUUID().toString() - msoLogger.debug(" Generated new Service Instance: " + serviceInstanceId) + logger.debug(" Generated new Service Instance: " + serviceInstanceId) } else { - msoLogger.debug("Using provided Service Instance ID: " + serviceInstanceId) + logger.debug("Using provided Service Instance ID: " + serviceInstanceId) } serviceInstanceId = UriUtils.encode(serviceInstanceId, "UTF-8") execution.setVariable("serviceInstanceId", serviceInstanceId) - utils.log("DEBUG", "Incoming serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) + logger.debug("Incoming serviceInstanceId is: " + serviceInstanceId) String serviceInstanceName = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.instanceName") execution.setVariable("serviceInstanceName", serviceInstanceName) - utils.log("DEBUG", "Incoming serviceInstanceName is: " + serviceInstanceName, isDebugEnabled) + logger.debug("Incoming serviceInstanceName is: " + serviceInstanceName) String requestAction = execution.getVariable("requestAction") execution.setVariable("requestAction", requestAction) @@ -160,19 +164,19 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { // extract subscriptionServiceType String subscriptionServiceType = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestParameters.subscriptionServiceType") execution.setVariable("subscriptionServiceType", subscriptionServiceType) - msoLogger.debug("Incoming subscriptionServiceType is: " + subscriptionServiceType) + logger.debug("Incoming subscriptionServiceType is: " + subscriptionServiceType) String suppressRollback = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.suppressRollback") execution.setVariable("disableRollback", suppressRollback) - msoLogger.debug("Incoming Suppress/Disable Rollback is: " + suppressRollback) + logger.debug("Incoming Suppress/Disable Rollback is: " + suppressRollback) String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId") execution.setVariable("productFamilyId", productFamilyId) - msoLogger.debug("Incoming productFamilyId is: " + productFamilyId) + logger.debug("Incoming productFamilyId is: " + productFamilyId) String subscriberInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.subscriberInfo") execution.setVariable("subscriberInfo", subscriberInfo) - msoLogger.debug("Incoming subscriberInfo is: " + subscriberInfo) + logger.debug("Incoming subscriberInfo is: " + subscriberInfo) // extract cloud configuration - if underscore "_" is present treat as vimId else it's a cloudRegion String vimId = jsonUtil.getJsonValue(createVcpeServiceRequest, @@ -182,21 +186,21 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { def cloudOwner = cloudRegion[0] def cloudRegionId = cloudRegion[1] execution.setVariable("cloudOwner", cloudOwner) - msoLogger.debug("cloudOwner: " + cloudOwner) + logger.debug("cloudOwner: " + cloudOwner) execution.setVariable("cloudRegionId", cloudRegionId) - msoLogger.debug("cloudRegionId: " + cloudRegionId) + logger.debug("cloudRegionId: " + cloudRegionId) } else { - msoLogger.debug("vimId is not present - setting cloudRegion/cloudOwner from request.") + logger.debug("vimId is not present - setting cloudRegion/cloudOwner from request.") String cloudOwner = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.cloudOwner") if (!cloudOwner?.empty && cloudOwner != "") { execution.setVariable("cloudOwner", cloudOwner) - msoLogger.debug("cloudOwner: " + cloudOwner) + logger.debug("cloudOwner: " + cloudOwner) } def cloudRegionId = vimId execution.setVariable("cloudRegionId", cloudRegionId) - msoLogger.debug("cloudRegionId: " + cloudRegionId) + logger.debug("cloudRegionId: " + cloudRegionId) } /* * Extracting User Parameters from incoming Request and converting into a Map @@ -222,8 +226,8 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { execution.setVariable("customerLocation", customerMap) } if ("Homing_Model_Ids".equals(userParam?.name)) { - utils.log("DEBUG", "Homing_Model_Ids: " + userParam.value.toString() + " ---- Type is:" + - userParam.value.getClass() , isDebugEnabled) + logger.debug("Homing_Model_Ids: " + userParam.value.toString() + " ---- Type is:" + + userParam.value.getClass()) def modelIdLst = [] userParam.value.each { param -> @@ -233,8 +237,8 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { valueMap.put(entry.key, entry.value) } modelIdLst.add(valueMap) - utils.log("DEBUG", "Param: " + param.toString() + " ---- Type is:" + - param.getClass() , isDebugEnabled) + logger.debug("Param: " + param.toString() + " ---- Type is:" + + param.getClass()) } execution.setVariable("homingModelIds", modelIdLst) } @@ -252,7 +256,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { inputMap.put("orchestrator", userParam.value) } if ("VfModuleNames".equals(userParam?.name)) { - utils.log("DEBUG", "VfModuleNames: " + userParam.value.toString(), isDebugEnabled) + logger.debug("VfModuleNames: " + userParam.value.toString()) def vfModuleNames = [:] userParam.value.each { entry -> @@ -269,8 +273,8 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { if (vfModuleModelInvariantUuid != null && !vfModuleModelInvariantUuid.isEmpty() && vfModuleName != null && !vfModuleName.isEmpty()) { vfModuleNames.put(vfModuleModelInvariantUuid, vfModuleName) - utils.log("DEBUG", "VfModuleModelInvariantUuid: " + vfModuleModelInvariantUuid + " VfModuleName: " + vfModuleName, isDebugEnabled) - } + logger.debug("VfModuleModelInvariantUuid: " + vfModuleModelInvariantUuid + " VfModuleName: " + vfModuleName) + } } execution.setVariable("vfModuleNames", vfModuleNames) } @@ -282,10 +286,10 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { execution.setVariable("homingService", "oof") } - msoLogger.debug("User Input Parameters map: " + userParams.toString()) + logger.debug("User Input Parameters map: " + userParams.toString()) execution.setVariable("serviceInputParams", inputMap) // DOES NOT SEEM TO BE USED - msoLogger.debug("Incoming brgWanMacAddress is: " + execution.getVariable('brgWanMacAddress')) + logger.debug("Incoming brgWanMacAddress is: " + execution.getVariable('brgWanMacAddress')) //For Completion Handler & Fallout Handler String requestInfo = @@ -297,7 +301,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "requestInfo", requestInfo) - msoLogger.trace("Completed preProcessRequest CreateVcpeResCustService Request ") + logger.trace("Completed preProcessRequest CreateVcpeResCustService Request ") } catch (BpmnError e) { throw e; @@ -310,7 +314,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { public void sendSyncResponse(DelegateExecution execution) { - msoLogger.trace("Inside sendSyncResponse of CreateVcpeResCustService ") + logger.trace("Inside sendSyncResponse of CreateVcpeResCustService ") try { String serviceInstanceId = execution.getVariable("serviceInstanceId") @@ -321,7 +325,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { requestId }"}}""".trim() - msoLogger.debug(" sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse) + logger.debug(" sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse) sendWorkflowResponse(execution, 202, syncResponse) } catch (Exception ex) { @@ -336,7 +340,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { public void prepareDecomposeService(DelegateExecution execution) { try { - msoLogger.trace("Inside prepareDecomposeService of CreateVcpeResCustService ") + logger.trace("Inside prepareDecomposeService of CreateVcpeResCustService ") String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") @@ -344,7 +348,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { String serviceModelInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.modelInfo") execution.setVariable("serviceModelInfo", serviceModelInfo) - msoLogger.trace("Completed prepareDecomposeService of CreateVcpeResCustService ") + logger.trace("Completed prepareDecomposeService of CreateVcpeResCustService ") } catch (Exception ex) { // try error in method block String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() @@ -358,7 +362,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { public void prepareCreateServiceInstance(DelegateExecution execution) { try { - msoLogger.trace("Inside prepareCreateServiceInstance of CreateVcpeResCustService ") + logger.trace("Inside prepareCreateServiceInstance of CreateVcpeResCustService ") /* * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject @@ -377,7 +381,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonStringNoRootName()) - msoLogger.trace("Completed prepareCreateServiceInstance of CreateVcpeResCustService ") + logger.trace("Completed prepareCreateServiceInstance of CreateVcpeResCustService ") } catch (Exception ex) { // try error in method block String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() @@ -387,7 +391,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { public void postProcessServiceInstanceCreate(DelegateExecution execution) { def method = getClass().getSimpleName() + '.postProcessServiceInstanceCreate(' + 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) String requestId = execution.getVariable("mso-request-id") String serviceInstanceId = execution.getVariable("serviceInstanceId") @@ -409,13 +413,15 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { """ execution.setVariable(Prefix + "setUpdateDbInstancePayload", payload) - msoLogger.debug(Prefix + "setUpdateDbInstancePayload: " + payload) - msoLogger.trace('Exited ' + method) + logger.debug(Prefix + "setUpdateDbInstancePayload: " + payload) + 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 - Occured in" + method) } } @@ -423,7 +429,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { public void processDecomposition(DelegateExecution execution) { - msoLogger.trace("Inside processDecomposition() of CreateVcpeResCustService ") + logger.trace("Inside processDecomposition() of CreateVcpeResCustService ") try { @@ -440,7 +446,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { 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() @@ -448,18 +454,18 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { 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 CreateVcpeResCustService ") + logger.trace("Completed processDecomposition() of CreateVcpeResCustService ") } catch (Exception ex) { sendSyncError(execution) String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. processDecomposition() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } } @@ -486,7 +492,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { public void prepareCreateAllottedResourceTXC(DelegateExecution execution) { try { - msoLogger.trace("Inside prepareCreateAllottedResourceTXC of CreateVcpeResCustService ") + logger.trace("Inside prepareCreateAllottedResourceTXC of CreateVcpeResCustService ") /* * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject @@ -506,8 +512,8 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { while (iter.hasNext()) { AllottedResource allottedResource = (AllottedResource) iter.next(); - msoLogger.debug(" getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName()) - msoLogger.debug(" allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType()) + logger.debug(" getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName()) + logger.debug(" allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType()) if ("TunnelXConn".equalsIgnoreCase(allottedResource.getAllottedResourceType()) || "Tunnel XConn".equalsIgnoreCase(allottedResource.getAllottedResourceType())) { //set create flag to true execution.setVariable("createTXCAR", true) @@ -525,9 +531,9 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { //unit test only String allottedResourceId = execution.getVariable("allottedResourceId") execution.setVariable("allottedResourceIdTXC", allottedResourceId) - msoLogger.debug("setting allottedResourceId CreateVcpeResCustService " + allottedResourceId) + logger.debug("setting allottedResourceId CreateVcpeResCustService " + allottedResourceId) - msoLogger.trace("Completed prepareCreateAllottedResourceTXC of CreateVcpeResCustService ") + logger.trace("Completed prepareCreateAllottedResourceTXC of CreateVcpeResCustService ") } catch (Exception ex) { // try error in method block String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceTXC flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() @@ -538,7 +544,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { public void prepareCreateAllottedResourceBRG(DelegateExecution execution) { try { - msoLogger.trace("Inside prepareCreateAllottedResourceBRG of CreateVcpeResCustService ") + logger.trace("Inside prepareCreateAllottedResourceBRG of CreateVcpeResCustService ") /* * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject @@ -558,8 +564,8 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { while (iter.hasNext()) { AllottedResource allottedResource = (AllottedResource) iter.next(); - msoLogger.debug(" getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName()) - msoLogger.debug(" allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType()) + logger.debug(" getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName()) + logger.debug(" allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType()) if ("BRG".equalsIgnoreCase(allottedResource.getAllottedResourceType())) { //set create flag to true execution.setVariable("createBRGAR", true) @@ -577,9 +583,9 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { //unit test only String allottedResourceId = execution.getVariable("allottedResourceId") execution.setVariable("allottedResourceIdBRG", allottedResourceId) - msoLogger.debug("setting allottedResourceId CreateVcpeResCustService " + allottedResourceId) + logger.debug("setting allottedResourceId CreateVcpeResCustService " + allottedResourceId) - msoLogger.trace("Completed prepareCreateAllottedResourceBRG of CreateVcpeResCustService ") + logger.trace("Completed prepareCreateAllottedResourceBRG of CreateVcpeResCustService ") } catch (Exception ex) { // try error in method block String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceBRG flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() @@ -593,7 +599,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { public void prepareVnfAndModulesCreate(DelegateExecution execution) { try { - msoLogger.trace("Inside prepareVnfAndModulesCreate of CreateVcpeResCustService ") + logger.trace("Inside prepareVnfAndModulesCreate of CreateVcpeResCustService ") // String disableRollback = execution.getVariable("disableRollback") // def backoutOnFailure = "" @@ -609,7 +615,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId") execution.setVariable("productFamilyId", productFamilyId) - msoLogger.debug("productFamilyId: " + productFamilyId) + logger.debug("productFamilyId: " + productFamilyId) List vnfList = execution.getVariable("vnfList") @@ -617,9 +623,9 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { String vnfModelInfoString = null; if (vnfList != null && vnfList.size() > 0) { - msoLogger.debug("getting model info for vnf # " + vnfsCreatedCount) + logger.debug("getting model info for vnf # " + vnfsCreatedCount) ModelInfo vnfModelInfo1 = vnfList[0].getModelInfo() - msoLogger.debug("got 0 ") + logger.debug("got 0 ") ModelInfo vnfModelInfo = vnfList[vnfsCreatedCount.intValue()].getModelInfo() vnfModelInfoString = vnfModelInfo.toString() } else { @@ -627,7 +633,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { vnfModelInfoString = execution.getVariable("vnfModelInfo") } - msoLogger.debug(" vnfModelInfoString :" + vnfModelInfoString) + logger.debug(" vnfModelInfoString :" + vnfModelInfoString) // extract cloud configuration - if underscore "_" is present treat as vimId else it's a cloudRegion String vimId = jsonUtil.getJsonValue(createVcpeServiceRequest, @@ -635,35 +641,35 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { if (vimId.contains("_") && vimId.split("_").length == 2 ) { 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]) } else { - msoLogger.debug("vimId is not present - setting cloudRegion/cloudOwner from request.") + logger.debug("vimId is not present - setting cloudRegion/cloudOwner from request.") String cloudOwner = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.cloudOwner") if (!cloudOwner?.empty && cloudOwner != "") { execution.setVariable("cloudOwner", cloudOwner) - msoLogger.debug("cloudOwner: " + cloudOwner) + logger.debug("cloudOwner: " + cloudOwner) } execution.setVariable("cloudRegionId", vimId) - msoLogger.debug("cloudRegionId: " + vimId) + logger.debug("cloudRegionId: " + vimId) execution.setVariable("lcpCloudRegionId", vimId) - msoLogger.debug("lcpCloudRegionId: " + vimId) + logger.debug("lcpCloudRegionId: " + vimId) } String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.tenantId") execution.setVariable("tenantId", tenantId) - msoLogger.debug("tenantId: " + tenantId) + logger.debug("tenantId: " + 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 CreateVcpeResCustService flow. Unexpected Error from method prepareVnfAndModulesCreate() - " + ex.getMessage() @@ -677,14 +683,14 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { public void validateVnfCreate(DelegateExecution execution) { try { - msoLogger.trace("Inside validateVnfCreate of CreateVcpeResCustService ") + logger.trace("Inside validateVnfCreate of CreateVcpeResCustService ") Integer vnfsCreatedCount = execution.getVariable(Prefix + "VnfsCreatedCount") vnfsCreatedCount++ execution.setVariable(Prefix + "VnfsCreatedCount", vnfsCreatedCount) - msoLogger.debug(" ***** Completed validateVnfCreate of CreateVcpeResCustService ***** " + " vnf # " + vnfsCreatedCount) + logger.debug(" ***** Completed validateVnfCreate of CreateVcpeResCustService ***** " + " vnf # " + vnfsCreatedCount) } catch (Exception ex) { // try error in method block String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method validateVnfCreate() - " + ex.getMessage() @@ -697,7 +703,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { // ***************************************** public void postProcessResponse(DelegateExecution execution) { - msoLogger.trace("Inside postProcessResponse of CreateVcpeResCustService ") + logger.trace("Inside postProcessResponse of CreateVcpeResCustService ") try { String source = execution.getVariable("source") @@ -720,10 +726,10 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { // Format Response String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - msoLogger.debug(xmlMsoCompletionRequest) + logger.debug(xmlMsoCompletionRequest) execution.setVariable(Prefix + "Success", true) execution.setVariable(Prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest) - msoLogger.debug(" SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + logger.debug(" SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) } catch (BpmnError e) { throw e; } catch (Exception ex) { @@ -734,53 +740,53 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { } public void preProcessRollback(DelegateExecution execution) { - msoLogger.trace("preProcessRollback of CreateVcpeResCustService ") + logger.trace("preProcessRollback of CreateVcpeResCustService ") 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 of CreateVcpeResCustService ") + logger.trace("Exit preProcessRollback of CreateVcpeResCustService ") } public void postProcessRollback(DelegateExecution execution) { - msoLogger.trace("postProcessRollback of CreateVcpeResCustService ") + logger.trace("postProcessRollback of CreateVcpeResCustService ") 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(msg) } - msoLogger.trace("Exit postProcessRollback of CreateVcpeResCustService ") + logger.trace("Exit postProcessRollback of CreateVcpeResCustService ") } public void prepareFalloutRequest(DelegateExecution execution) { - msoLogger.trace("STARTED CreateVcpeResCustService prepareFalloutRequest Process ") + logger.trace("STARTED CreateVcpeResCustService 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(Prefix + "requestInfo") - msoLogger.debug(" Incoming Request Info: " + requestInfo) + logger.debug(" Incoming Request Info: " + requestInfo) //TODO. hmmm. there is no way to UPDATE error message. // String errorMessage = wfex.getErrorMessage() @@ -796,17 +802,17 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "falloutRequest", falloutRequest) } catch (Exception ex) { - msoLogger.debug("Error Occured in CreateVcpeResCustService prepareFalloutRequest Process " + ex.getMessage()) + logger.debug("Error Occured in CreateVcpeResCustService prepareFalloutRequest Process " + ex.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVcpeResCustService prepareFalloutRequest Process") } - msoLogger.trace("COMPLETED CreateVcpeResCustService prepareFalloutRequest Process ") + logger.trace("COMPLETED CreateVcpeResCustService prepareFalloutRequest Process ") } public void sendSyncError(DelegateExecution execution) { execution.setVariable("prefix", Prefix) - msoLogger.trace("Inside sendSyncError() of CreateVcpeResCustService ") + logger.trace("Inside sendSyncError() of CreateVcpeResCustService ") try { String errorMessage = "" @@ -823,31 +829,33 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { 7000 """ - 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 processJavaException(DelegateExecution execution) { 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(Prefix + "unexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") } catch (BpmnError b) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue()); throw b } catch (Exception e) { - msoLogger.debug("Caught Exception during processJavaException Method: " + e) + logger.debug("Caught Exception during processJavaException Method: " + e) execution.setVariable(Prefix + "unexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildAndThrowWorkflowException(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/vcpe/scripts/DeleteVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy index 7a40ef978b..75f5ec9161 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.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.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.onap.so.client.aai.AAIResourcesClient import org.onap.so.client.aai.AAIObjectType @@ -45,7 +49,7 @@ import javax.ws.rs.NotFoundException * */ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteVcpeResCustService.class); + private static final Logger logger = LoggerFactory.getLogger(DeleteVcpeResCustService.class); private static final String DebugFlag = "isDebugLogEnabled" @@ -79,7 +83,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { def isDebugEnabled=execution.getVariable(DebugFlag) execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside preProcessRequest DeleteVcpeResCustService Request ") + logger.trace("Inside preProcessRequest DeleteVcpeResCustService Request ") try { // initialize flow variables @@ -87,7 +91,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { // check for incoming json message/input String DeleteVcpeResCustServiceRequest = execution.getVariable("bpmnRequest") - msoLogger.debug(DeleteVcpeResCustServiceRequest) + logger.debug(DeleteVcpeResCustServiceRequest) execution.setVariable("DeleteVcpeResCustServiceRequest", DeleteVcpeResCustServiceRequest); println 'DeleteVcpeResCustServiceRequest - ' + DeleteVcpeResCustServiceRequest @@ -120,34 +124,34 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { String suppressRollback = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestInfo.suppressRollback") execution.setVariable("disableRollback", suppressRollback) - msoLogger.debug("Incoming Suppress/Disable Rollback is: " + suppressRollback) + logger.debug("Incoming Suppress/Disable Rollback is: " + suppressRollback) String productFamilyId = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestInfo.productFamilyId") execution.setVariable("productFamilyId", productFamilyId) - msoLogger.debug("Incoming productFamilyId is: " + productFamilyId) + logger.debug("Incoming productFamilyId is: " + productFamilyId) // extract subscriptionServiceType String subscriptionServiceType = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestParameters.subscriptionServiceType") execution.setVariable("subscriptionServiceType", subscriptionServiceType) - msoLogger.debug("Incoming subscriptionServiceType is: " + subscriptionServiceType) + logger.debug("Incoming subscriptionServiceType is: " + subscriptionServiceType) // extract cloud configuration String cloudConfiguration = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.cloudConfiguration") execution.setVariable("cloudConfiguration", cloudConfiguration) - msoLogger.debug("cloudConfiguration: "+ cloudConfiguration) + logger.debug("cloudConfiguration: "+ cloudConfiguration) String lcpCloudRegionId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId") execution.setVariable("lcpCloudRegionId", lcpCloudRegionId) - msoLogger.debug("lcpCloudRegionId: "+ lcpCloudRegionId) + logger.debug("lcpCloudRegionId: "+ lcpCloudRegionId) String cloudOwner = jsonUtil.getJsonValue(cloudConfiguration, "cloudOwner") execution.setVariable("cloudOwner", cloudOwner) - msoLogger.debug("cloudOwner: "+ cloudOwner) + logger.debug("cloudOwner: "+ cloudOwner) String tenantId = jsonUtil.getJsonValue(cloudConfiguration, "tenantId") execution.setVariable("tenantId", tenantId) - msoLogger.debug("tenantId: "+ tenantId) + logger.debug("tenantId: "+ tenantId) String sdncVersion = "1707" execution.setVariable("sdncVersion", sdncVersion) - msoLogger.debug("sdncVersion: "+ sdncVersion) + logger.debug("sdncVersion: "+ sdncVersion) //For Completion Handler & Fallout Handler String requestInfo = @@ -159,7 +163,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { execution.setVariable(Prefix+"requestInfo", requestInfo) - msoLogger.trace("Completed preProcessRequest DeleteVcpeResCustServiceRequest Request ") + logger.trace("Completed preProcessRequest DeleteVcpeResCustServiceRequest Request ") } catch (BpmnError e) { throw e; @@ -172,7 +176,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { public void sendSyncResponse(DelegateExecution execution) { def isDebugEnabled=execution.getVariable(DebugFlag) - msoLogger.trace("Inside sendSyncResponse of DeleteVcpeResCustService ") + logger.trace("Inside sendSyncResponse of DeleteVcpeResCustService ") try { String serviceInstanceId = execution.getVariable("serviceInstanceId") @@ -181,7 +185,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { // 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 exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage() @@ -225,23 +229,23 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { def id = jsonUtil.getJsonValue(ar, "id") if(type == "TunnelXConn" || type == "Tunnel XConn") { - msoLogger.debug("TunnelXConn AR found") + logger.debug("TunnelXConn AR found") TXC_found = true TXC_id = id }else if(type == "BRG") { - msoLogger.debug("BRG AR found") + logger.debug("BRG AR found") BRG_found = true BRG_id = id } execution.setVariable(Prefix+"TunnelXConn", TXC_found) execution.setVariable("TXC_allottedResourceId", TXC_id) - msoLogger.debug("TXC_allottedResourceId: " + TXC_id) + logger.debug("TXC_allottedResourceId: " + TXC_id) execution.setVariable(Prefix+"BRG", BRG_found) execution.setVariable("BRG_allottedResourceId", BRG_id) - msoLogger.debug("BRG_allottedResourceId: " + BRG_id) + logger.debug("BRG_allottedResourceId: " + BRG_id) } } @@ -258,11 +262,11 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { }catch(BpmnError e) { throw e; }catch(NotFoundException e) { - msoLogger.debug("Service Instance does not exist AAI") + logger.debug("Service Instance does not exist AAI") exceptionUtil.buildAndThrowWorkflowException(execution, 404, "Service Instance was not found in aai") }catch(Exception ex) { String msg = "Internal Error in getServiceInstance: " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } @@ -273,7 +277,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { // ******************************* public void prepareVnfAndModulesDelete (DelegateExecution execution) { def isDebugEnabled=execution.getVariable(DebugFlag) - msoLogger.trace("Inside prepareVnfAndModulesDelete of DeleteVcpeResCustService ") + logger.trace("Inside prepareVnfAndModulesDelete of DeleteVcpeResCustService ") try { List vnfList = execution.getVariable(Prefix+"relatedVnfIdList") @@ -285,9 +289,9 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { } execution.setVariable("vnfId", vnfId) - msoLogger.debug("need to delete vnfId:" + vnfId) + logger.debug("need to delete vnfId:" + vnfId) - msoLogger.trace("Completed prepareVnfAndModulesDelete of DeleteVcpeResCustService ") + logger.trace("Completed prepareVnfAndModulesDelete of DeleteVcpeResCustService ") } catch (Exception ex) { // try error in method block String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected Error from method prepareVnfAndModulesDelete() - " + ex.getMessage() @@ -300,7 +304,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { // ******************************* public void validateVnfDelete (DelegateExecution execution) { def isDebugEnabled=execution.getVariable(DebugFlag) - msoLogger.trace("Inside validateVnfDelete of DeleteVcpeResCustService ") + logger.trace("Inside validateVnfDelete of DeleteVcpeResCustService ") try { int vnfsDeletedCount = execution.getVariable(Prefix+"vnfsDeletedCount") @@ -308,7 +312,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { execution.setVariable(Prefix+"vnfsDeletedCount", vnfsDeletedCount) - msoLogger.debug(" ***** Completed validateVnfDelete of DeleteVcpeResCustService ***** "+" vnf # "+vnfsDeletedCount) + logger.debug(" ***** Completed validateVnfDelete of DeleteVcpeResCustService ***** "+" vnf # "+vnfsDeletedCount) } catch (Exception ex) { // try error in method block String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected Error from method validateVnfDelete() - " + ex.getMessage() @@ -322,7 +326,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { // ***************************************** public void postProcessResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable(DebugFlag) - msoLogger.trace("Inside postProcessResponse of DeleteVcpeResCustService ") + logger.trace("Inside postProcessResponse of DeleteVcpeResCustService ") try { String source = execution.getVariable("source") @@ -343,10 +347,10 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { // Format Response String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - msoLogger.debug(xmlMsoCompletionRequest) + logger.debug(xmlMsoCompletionRequest) execution.setVariable(Prefix+"Success", true) execution.setVariable(Prefix+"CompleteMsoProcessRequest", xmlMsoCompletionRequest) - msoLogger.debug(" SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + logger.debug(" SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) } catch (BpmnError e) { throw e; @@ -359,28 +363,28 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { public void prepareFalloutRequest(DelegateExecution execution){ def isDebugEnabled=execution.getVariable(DebugFlag) - msoLogger.trace("STARTED DeleteVcpeResCustService prepareFalloutRequest Process ") + logger.trace("STARTED DeleteVcpeResCustService 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(Prefix+"requestInfo") - msoLogger.debug(" Incoming Request Info: " + requestInfo) + logger.debug(" Incoming Request Info: " + requestInfo) String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) execution.setVariable(Prefix+"falloutRequest", falloutRequest) } catch (Exception ex) { - msoLogger.debug("Error Occured in DeleteVcpeResCustService prepareFalloutRequest Process " + ex.getMessage()) + logger.debug("Error Occured in DeleteVcpeResCustService prepareFalloutRequest Process " + ex.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVcpeResCustService prepareFalloutRequest Process") } - msoLogger.trace("COMPLETED DeleteVcpeResCustService prepareFalloutRequest Process ") + logger.trace("COMPLETED DeleteVcpeResCustService prepareFalloutRequest Process ") } public void sendSyncError (DelegateExecution execution) { def isDebugEnabled=execution.getVariable(DebugFlag) - msoLogger.trace("Inside sendSyncError() of DeleteVcpeResCustService ") + logger.trace("Inside sendSyncError() of DeleteVcpeResCustService ") try { String errorMessage = "" @@ -397,10 +401,10 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { 7000 """ - 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()) } } @@ -408,20 +412,22 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { def isDebugEnabled=execution.getVariable(DebugFlag) 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(Prefix+"unexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") }catch(BpmnError b){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue()); throw b }catch(Exception e){ - msoLogger.debug("Caught Exception during processJavaException Method: " + e) + logger.debug("Caught Exception during processJavaException Method: " + e) execution.setVariable(Prefix+"unexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildAndThrowWorkflowException(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/vcpe/scripts/DoCreateAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy index e7baccd460..db8c993533 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.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,6 +36,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 javax.ws.rs.NotFoundException import javax.ws.rs.core.UriBuilder @@ -71,7 +75,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank * */ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateAllottedResourceBRG.class); + private static final Logger logger = LoggerFactory.getLogger(DoCreateAllottedResourceBRG.class); String Prefix="DCARBRG_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -81,7 +85,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ String msg = "" - msoLogger.trace("start preProcessRequest") + logger.trace("start preProcessRequest") try { execution.setVariable("prefix", Prefix) @@ -90,78 +94,78 @@ public class DoCreateAllottedResourceBRG 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) String sdncReplDelay = UrnPropertiesReader.getVariable("mso.workflow.sdnc.replication.delay",execution) if (isBlank(sdncReplDelay)) { msg = "mso.workflow.sdnc.replication.delay is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } execution.setVariable("sdncReplDelay", sdncReplDelay) - msoLogger.debug("SDNC replication delay: " + sdncReplDelay) + logger.debug("SDNC replication delay: " + sdncReplDelay) //Request Inputs if (isBlank(execution.getVariable("serviceInstanceId"))){ msg = "Input serviceInstanceId is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("parentServiceInstanceId"))) { msg = "Input parentServiceInstanceId is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("allottedResourceModelInfo"))) { msg = "Input allottedResourceModelInfo is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("vni"))) { msg = "Input vni is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("vgmuxBearerIP"))) { msg = "Input vgmuxBearerIP is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("brgWanMacAddress"))) { msg = "Input brgWanMacAddress is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("allottedResourceRole"))) { msg = "Input allottedResourceRole is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("allottedResourceType"))) { msg = "Input allottedResourceType is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") + logger.debug("Rethrowing MSOWorkflowException") throw b } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessRequest") + logger.trace("end preProcessRequest") } /** * Gets the service instance uri from aai */ public void getServiceInstance(DelegateExecution execution) { - msoLogger.trace("getServiceInstance ") + logger.trace("getServiceInstance ") try { String serviceInstanceId = execution.getVariable('serviceInstanceId') @@ -178,16 +182,16 @@ public class DoCreateAllottedResourceBRG 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) } - msoLogger.trace("Exit getServiceInstance ") + logger.trace("Exit getServiceInstance ") } public void getAaiAR (DelegateExecution execution) { - msoLogger.trace("start getAaiAR") + logger.trace("start getAaiAR") String arType = execution.getVariable("allottedResourceType") String arRole = execution.getVariable("allottedResourceRole") @@ -216,14 +220,14 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ } } if (!isBlank(errorMsg)) { - msoLogger.debug(errorMsg) + logger.debug(errorMsg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg) } - msoLogger.trace("end getAaiAR") + logger.trace("end getAaiAR") } public void getParentServiceInstance(DelegateExecution execution) { - msoLogger.trace("getParentServiceInstance ") + logger.trace("getParentServiceInstance ") try { String serviceInstanceId = execution.getVariable('parentServiceInstanceId') @@ -242,17 +246,17 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ throw e; }catch (Exception ex){ String msg = "Exception in getParentServiceInstance. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit getParentServiceInstance ") + logger.trace("Exit getParentServiceInstance ") } public void createAaiAR(DelegateExecution execution) { - msoLogger.trace("start createAaiAR") + logger.trace("start createAaiAR") String allottedResourceId = execution.getVariable("allottedResourceId") if (isBlank(allottedResourceId)) @@ -297,14 +301,14 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ rollbackData.put(Prefix, "serviceInstanceId", execution.getVariable("serviceInstanceId")) rollbackData.put(Prefix, "parentServiceInstanceId", execution.getVariable("parentServiceInstanceId")) execution.setVariable("rollbackData", rollbackData) - msoLogger.trace("end createAaiAR") + logger.trace("end createAaiAR") } public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) { String msg = "" - msoLogger.trace("start buildSDNCRequest") + logger.trace("start buildSDNCRequest") String sdncReq = null try { @@ -392,15 +396,15 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ """ - msoLogger.debug("sdncRequest:\n" + sdncReq) + logger.debug("sdncRequest:\n" + sdncReq) sdncReq = utils.formatXml(sdncReq) } catch(Exception ex) { msg = "Exception in buildSDNCRequest. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end buildSDNCRequest") + logger.trace("end buildSDNCRequest") return sdncReq } @@ -408,110 +412,110 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ String msg = "" - msoLogger.trace("start preProcessSDNCAssign") + logger.trace("start preProcessSDNCAssign") try { String sdncRequestId = UUID.randomUUID().toString() String sdncAssignReq = buildSDNCRequest(execution, "assign", sdncRequestId) execution.setVariable("sdncAssignRequest", sdncAssignReq) - msoLogger.debug("sdncAssignRequest: " + sdncAssignReq) + logger.debug("sdncAssignRequest: " + sdncAssignReq) def sdncRequestId2 = UUID.randomUUID().toString() String sdncAssignRollbackReq = sdncAssignReq.replace(">assign<", ">unassign<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") def rollbackData = execution.getVariable("rollbackData") rollbackData.put(Prefix, "sdncAssignRollbackReq", sdncAssignRollbackReq) execution.setVariable("rollbackData", rollbackData) - msoLogger.debug("sdncAssignRollbackReq:\n" + sdncAssignRollbackReq) - msoLogger.debug("rollbackData:\n" + rollbackData.toString()) + logger.debug("sdncAssignRollbackReq:\n" + sdncAssignRollbackReq) + logger.debug("rollbackData:\n" + rollbackData.toString()) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCAssign. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessSDNCAssign") + logger.trace("end preProcessSDNCAssign") } public void preProcessSDNCCreate(DelegateExecution execution) { String msg = "" - msoLogger.trace("start preProcessSDNCCreate") + logger.trace("start preProcessSDNCCreate") try { String sdncRequestId = UUID.randomUUID().toString() String sdncCreateReq = buildSDNCRequest(execution, "create", sdncRequestId) execution.setVariable("sdncCreateRequest", sdncCreateReq) - msoLogger.debug("sdncCreateReq: " + sdncCreateReq) + logger.debug("sdncCreateReq: " + sdncCreateReq) def sdncRequestId2 = UUID.randomUUID().toString() String sdncCreateRollbackReq = sdncCreateReq.replace(">create<", ">delete<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") def rollbackData = execution.getVariable("rollbackData") rollbackData.put(Prefix, "sdncCreateRollbackReq", sdncCreateRollbackReq) execution.setVariable("rollbackData", rollbackData) - msoLogger.debug("sdncCreateRollbackReq:\n" + sdncCreateRollbackReq) - msoLogger.debug("rollbackData:\n" + rollbackData.toString()) + logger.debug("sdncCreateRollbackReq:\n" + sdncCreateRollbackReq) + logger.debug("rollbackData:\n" + rollbackData.toString()) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCCreate. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessSDNCCreate") + logger.trace("end preProcessSDNCCreate") } public void preProcessSDNCActivate(DelegateExecution execution) { String msg = "" - msoLogger.trace("start preProcessSDNCActivate") + logger.trace("start preProcessSDNCActivate") try { String sdncRequestId = UUID.randomUUID().toString() String sdncActivateReq = buildSDNCRequest(execution, "activate", sdncRequestId) execution.setVariable("sdncActivateRequest", sdncActivateReq) - msoLogger.debug("sdncActivateReq: " + sdncActivateReq) + logger.debug("sdncActivateReq: " + sdncActivateReq) def sdncRequestId2 = UUID.randomUUID().toString() String sdncActivateRollbackReq = sdncActivateReq.replace(">activate<", ">deactivate<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") def rollbackData = execution.getVariable("rollbackData") rollbackData.put(Prefix, "sdncActivateRollbackReq", sdncActivateRollbackReq) execution.setVariable("rollbackData", rollbackData) - msoLogger.debug("sdncActivateRollbackReq:\n" + sdncActivateRollbackReq) - msoLogger.debug("rollbackData:\n" + rollbackData.toString()) + logger.debug("sdncActivateRollbackReq:\n" + sdncActivateRollbackReq) + logger.debug("rollbackData:\n" + rollbackData.toString()) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCActivate. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessSDNCActivate") + logger.trace("end preProcessSDNCActivate") } public void validateSDNCResp(DelegateExecution execution, String response, String method){ - msoLogger.trace("ValidateSDNCResponse Process") + logger.trace("ValidateSDNCResponse Process") String msg = "" try { WorkflowException workflowException = execution.getVariable("WorkflowException") - msoLogger.debug("workflowException: " + workflowException) + logger.debug("workflowException: " + workflowException) boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - 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("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) + logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) if (!"get".equals(method)) { @@ -521,22 +525,22 @@ public class DoCreateAllottedResourceBRG 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") } } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in validateSDNCResp. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("End ValidateSDNCResp Process") + logger.trace("End ValidateSDNCResp Process") } public void preProcessSDNCGet(DelegateExecution execution){ - msoLogger.trace("start preProcessSDNCGet") + logger.trace("start preProcessSDNCGet") try{ def callbackUrl = execution.getVariable("sdncCallbackUrl") @@ -548,15 +552,15 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ if (execution.getVariable("foundActiveAR")) { def aaiQueryResponse = execution.getVariable("aaiARGetResponse") serviceOperation = utils.getNodeText(aaiQueryResponse, "selflink") - msoLogger.debug("AR service operation/aaiARSelfLink: " + serviceOperation) + logger.debug("AR service operation/aaiARSelfLink: " + serviceOperation) } else { String response = execution.getVariable("sdncAssignResponse") String data = utils.getNodeXml(response, "response-data") - msoLogger.debug("Assign responseData: " + data) + logger.debug("Assign responseData: " + data) serviceOperation = utils.getNodeText(data, "object-path") - msoLogger.debug("AR service operation:" + serviceOperation) + logger.debug("AR service operation:" + serviceOperation) } String serviceInstanceId = execution.getVariable("serviceInstanceId") @@ -581,28 +585,30 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ execution.setVariable("sdncGetRequest", 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 SDNC GET Method:\n" + e.getMessage()) } - msoLogger.trace("end preProcessSDNCGet") + logger.trace("end preProcessSDNCGet") } public void updateAaiAROrchStatus(DelegateExecution execution, String status){ - msoLogger.trace("start updateAaiAROrchStatus") + logger.trace("start updateAaiAROrchStatus") String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create AllottedResourceUtils arUtils = new AllottedResourceUtils(this) String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) - msoLogger.trace("end updateAaiAROrchStatus") + logger.trace("end updateAaiAROrchStatus") } public void generateOutputs(DelegateExecution execution) { - msoLogger.trace("start generateOutputs") + logger.trace("start generateOutputs") try { String sdncGetResponse = execution.getVariable("enhancedCallbackRequestData") //unescaped - msoLogger.debug("resp:" + sdncGetResponse) + logger.debug("resp:" + sdncGetResponse) String arData = utils.getNodeXml(sdncGetResponse, "brg-topology") arData = utils.removeXmlNamespaces(arData) @@ -610,55 +616,55 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ String ari = utils.getNodeXml(arData, "allotted-resource-identifiers") execution.setVariable("allotedResourceName", utils.getNodeText(ari, "allotted-resource-name")) } catch (BpmnError e) { - msoLogger.debug("BPMN Error in generateOutputs ") + logger.debug("BPMN Error in generateOutputs ") } catch(Exception ex) { String msg = "Exception in generateOutputs " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } - msoLogger.trace("end generateOutputs") + logger.trace("end generateOutputs") } public void preProcessRollback (DelegateExecution execution) { - msoLogger.trace("start preProcessRollback") + logger.trace("start 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("end preProcessRollback") + logger.trace("end preProcessRollback") } public void postProcessRollback (DelegateExecution execution) { - msoLogger.trace("start postProcessRollback") + logger.trace("start 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("end postProcessRollback") + logger.trace("end postProcessRollback") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy index 856c893b47..03f795cadf 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.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.common.scripts.SDNCAdapterUtils 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 import static org.apache.commons.lang3.StringUtils.isBlank @@ -50,7 +54,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank * */ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateAllottedResourceBRGRollback.class); + private static final Logger logger = LoggerFactory.getLogger(DoCreateAllottedResourceBRGRollback.class); String Prefix="DCARBRGRB_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -59,13 +63,13 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc String msg = "" - msoLogger.trace("start preProcessRequest") + logger.trace("start preProcessRequest") execution.setVariable("prefix", Prefix) String rbType = "DCARBRG_" try { def rollbackData = execution.getVariable("rollbackData") - msoLogger.debug("RollbackData:" + rollbackData) + logger.debug("RollbackData:" + rollbackData) if (rollbackData != null) { if (rollbackData.hasType(rbType)) { @@ -90,9 +94,9 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc execution.setVariable("deleteSdnc", rollbackData.get(rbType, "rollbackSDNCcreate")) execution.setVariable("unassignSdnc", rollbackData.get(rbType, "rollbackSDNCassign")) - msoLogger.debug("sdncDeactivate:\n" + execution.getVariable("deactivateSdnc") ) - msoLogger.debug("sdncDelete:\n" + execution.getVariable("deleteSdnc")) - msoLogger.debug("sdncUnassign:\n" + execution.getVariable("unassignSdnc")) + logger.debug("sdncDeactivate:\n" + execution.getVariable("deactivateSdnc") ) + logger.debug("sdncDelete:\n" + execution.getVariable("deleteSdnc")) + logger.debug("sdncUnassign:\n" + execution.getVariable("unassignSdnc")) execution.setVariable("sdncDeactivateRequest", rollbackData.get(rbType, "sdncActivateRollbackReq")) execution.setVariable("sdncDeleteRequest", rollbackData.get(rbType, "sdncCreateRollbackReq")) @@ -117,24 +121,24 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc } }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") + logger.debug("Rethrowing MSOWorkflowException") throw b } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessRequest") + logger.trace("end preProcessRequest") } // aaiARPath set during query (existing AR) public void updateAaiAROrchStatus(DelegateExecution execution, String status){ String msg = null; - msoLogger.trace("start updateAaiAROrchStatus") + logger.trace("start updateAaiAROrchStatus") AllottedResourceUtils arUtils = new AllottedResourceUtils(this) String aaiARPath = execution.getVariable("aaiARPath") - msoLogger.debug(" aaiARPath:" + aaiARPath) + logger.debug(" aaiARPath:" + aaiARPath) Optional ar = Optional.empty(); //need this for getting resourceVersion for delete if (!isBlank(aaiARPath)) { @@ -143,73 +147,75 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc if(!ar.isPresent()) { msg = "AR not found in AAI at:" + aaiARPath - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) - msoLogger.trace("end updateAaiAROrchStatus") + logger.trace("end updateAaiAROrchStatus") } public void validateSDNCResp(DelegateExecution execution, String response, String method){ - msoLogger.trace("start ValidateSDNCResponse Process") + logger.trace("start ValidateSDNCResponse Process") String msg = "" try { WorkflowException workflowException = execution.getVariable("WorkflowException") - msoLogger.debug("workflowException: " + workflowException) + logger.debug("workflowException: " + workflowException) boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - 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("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) + logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) }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") } } catch (BpmnError e) { if ("404".contentEquals(e.getErrorCode())) { msg = "SDNC rollback " + method + " returned a 404. Proceding with rollback" - msoLogger.debug(msg) + logger.debug(msg) } else { throw e; } } catch(Exception ex) { msg = "Exception in validateSDNCResp. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end ValidateSDNCResp Process") + logger.trace("end ValidateSDNCResp Process") } public void deleteAaiAR(DelegateExecution execution){ try{ - msoLogger.trace("start deleteAaiAR") + logger.trace("start deleteAaiAR") AllottedResourceUtils arUtils = new AllottedResourceUtils(this) String arLink = execution.getVariable("aaiARPath") arUtils.deleteAR(execution, arLink ) } catch (BpmnError e) { throw e; }catch(Exception ex){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) } - msoLogger.trace("end deleteAaiAR") + logger.trace("end deleteAaiAR") } public void postProcessRequest(DelegateExecution execution) { - msoLogger.trace("start postProcessRequest") + logger.trace("start postProcessRequest") String msg = "" try { execution.setVariable("rollbackData", null) @@ -217,52 +223,52 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc if (skipRollback != true) { execution.setVariable("rolledBack", true) - msoLogger.debug("rolledBack") + logger.debug("rolledBack") } - msoLogger.trace("end postProcessRequest") + logger.trace("end postProcessRequest") } catch (BpmnError e) { msg = "Bpmn Exception in postProcessRequest. " - msoLogger.debug(msg) + logger.debug(msg) } catch (Exception ex) { msg = "Exception in postProcessRequest. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } } public void processRollbackException(DelegateExecution execution){ - msoLogger.trace("start processRollbackException") + logger.trace("start processRollbackException") try{ - msoLogger.debug("Caught an Exception in DoCreateAllottedResourceRollback") + logger.debug("Caught an Exception in DoCreateAllottedResourceRollback") execution.setVariable("rollbackData", null) execution.setVariable("rolledBack", false) execution.setVariable("rollbackError", "Caught exception in AllottedResource 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("end processRollbackException") + logger.trace("end processRollbackException") } public void processRollbackJavaException(DelegateExecution execution){ - msoLogger.trace("start processRollbackJavaException") + logger.trace("start processRollbackJavaException") try{ execution.setVariable("rollbackData", null) execution.setVariable("rolledBack", false) execution.setVariable("rollbackError", "Caught Java exception in AllottedResource 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("end processRollbackJavaException") + logger.trace("end processRollbackJavaException") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy index 56fa3a6730..a5f0d7dc30 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.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.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 javax.ws.rs.core.UriBuilder import static org.apache.commons.lang3.StringUtils.isBlank @@ -69,7 +73,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank * */ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateAllottedResourceTXC.class); + private static final Logger logger = LoggerFactory.getLogger(DoCreateAllottedResourceTXC.class); String Prefix="DCARTXC_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -79,11 +83,11 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ String msg = "" - msoLogger.trace("start preProcessRequest") + logger.trace("start preProcessRequest") try { String msoRequestId = execution.getVariable("msoRequestId") - msoLogger.debug(" msoRequestId = " + msoRequestId) + logger.debug(" msoRequestId = " + msoRequestId) execution.setVariable("prefix", Prefix) @@ -91,67 +95,67 @@ public class DoCreateAllottedResourceTXC 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) String sdncReplDelay = UrnPropertiesReader.getVariable("mso.workflow.sdnc.replication.delay",execution) if (isBlank(sdncReplDelay)) { msg = "mso.workflow.sdnc.replication.delay is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } execution.setVariable("sdncReplDelay", sdncReplDelay) - msoLogger.debug("SDNC replication delay: " + sdncReplDelay) + logger.debug("SDNC replication delay: " + sdncReplDelay) //Request Inputs if (isBlank(execution.getVariable("serviceInstanceId"))){ msg = "Input serviceInstanceId is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("parentServiceInstanceId"))) { msg = "Input parentServiceInstanceId is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("allottedResourceModelInfo"))) { msg = "Input allottedResourceModelInfo is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("brgWanMacAddress"))) { msg = "Input brgWanMacAddress is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("allottedResourceRole"))) { msg = "Input allottedResourceRole is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("allottedResourceType"))) { msg = "Input allottedResourceType is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") + logger.debug("Rethrowing MSOWorkflowException") throw b } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessRequest") + logger.trace("end preProcessRequest") } public void getAaiAR (DelegateExecution execution) { - msoLogger.trace("start getAaiAR") + logger.trace("start getAaiAR") String arType = execution.getVariable("allottedResourceType") String arRole = execution.getVariable("allottedResourceRole") @@ -180,16 +184,16 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ } } if (!isBlank(errorMsg)) { - msoLogger.debug(errorMsg) + logger.debug(errorMsg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg) } - msoLogger.trace("end getAaiAR") + logger.trace("end getAaiAR") } public void createAaiAR(DelegateExecution execution) { - msoLogger.trace("start createAaiAR") + logger.trace("start createAaiAR") String allottedResourceId = execution.getVariable("allottedResourceId") if (isBlank(allottedResourceId)) @@ -208,7 +212,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ String arRole = execution.getVariable("allottedResourceRole") String CSI_resourceLink = execution.getVariable("CSI_resourceLink") String arModelInfo = execution.getVariable("allottedResourceModelInfo") - msoLogger.debug("arModelInfo is:\n" + arModelInfo) + logger.debug("arModelInfo is:\n" + arModelInfo) String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid") String modelVersionId = jsonUtil.getJsonValue(arModelInfo, "modelUuid") @@ -235,14 +239,14 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ rollbackData.put(Prefix, "serviceInstanceId", execution.getVariable("serviceInstanceId")) rollbackData.put(Prefix, "parentServiceInstanceId", execution.getVariable("parentServiceInstanceId")) execution.setVariable("rollbackData", rollbackData) - msoLogger.trace("end createAaiAR") + logger.trace("end createAaiAR") } public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) { String msg = "" - msoLogger.trace("start buildSDNCRequest") + logger.trace("start buildSDNCRequest") String sdncReq = null try { @@ -327,15 +331,15 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ """ - msoLogger.debug("sdncRequest:\n" + sdncReq) + logger.debug("sdncRequest:\n" + sdncReq) sdncReq = utils.formatXml(sdncReq) } catch(Exception ex) { msg = "Exception in buildSDNCRequest. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end buildSDNCRequest") + logger.trace("end buildSDNCRequest") return sdncReq } @@ -343,110 +347,110 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ String msg = "" - msoLogger.trace("start preProcessSDNCAssign") + logger.trace("start preProcessSDNCAssign") try { String sdncRequestId = UUID.randomUUID().toString() String sdncAssignReq = buildSDNCRequest(execution, "assign", sdncRequestId) execution.setVariable("sdncAssignRequest", sdncAssignReq) - msoLogger.debug("sdncAssignRequest: " + sdncAssignReq) + logger.debug("sdncAssignRequest: " + sdncAssignReq) def sdncRequestId2 = UUID.randomUUID().toString() String sdncAssignRollbackReq = sdncAssignReq.replace(">assign<", ">unassign<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") def rollbackData = execution.getVariable("rollbackData") rollbackData.put(Prefix, "sdncAssignRollbackReq", sdncAssignRollbackReq) execution.setVariable("rollbackData", rollbackData) - msoLogger.debug("sdncAssignRollbackReq:\n" + sdncAssignRollbackReq) - msoLogger.debug("rollbackData:\n" + rollbackData.toString()) + logger.debug("sdncAssignRollbackReq:\n" + sdncAssignRollbackReq) + logger.debug("rollbackData:\n" + rollbackData.toString()) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCAssign. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.debug("end preProcessSDNCAssign") + logger.debug("end preProcessSDNCAssign") } public void preProcessSDNCCreate(DelegateExecution execution) { String msg = "" - msoLogger.trace("start preProcessSDNCCreate") + logger.trace("start preProcessSDNCCreate") try { String sdncRequestId = UUID.randomUUID().toString() String sdncCreateReq = buildSDNCRequest(execution, "create", sdncRequestId) execution.setVariable("sdncCreateRequest", sdncCreateReq) - msoLogger.debug("sdncCreateReq: " + sdncCreateReq) + logger.debug("sdncCreateReq: " + sdncCreateReq) def sdncRequestId2 = UUID.randomUUID().toString() String sdncCreateRollbackReq = sdncCreateReq.replace(">create<", ">delete<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") def rollbackData = execution.getVariable("rollbackData") rollbackData.put(Prefix, "sdncCreateRollbackReq", sdncCreateRollbackReq) execution.setVariable("rollbackData", rollbackData) - msoLogger.debug("sdncCreateRollbackReq:\n" + sdncCreateRollbackReq) - msoLogger.debug("rollbackData:\n" + rollbackData.toString()) + logger.debug("sdncCreateRollbackReq:\n" + sdncCreateRollbackReq) + logger.debug("rollbackData:\n" + rollbackData.toString()) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCCreate. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessSDNCCreate") + logger.trace("end preProcessSDNCCreate") } public void preProcessSDNCActivate(DelegateExecution execution) { String msg = "" - msoLogger.trace("start preProcessSDNCActivate") + logger.trace("start preProcessSDNCActivate") try { String sdncRequestId = UUID.randomUUID().toString() String sdncActivateReq = buildSDNCRequest(execution, "activate", sdncRequestId) execution.setVariable("sdncActivateRequest", sdncActivateReq) - msoLogger.debug("sdncActivateReq: " + sdncActivateReq) + logger.debug("sdncActivateReq: " + sdncActivateReq) def sdncRequestId2 = UUID.randomUUID().toString() String sdncActivateRollbackReq = sdncActivateReq.replace(">activate<", ">deactivate<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") def rollbackData = execution.getVariable("rollbackData") rollbackData.put(Prefix, "sdncActivateRollbackReq", sdncActivateRollbackReq) execution.setVariable("rollbackData", rollbackData) - msoLogger.debug("sdncActivateRollbackReq:\n" + sdncActivateRollbackReq) - msoLogger.debug("rollbackData:\n" + rollbackData.toString()) + logger.debug("sdncActivateRollbackReq:\n" + sdncActivateRollbackReq) + logger.debug("rollbackData:\n" + rollbackData.toString()) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCActivate. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessSDNCActivate") + logger.trace("end preProcessSDNCActivate") } public void validateSDNCResp(DelegateExecution execution, String response, String method){ - msoLogger.trace("start ValidateSDNCResponse Process") + logger.trace("start ValidateSDNCResponse Process") String msg = "" try { WorkflowException workflowException = execution.getVariable("WorkflowException") - msoLogger.debug("workflowException: " + workflowException) + logger.debug("workflowException: " + workflowException) boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - 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("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) + logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) if (!"get".equals(method)) { @@ -456,22 +460,22 @@ public class DoCreateAllottedResourceTXC 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") } } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in validateSDNCResp. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end ValidateSDNCResp Process") + logger.trace("end ValidateSDNCResp Process") } public void preProcessSDNCGet(DelegateExecution execution){ - msoLogger.trace("start preProcessSDNCGet") + logger.trace("start preProcessSDNCGet") try{ def callbackUrl = execution.getVariable("sdncCallbackUrl") @@ -483,15 +487,15 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ if (execution.getVariable("foundActiveAR")) { def aaiQueryResponse = execution.getVariable("aaiARGetResponse") serviceOperation = utils.getNodeText(aaiQueryResponse, "selflink") - msoLogger.debug("AR service operation/aaiARSelfLink: " + serviceOperation) + logger.debug("AR service operation/aaiARSelfLink: " + serviceOperation) } else { String response = execution.getVariable("sdncAssignResponse") String data = utils.getNodeXml(response, "response-data") - msoLogger.debug("Assign responseData: " + data) + logger.debug("Assign responseData: " + data) serviceOperation = utils.getNodeText(data, "object-path") - msoLogger.debug("AR service operation:" + serviceOperation) + logger.debug("AR service operation:" + serviceOperation) } String serviceInstanceId = execution.getVariable("serviceInstanceId") @@ -516,28 +520,30 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ execution.setVariable("sdncGetRequest", 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 SDNC GET Method:\n" + e.getMessage()) } - msoLogger.trace("end preProcessSDNCGet") + logger.trace("end preProcessSDNCGet") } public void updateAaiAROrchStatus(DelegateExecution execution, String status){ - msoLogger.trace("start updateAaiAROrchStatus") + logger.trace("start updateAaiAROrchStatus") String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create AllottedResourceUtils arUtils = new AllottedResourceUtils(this) String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) - msoLogger.trace("end updateAaiAROrchStatus") + logger.trace("end updateAaiAROrchStatus") } public void generateOutputs(DelegateExecution execution) { - msoLogger.trace("start generateOutputs") + logger.trace("start generateOutputs") try { String sdncGetResponse = execution.getVariable("enhancedCallbackRequestData") //unescaped - msoLogger.debug("resp:" + sdncGetResponse) + logger.debug("resp:" + sdncGetResponse) String arData = utils.getNodeXml(sdncGetResponse, "tunnelxconn-topology") arData = utils.removeXmlNamespaces(arData) @@ -549,55 +555,55 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ String ari = utils.getNodeXml(arData, "allotted-resource-identifiers") execution.setVariable("allotedResourceName", utils.getNodeText(ari, "allotted-resource-name")) } catch (BpmnError e) { - msoLogger.debug("BPMN Error in generateOutputs ") + logger.debug("BPMN Error in generateOutputs ") } catch(Exception ex) { String msg = "Exception in generateOutputs " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } - msoLogger.trace("end generateOutputs") + logger.trace("end generateOutputs") } public void preProcessRollback (DelegateExecution execution) { - msoLogger.trace("start preProcessRollback") + logger.trace("start 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("end preProcessRollback") + logger.trace("end preProcessRollback") } public void postProcessRollback (DelegateExecution execution) { - msoLogger.trace("start postProcessRollback") + logger.trace("start 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("end postProcessRollback") + logger.trace("end postProcessRollback") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy index 06d557532b..3d34e2de94 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.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 static org.apache.commons.lang3.StringUtils.* 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 CreateAllottedResourceTXCRollback.bpmn process. @@ -57,7 +61,7 @@ import org.onap.so.logger.MsoLogger * */ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateAllottedResourceTXCRollback.class); + private static final Logger logger = LoggerFactory.getLogger(DoCreateAllottedResourceTXCRollback.class); String Prefix="DCARTXCRB_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -66,13 +70,13 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc String msg = "" - msoLogger.trace("start preProcessRequest") + logger.trace("start preProcessRequest") execution.setVariable("prefix", Prefix) String rbType = "DCARTXC_" try { def rollbackData = execution.getVariable("rollbackData") - msoLogger.debug("RollbackData:" + rollbackData) + logger.debug("RollbackData:" + rollbackData) if (rollbackData != null) { if (rollbackData.hasType(rbType)) { @@ -97,9 +101,9 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc execution.setVariable("deleteSdnc", rollbackData.get(rbType, "rollbackSDNCcreate")) execution.setVariable("unassignSdnc", rollbackData.get(rbType, "rollbackSDNCassign")) - msoLogger.debug("sdncDeactivate:\n" + execution.getVariable("deactivateSdnc") ) - msoLogger.debug("sdncDelete:\n" + execution.getVariable("deleteSdnc")) - msoLogger.debug("sdncUnassign:\n" + execution.getVariable("unassignSdnc")) + logger.debug("sdncDeactivate:\n" + execution.getVariable("deactivateSdnc") ) + logger.debug("sdncDelete:\n" + execution.getVariable("deleteSdnc")) + logger.debug("sdncUnassign:\n" + execution.getVariable("unassignSdnc")) execution.setVariable("sdncDeactivateRequest", rollbackData.get(rbType, "sdncActivateRollbackReq")) execution.setVariable("sdncDeleteRequest", rollbackData.get(rbType, "sdncCreateRollbackReq")) @@ -124,24 +128,24 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc } }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") + logger.debug("Rethrowing MSOWorkflowException") throw b } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessRequest") + logger.trace("end preProcessRequest") } // aaiARPath set during query (existing AR) public void updateAaiAROrchStatus(DelegateExecution execution, String status){ String msg = null; - msoLogger.trace("start updateAaiAROrchStatus") + logger.trace("start updateAaiAROrchStatus") AllottedResourceUtils arUtils = new AllottedResourceUtils(this) String aaiARPath = execution.getVariable("aaiARPath") - msoLogger.debug(" aaiARPath:" + aaiARPath) + logger.debug(" aaiARPath:" + aaiARPath) Optional ar = Optional.empty(); //need this for getting resourceVersion for delete if (!isBlank(aaiARPath)) { @@ -150,73 +154,75 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc if (!ar.isPresent()) { msg = "AR not found in AAI at:" + aaiARPath - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) - msoLogger.trace("end updateAaiAROrchStatus") + logger.trace("end updateAaiAROrchStatus") } public void validateSDNCResp(DelegateExecution execution, String response, String method){ - msoLogger.trace("start ValidateSDNCResponse Process") + logger.trace("start ValidateSDNCResponse Process") String msg = "" try { WorkflowException workflowException = execution.getVariable("WorkflowException") - msoLogger.debug("workflowException: " + workflowException) + logger.debug("workflowException: " + workflowException) boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - 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("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) + logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) }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") } } catch (BpmnError e) { if ("404".contentEquals(e.getErrorCode())) { msg = "SDNC rollback " + method + " returned a 404. Proceding with rollback" - msoLogger.debug(msg) + logger.debug(msg) } else { throw e; } } catch(Exception ex) { msg = "Exception in validateSDNCResp. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit ValidateSDNCResp Process") + logger.trace("Exit ValidateSDNCResp Process") } public void deleteAaiAR(DelegateExecution execution){ try{ - msoLogger.trace("start deleteAaiAR") + logger.trace("start deleteAaiAR") AllottedResourceUtils arUtils = new AllottedResourceUtils(this) String arLink = execution.getVariable("aaiARPath") arUtils.deleteAR(execution, arLink) } catch (BpmnError e) { throw e; }catch(Exception ex){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) } - msoLogger.trace("end deleteAaiAR") + logger.trace("end deleteAaiAR") } public void postProcessRequest(DelegateExecution execution) { - msoLogger.trace("start postProcessRequest") + logger.trace("start postProcessRequest") String msg = "" try { execution.setVariable("rollbackData", null) @@ -224,51 +230,51 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc if (skipRollback != true) { execution.setVariable("rolledBack", true) - msoLogger.debug("rolledBack") + logger.debug("rolledBack") } - msoLogger.trace("end postProcessRequest") + logger.trace("end postProcessRequest") } catch (BpmnError e) { - msoLogger.debug(msg) + logger.debug(msg) } catch (Exception ex) { msg = "Exception in postProcessRequest. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } } public void processRollbackException(DelegateExecution execution){ - msoLogger.trace("start processRollbackException") + logger.trace("start processRollbackException") try{ - msoLogger.debug("Caught an Exception in DoCreateAllottedResourceRollback") + logger.debug("Caught an Exception in DoCreateAllottedResourceRollback") execution.setVariable("rollbackData", null) execution.setVariable("rolledBack", false) execution.setVariable("rollbackError", "Caught exception in AllottedResource 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("end processRollbackException") + logger.trace("end processRollbackException") } public void processRollbackJavaException(DelegateExecution execution){ - msoLogger.trace("start processRollbackJavaException") + logger.trace("start processRollbackJavaException") try{ execution.setVariable("rollbackData", null) execution.setVariable("rolledBack", false) execution.setVariable("rollbackError", "Caught Java exception in AllottedResource 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("end processRollbackJavaException") + logger.trace("end processRollbackJavaException") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy index e39edffe68..3b80f3c468 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.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.UrnPropertiesReader 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 import static org.apache.commons.lang3.StringUtils.isBlank @@ -58,7 +62,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank * */ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteAllottedResourceBRG.class); + private static final Logger logger = LoggerFactory.getLogger(DoDeleteAllottedResourceBRG.class); String Prefix="DDARBRG_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -66,7 +70,7 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ public void preProcessRequest (DelegateExecution execution) { String msg = "" - msoLogger.trace("start preProcessRequest") + logger.trace("start preProcessRequest") try { execution.setVariable("prefix", Prefix) @@ -75,38 +79,38 @@ public class DoDeleteAllottedResourceBRG 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) //Request Inputs if (isBlank(execution.getVariable("serviceInstanceId"))){ msg = "Input serviceInstanceId is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("allottedResourceId"))){ msg = "Input allottedResourceId is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") + logger.debug("Rethrowing MSOWorkflowException") throw b } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessRequest") + logger.trace("end preProcessRequest") } public void getAaiAR (DelegateExecution execution) { - msoLogger.trace("start getAaiAR end") + logger.trace("start getAaiAR end") String allottedResourceId = execution.getVariable("allottedResourceId") @@ -123,26 +127,26 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ errorMsg = "Allotted resource not found in AAI with AllottedResourceId:" + allottedResourceId } if (!isBlank(errorMsg)) { - msoLogger.debug(errorMsg) + logger.debug(errorMsg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg) } - msoLogger.trace("end getAaiAR") + logger.trace("end getAaiAR") } // aaiARPath set during query (existing AR) public void updateAaiAROrchStatus(DelegateExecution execution, String status){ - msoLogger.trace("start updateAaiAROrchStatus") + logger.trace("start updateAaiAROrchStatus") AllottedResourceUtils arUtils = new AllottedResourceUtils(this) String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) - msoLogger.trace("end updateAaiAROrchStatus") + logger.trace("end updateAaiAROrchStatus") } public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) { String msg = "" - msoLogger.trace("start buildSDNCRequest") + logger.trace("start buildSDNCRequest") String sdncReq = null try { @@ -214,106 +218,107 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ """ - msoLogger.debug("sdncRequest:\n" + sdncReq) + logger.debug("sdncRequest:\n" + sdncReq) sdncReq = utils.formatXml(sdncReq) } catch(Exception ex) { msg = "Exception in buildSDNCRequest. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end buildSDNCRequest") + logger.trace("end buildSDNCRequest") return sdncReq } public void preProcessSDNCUnassign(DelegateExecution execution) { String msg = "" - msoLogger.trace("start preProcessSDNCUnassign") + logger.trace("start preProcessSDNCUnassign") try { String sdncRequestId = UUID.randomUUID().toString() String sdncUnassignReq = buildSDNCRequest(execution, "unassign", sdncRequestId) execution.setVariable("sdncUnassignRequest", sdncUnassignReq) - msoLogger.debug("sdncUnassignRequest: " + sdncUnassignReq) + logger.debug("sdncUnassignRequest: " + sdncUnassignReq) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCUnassign. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessSDNCUnassign") + logger.trace("end preProcessSDNCUnassign") } public void preProcessSDNCDelete(DelegateExecution execution) { String msg = "" - msoLogger.trace("start preProcessSDNCDelete") + logger.trace("start preProcessSDNCDelete") try { String sdncRequestId = UUID.randomUUID().toString() String sdncDeleteReq = buildSDNCRequest(execution, "delete", sdncRequestId) execution.setVariable("sdncDeleteRequest", sdncDeleteReq) - msoLogger.debug("sdncDeleteReq: " + sdncDeleteReq) + logger.debug("sdncDeleteReq: " + sdncDeleteReq) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCDelete. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessSDNCDelete") + logger.trace("end preProcessSDNCDelete") } public void preProcessSDNCDeactivate(DelegateExecution execution) { String msg = "" - msoLogger.trace("start preProcessSDNCDeactivate") + logger.trace("start preProcessSDNCDeactivate") try { String sdncRequestId = UUID.randomUUID().toString() String sdncDeactivateReq = buildSDNCRequest(execution, "deactivate", sdncRequestId) execution.setVariable("sdncDeactivateRequest", sdncDeactivateReq) - msoLogger.debug("sdncDeactivateReq: " + sdncDeactivateReq) + logger.debug("sdncDeactivateReq: " + sdncDeactivateReq) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCDeactivate. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessSDNCDeactivate") + logger.trace("end preProcessSDNCDeactivate") } public void validateSDNCResp(DelegateExecution execution, String response, String method){ - msoLogger.trace("start ValidateSDNCResponse Process") + logger.trace("start ValidateSDNCResponse Process") String msg = "" try { WorkflowException workflowException = execution.getVariable("WorkflowException") - msoLogger.debug("workflowException: " + workflowException) + logger.debug("workflowException: " + workflowException) boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - 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("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) - + logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + + response) }else{ String sdncRespCode = execution.getVariable(Prefix + 'sdncRequestDataResponseCode') - msoLogger.debug(method + " AllottedResource received error response from SDNC. ResponseCode:" + sdncRespCode) + logger.debug(method + " AllottedResource received error response from SDNC. ResponseCode:" + + sdncRespCode) if (sdncRespCode.equals("404") && "deactivate".equals(method)) { execution.setVariable("ARNotFoundInSDNC", true) if ("true".equals(execution.getVariable("failNotFound"))) { msg = "Allotted Resource Not found in SDNC" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } else @@ -330,14 +335,14 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ throw e; } catch(Exception ex) { msg = "Exception in validateSDNCResp. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end ValidateSDNCResp Process") + logger.trace("end ValidateSDNCResp Process") } public void deleteAaiAR(DelegateExecution execution){ - msoLogger.trace("start deleteAaiAR") + logger.trace("start deleteAaiAR") try{ AllottedResourceUtils arUtils = new AllottedResourceUtils(this) @@ -346,10 +351,12 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ } catch (BpmnError e) { throw e; }catch(Exception ex){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest." + ex, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:" + ex); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occurred Processing preProcessSDNCGetRequest." + ex, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:" + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) } - msoLogger.trace("end deleteAaiAR") + logger.trace("end deleteAaiAR") } public AllottedResourceUtils getAllottedResourceUtils(){ diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy index f305a7ad0d..9b9f9f0388 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.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,9 @@ import org.onap.so.bpmn.core.UrnPropertiesReader 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 + import static org.apache.commons.lang3.StringUtils.isBlank /** @@ -57,7 +62,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank * */ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteAllottedResourceTXC.class); + private static final Logger logger = LoggerFactory.getLogger(DoDeleteAllottedResourceTXC.class); String Prefix="DDARTXC_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -65,7 +70,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ public void preProcessRequest (DelegateExecution execution) { String msg = "" - msoLogger.trace("start preProcessRequest") + logger.trace("start preProcessRequest") try { execution.setVariable("prefix", Prefix) @@ -74,38 +79,38 @@ public class DoDeleteAllottedResourceTXC 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) //Request Inputs if (isBlank(execution.getVariable("serviceInstanceId"))){ msg = "Input serviceInstanceId is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("allottedResourceId"))){ msg = "Input allottedResourceId is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") + logger.debug("Rethrowing MSOWorkflowException") throw b } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessRequest") + logger.trace("end preProcessRequest") } public void getAaiAR (DelegateExecution execution) { - msoLogger.trace("start getAaiAR") + logger.trace("start getAaiAR") String allottedResourceId = execution.getVariable("allottedResourceId") @@ -122,10 +127,10 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ errorMsg = "Allotted resource not found in AAI with AllottedResourceId:" + allottedResourceId } if (!isBlank(errorMsg)) { - msoLogger.debug(errorMsg) + logger.debug(errorMsg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg) } - msoLogger.trace("end getAaiAR") + logger.trace("end getAaiAR") } @@ -135,17 +140,17 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ // aaiARPath set during query (existing AR) public void updateAaiAROrchStatus(DelegateExecution execution, String status){ - msoLogger.trace("start updateAaiAROrchStatus") + logger.trace("start updateAaiAROrchStatus") AllottedResourceUtils arUtils = new AllottedResourceUtils(this) String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) - msoLogger.trace("end updateAaiAROrchStatus") + logger.trace("end updateAaiAROrchStatus") } public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) { String msg = "" - msoLogger.trace("start buildSDNCRequest") + logger.trace("start buildSDNCRequest") String sdncReq = null try { @@ -217,106 +222,107 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ """ - msoLogger.debug("sdncRequest:\n" + sdncReq) + logger.debug("sdncRequest:\n" + sdncReq) sdncReq = utils.formatXml(sdncReq) } catch(Exception ex) { msg = "Exception in buildSDNCRequest. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end buildSDNCRequest") + logger.trace("end buildSDNCRequest") return sdncReq } public void preProcessSDNCUnassign(DelegateExecution execution) { String msg = "" - msoLogger.trace("start preProcessSDNCUnassign") + logger.trace("start preProcessSDNCUnassign") try { String sdncRequestId = UUID.randomUUID().toString() String sdncUnassignReq = buildSDNCRequest(execution, "unassign", sdncRequestId) execution.setVariable("sdncUnassignRequest", sdncUnassignReq) - msoLogger.debug("sdncUnassignRequest: " + sdncUnassignReq) + logger.debug("sdncUnassignRequest: " + sdncUnassignReq) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCUnassign. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessSDNCUnassign") + logger.trace("end preProcessSDNCUnassign") } public void preProcessSDNCDelete(DelegateExecution execution) { String msg = "" - msoLogger.trace("start preProcessSDNCDelete") + logger.trace("start preProcessSDNCDelete") try { String sdncRequestId = UUID.randomUUID().toString() String sdncDeleteReq = buildSDNCRequest(execution, "delete", sdncRequestId) execution.setVariable("sdncDeleteRequest", sdncDeleteReq) - msoLogger.debug("sdncDeleteReq: " + sdncDeleteReq) + logger.debug("sdncDeleteReq: " + sdncDeleteReq) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCDelete. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessSDNCDelete") + logger.trace("end preProcessSDNCDelete") } public void preProcessSDNCDeactivate(DelegateExecution execution) { String msg = "" - msoLogger.trace("start preProcessSDNCDeactivate") + logger.trace("start preProcessSDNCDeactivate") try { String sdncRequestId = UUID.randomUUID().toString() String sdncDeactivateReq = buildSDNCRequest(execution, "deactivate", sdncRequestId) execution.setVariable("sdncDeactivateRequest", sdncDeactivateReq) - msoLogger.debug("sdncDeactivateReq: " + sdncDeactivateReq) + logger.debug("sdncDeactivateReq: " + sdncDeactivateReq) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCDeactivate. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessSDNCDeactivate") + logger.trace("end preProcessSDNCDeactivate") } public void validateSDNCResp(DelegateExecution execution, String response, String method){ - msoLogger.trace("start ValidateSDNCResponse Process") + logger.trace("start ValidateSDNCResponse Process") String msg = "" try { WorkflowException workflowException = execution.getVariable("WorkflowException") - msoLogger.debug("workflowException: " + workflowException) + logger.debug("workflowException: " + workflowException) boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - 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("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) - + logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + + response) }else{ String sdncRespCode = execution.getVariable(Prefix + 'sdncRequestDataResponseCode') - msoLogger.debug(method + " AllottedResource received error response from SDNC. ResponseCode:" + sdncRespCode) + logger.debug(method + " AllottedResource received error response from SDNC. ResponseCode:" + + sdncRespCode) if (sdncRespCode.equals("404") && "deactivate".equals(method)) { execution.setVariable("ARNotFoundInSDNC", true) if ("true".equals(execution.getVariable("failNotFound"))) { msg = "Allotted Resource Not found in SDNC" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } else @@ -333,14 +339,14 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ throw e; } catch(Exception ex) { msg = "Exception in validateSDNCResp. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end Exit ValidateSDNCResp Process") + logger.trace("end Exit ValidateSDNCResp Process") } public void deleteAaiAR(DelegateExecution execution){ - msoLogger.trace("start deleteAaiAR") + logger.trace("start deleteAaiAR") try{ AllottedResourceUtils arUtils = new AllottedResourceUtils(this) @@ -349,11 +355,12 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ } catch (BpmnError e) { throw e; }catch(Exception ex){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) } - msoLogger.trace("end deleteAaiAR") + logger.trace("end deleteAaiAR") } } -- cgit 1.2.3-korg