From 59700d14ff998413dada0cb2e0864e643edbb77e Mon Sep 17 00:00:00 2001 From: Witold Ficio Kopel Date: Tue, 26 Mar 2019 09:17:02 +0100 Subject: Eliminated printStackTrace() calls Eliminated calls to printStackTrace() on Throwable as they go to stdout and are not handled by logger. Occurences has been replaced by calls to logger or modifications to nearby logger calls (Throwable passed as last parameter). Occurences in unit test classes left without modification. Change-Id: I6a771d60a3ea69ceecc29bb21358e565aa5ce101 Issue-ID: LOG-631 Signed-off-by: Witold Ficio Kopel --- .../scripts/AbstractServiceTaskProcessor.groovy | 7 +- .../bpmn/common/scripts/CreateAAIVfModule.groovy | 17 +-- .../scripts/CreateAAIVfModuleVolumeGroup.groovy | 6 +- .../bpmn/common/scripts/DeleteAAIVfModule.groovy | 8 +- .../common/scripts/GenerateVfModuleName.groovy | 3 +- .../onap/so/bpmn/common/scripts/MsoUtils.groovy | 4 +- .../onap/so/bpmn/common/scripts/SDNCAdapter.groovy | 2 +- .../bpmn/common/scripts/SDNCAdapterRestV1.groovy | 2 +- .../bpmn/common/scripts/SDNCAdapterRestV2.groovy | 2 +- .../bpmn/common/scripts/UpdateAAIGenericVnf.groovy | 11 +- .../onap/so/bpmn/common/scripts/VidUtils.groovy | 163 ++++++++++----------- .../so/bpmn/common/scripts/VnfAdapterRestV1.groovy | 4 +- .../common/validation/FlowValidatorRunner.java | 2 +- 13 files changed, 111 insertions(+), 120 deletions(-) (limited to 'bpmn/MSOCommonBPMN') diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy index 484be19137..1ceafb6684 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy @@ -148,7 +148,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess } catch (BpmnError e) { throw e } catch (Exception e) { - logger.error('Caught exception in ' + method, e) + logger.error('Caught exception in {}: {}', method, e.getMessage(), e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message") } } @@ -522,8 +522,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess throw bpmnError } catch(Exception e) { - e.printStackTrace() - logger.debug('Unexpected error encountered - ' + e.getMessage()) + logger.debug('Unexpected error encountered - {}', e.getMessage(), e) (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) } finally { @@ -645,7 +644,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess rollbackEnabled = defaultRollback } } - + execution.setVariable(prefix+"backoutOnFailure", rollbackEnabled) logger.debug('rollbackEnabled (aka backoutOnFailure): ' + rollbackEnabled) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy index c1f9f5b0b3..e9e7d1ed7c 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy @@ -63,8 +63,8 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ execution.setVariable("CAAIVfMod_moduleExists",false) execution.setVariable("CAAIVfMod_baseModuleConflict", false) execution.setVariable("CAAIVfMod_vnfNameFromAAI", null) - - + + // CreateAAIVfModule workflow response variable placeholders execution.setVariable("CAAIVfMod_queryGenericVnfResponseCode",null) execution.setVariable("CAAIVfMod_queryGenericVnfResponse","") @@ -80,14 +80,14 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ execution.setVariable("CreateAAIVfModuleResponse","") execution.setVariable("RollbackData", null) - } - + } + // parse the incoming CREATE_VF_MODULE request and store the Generic VNF // and VF Module data in the flow DelegateExecution public void preProcessRequest(DelegateExecution execution) { initProcessVariables(execution) - def vnfId = execution.getVariable("vnfId") + def vnfId = execution.getVariable("vnfId") if (vnfId == null || vnfId.isEmpty()) { execution.setVariable("CAAIVfMod_newGenericVnf", true) execution.setVariable("CAAIVfMod_vnfId","") @@ -96,14 +96,14 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ execution.setVariable("CAAIVfMod_vnfId",vnfId) } - def vnfName = execution.getVariable("vnfName") + def vnfName = execution.getVariable("vnfName") execution.setVariable("CAAIVfMod_vnfName", vnfName) String vnfType = execution.getVariable("vnfType") execution.setVariable("CAAIVfMod_vnfType", StringUtils.defaultString(vnfType)) execution.setVariable("CAAIVfMod_serviceId", execution.getVariable("serviceId")) - + String personaModelId = execution.getVariable("personaModelId") execution.setVariable("CAAIVfMod_personaId",StringUtils.defaultString(personaModelId)) @@ -219,8 +219,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ execution.setVariable("CAAIVfMod_createGenericVnfResponseCode", 201) execution.setVariable("CAAIVfMod_createGenericVnfResponse", "Vnf Created") } catch (Exception ex) { - ex.printStackTrace() - logger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage()) + logger.debug("Exception occurred while executing AAI PUT: {}", ex.getMessage(), ex) exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in createGenericVnf.") } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy index dc4871119e..7e46784af2 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy @@ -121,8 +121,7 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor { execution.setVariable('CAAIVfModVG_getVfModuleResponse', "VF-Module Not found!!") } }catch (Exception ex) { - ex.printStackTrace() - logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex) execution.setVariable('CAAIVfModVG_getVfModuleResponseCode', 500) execution.setVariable('CAAIVfModVG_getVfModuleResponse', 'AAI GET Failed:' + ex.getMessage()) } @@ -174,8 +173,7 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor { logger.debug("CreateAAIVfModule Response code: " + 200) logger.debug("CreateAAIVfModule Response: " + "Success") } catch (Exception ex) { - ex.printStackTrace() - logger.debug('Exception occurred while executing AAI PUT:' + ex.getMessage()) + logger.debug('Exception occurred while executing AAI PUT: {}', ex.getMessage(), ex) execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', 500) execution.setVariable('CAAIVfModVG_updateVfModuleResponse', 'AAI PUT Failed:' + ex.getMessage()) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy index 83f31450b8..4bce23eff7 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy @@ -76,7 +76,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ // send a GET request to AA&I to retrieve the Generic Vnf/Vf Module information based on a Vnf Id // expect a 200 response with the information in the response body or a 404 if the Generic Vnf does not exist public void queryAAIForGenericVnf(DelegateExecution execution) { - + def vnfId = execution.getVariable("DAAIVfMod_vnfId") try { @@ -112,8 +112,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ execution.setVariable("DAAIVfMod_deleteGenericVnfResponseCode", 200) execution.setVariable("DAAIVfMod_deleteGenericVnfResponse", "Vnf Deleted") } catch (Exception ex) { - ex.printStackTrace() - logger.debug("Exception occurred while executing AAI DELETE:" + ex.getMessage()) + logger.debug("Exception occurred while executing AAI DELETE: {}", ex.getMessage(), ex) exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during deleteGenericVnf") } } @@ -131,8 +130,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ execution.setVariable("DAAIVfMod_deleteVfModuleResponseCode", 200) execution.setVariable("DAAIVfMod_deleteVfModuleResponse", "Vf Module Deleted") } catch (Exception ex) { - ex.printStackTrace() - logger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage()) + logger.debug("Exception occurred while executing AAI PUT: {}", ex.getMessage(), ex) exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during deleteVfModule") } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy index 740d9f70b6..f008130c32 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy @@ -151,8 +151,7 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{ } } } catch (Exception ex) { - ex.printStackTrace() - logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) + logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) } logger.trace('Exited ' + method) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy index 92c1579aa0..f371ccef4d 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy @@ -126,7 +126,7 @@ class MsoUtils { /***** Utilities when using XmlParser *****/ - + /** * Convert a Node into a String by deserializing it and formatting it. * @@ -883,7 +883,7 @@ class MsoUtils { callbackUrlToUse = callbackUrlToUse.replaceAll("(http://)(.*)(:28080*)", {orig, first, torepl, last -> "${first}${qualifiedHostName}${last}"}) } }catch(Exception e){ - log("DEBUG", "unable to grab qualified host name, using what's in urn properties for callbackurl. Exception was: " + e.printStackTrace()) + logger.debug("Unable to grab qualified host name, using what's in urn properties for callbackurl. Exception was: {}", e.getMessage(), e) } return callbackUrlToUse diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy index d909a77cc2..a7bb707dff 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy @@ -166,7 +166,7 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor { logger.debug(UrnPropertiesReader.getVariable("mso.adapters.sdnc.endpoint", execution)) }catch(Exception e){ - logger.debug('Internal Error occured during PreProcess Method: ', e) + logger.debug('Internal Error occured during PreProcess Method: {}', e.getMessage(), e) exceptionUtil.buildAndThrowWorkflowException(execution, 9999, 'Internal Error occured during PreProcess Method') // TODO: what message and error code? } logger.trace("End pre Process SDNCRequestScript ") diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy index 9d7ce8234b..69d5f02df5 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy @@ -165,7 +165,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter") logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", - "BPMN", ErrorCode.UnknownError.getValue()); + "BPMN", ErrorCode.UnknownError.getValue(), ex); } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy index c1d68c5f7c..f91bf54edc 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy @@ -161,7 +161,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter") logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", - "BPMN", ErrorCode.UnknownError.getValue()); + "BPMN", ErrorCode.UnknownError.getValue(), ex); } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy index 796ee43cf4..a40bf59097 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy @@ -206,7 +206,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { // Construct payload managementV6AddressEntry = updateGenericVnfNode(origRequest, 'management-v6-address') } - + // Handle orchestration-status String orchestrationStatus = execution.getVariable('UAAIGenVnf_orchestrationStatus') String orchestrationStatusEntry = null @@ -214,7 +214,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { // Construct payload orchestrationStatusEntry = updateGenericVnfNode(origRequest, 'orchestration-status') } - + org.onap.aai.domain.yang.GenericVnf payload = new org.onap.aai.domain.yang.GenericVnf(); payload.setVnfId(vnfId) payload.setPersonaModelVersion(personaModelVersionEntry) @@ -227,8 +227,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { try { getAAIClient().update(uri,payload) } catch (Exception ex) { - ex.printStackTrace() - logger.debug('Exception occurred while executing AAI PATCH:' + ex.getMessage()) + logger.debug('Exception occurred while executing AAI PATCH: {}', ex.getMessage(), ex) execution.setVariable('UAAIGenVnf_updateGenericVnfResponseCode', 500) execution.setVariable('UAAIGenVnf_updateGenericVnfResponse', 'AAI PATCH Failed:' + ex.getMessage()) } @@ -258,9 +257,9 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { return "" } else { - return elementValue + return elementValue } - + } /** diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy index 259a7872a3..1960cafb0f 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy @@ -69,7 +69,7 @@ class VidUtils { public String createXmlVolumeRequest(Map requestMap, String action, String serviceInstanceId) { createXmlVolumeRequest(requestMap, action, serviceInstanceId, '') } - + /** * Create a volume-request XML using a map @@ -84,9 +84,9 @@ class VidUtils { def serviceName = '' def modelCustomizationName = '' def asdcServiceModelVersion = '' - + def suppressRollback = requestMap.requestDetails.requestInfo.suppressRollback - + def backoutOnFailure = "" if(suppressRollback != null){ if ( suppressRollback == true) { @@ -95,7 +95,7 @@ class VidUtils { backoutOnFailure = "true" } } - + def volGrpName = requestMap.requestDetails.requestInfo?.instanceName ?: '' def serviceId = requestMap.requestDetails.requestParameters?.serviceId ?: '' def relatedInstanceList = requestMap.requestDetails.relatedInstanceList @@ -108,16 +108,16 @@ class VidUtils { modelCustomizationName = it.relatedInstance.modelInfo?.modelInstanceName } } - + vnfType = serviceName + '/' + modelCustomizationName - + def userParams = requestMap.requestDetails?.requestParameters?.userParams def userParamsNode = '' if(userParams != null) { userParamsNode = buildUserParams(userParams) } def modelCustomizationId = requestMap.requestDetails?.modelInfo?.modelCustomizationUuid ?: '' - + String xmlReq = """ @@ -145,9 +145,9 @@ class VidUtils { // return a pretty-print of the volume-request xml without the preamble return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "") } - + /** - * A common method that can be used to build volume-params node from a map. + * A common method that can be used to build volume-params node from a map. * @param Map userParams * @return */ @@ -166,9 +166,9 @@ class VidUtils { } /** - * A common method that can be used to extract 'requestDetails' + * A common method that can be used to extract 'requestDetails' * @param String json - * @return String json requestDetails + * @return String json requestDetails */ @Deprecated public getJsonRequestDetails(String jsonInput) { @@ -183,10 +183,10 @@ class VidUtils { return rtn } else { return rtn - } + } } } - + /** * A common method that can be used to extract 'requestDetails' in Xml * @param String json @@ -203,17 +203,17 @@ class VidUtils { return XmlTool.normalize(XML.toString(jsonObj)) } } - + /** * Create a network-request XML using a map - * @param execution - * @param xmlRequestDetails - requestDetails in xml + * @param execution + * @param xmlRequestDetails - requestDetails in xml * @return * Note: See latest version: createXmlNetworkRequestInstance() */ public String createXmlNetworkRequestInfra(execution, def networkJsonIncoming) { - + def requestId = execution.getVariable("requestId") def serviceInstanceId = execution.getVariable("serviceInstanceId") def requestAction = execution.getVariable("requestAction") @@ -225,13 +225,13 @@ class VidUtils { def instanceName = reqMap.requestDetails.requestInfo.instanceName def modelCustomizationId = reqMap.requestDetails.modelInfo.modelCustomizationId if (modelCustomizationId == null) { - modelCustomizationId = reqMap.requestDetails.modelInfo.modelCustomizationUuid !=null ? + modelCustomizationId = reqMap.requestDetails.modelInfo.modelCustomizationUuid !=null ? reqMap.requestDetails.modelInfo.modelCustomizationUuid : "" } def modelName = reqMap.requestDetails.modelInfo.modelName def lcpCloudRegionId = reqMap.requestDetails.cloudConfiguration.lcpCloudRegionId def tenantId = reqMap.requestDetails.cloudConfiguration.tenantId - def serviceId = reqMap.requestDetails.requestInfo.productFamilyId + def serviceId = reqMap.requestDetails.requestInfo.productFamilyId def suppressRollback = reqMap.requestDetails.requestInfo.suppressRollback.toString() def backoutOnFailure = "true" if(suppressRollback != null){ @@ -241,7 +241,7 @@ class VidUtils { backoutOnFailure = "true" } } - + //def userParams = reqMap.requestDetails.requestParameters.userParams //def userParamsNode = buildUserParams(userParams) def userParams = reqMap.requestDetails?.requestParameters?.userParams @@ -249,26 +249,26 @@ class VidUtils { if(userParams != null) { userParamsNode = buildUserParams(userParams) } - + //'sdncVersion' = current, '1610' (non-RPC SDNC) or '1702' (RPC SDNC) def sdncVersion = execution.getVariable("sdncVersion") - + String xmlReq = """ - - + + ${MsoUtils.xmlEscape(requestId)} - ${MsoUtils.xmlEscape(requestAction)} - VID + ${MsoUtils.xmlEscape(requestAction)} + VID ${MsoUtils.xmlEscape(serviceInstanceId)} - + - ${MsoUtils.xmlEscape(networkId)} - ${MsoUtils.xmlEscape(instanceName)} + ${MsoUtils.xmlEscape(networkId)} + ${MsoUtils.xmlEscape(instanceName)} ${MsoUtils.xmlEscape(modelName)} - ${MsoUtils.xmlEscape(modelCustomizationId)} - ${MsoUtils.xmlEscape(lcpCloudRegionId)} + ${MsoUtils.xmlEscape(modelCustomizationId)} + ${MsoUtils.xmlEscape(lcpCloudRegionId)} ${MsoUtils.xmlEscape(tenantId)} - ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(serviceId)} ${MsoUtils.xmlEscape(backoutOnFailure)} ${MsoUtils.xmlEscape(sdncVersion)} @@ -281,8 +281,7 @@ class VidUtils { return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "") } catch(Exception e) { - logger.debug("{} {}", "Error in Vid Utils", e.getCause()) - e.printStackTrace(); + logger.debug("Error in Vid Utils: {}", e.getCause(), e) throw e } } @@ -299,7 +298,7 @@ class VidUtils { def networkModelVersion = "" def networkModelCustomizationUuid = "" def networkModelInvariantUuid = "" - + // verify the DB Catalog response JSON structure def networkModelInfo = execution.getVariable("networkModelInfo") def jsonSlurper = new JsonSlurper() @@ -326,14 +325,14 @@ class VidUtils { } catch (Exception ex) { throw ex } - } - + } + def serviceModelUuid = "" def serviceModelName = "" def serviceModelVersion = "" def serviceModelCustomizationUuid = "" def serviceModelInvariantUuid = "" - + // verify the DB Catalog response JSON structure def serviceModelInfo = execution.getVariable("serviceModelInfo") def jsonServiceSlurper = new JsonSlurper() @@ -361,8 +360,8 @@ class VidUtils { throw ex } } - - + + def subscriptionServiceType = execution.getVariable("subscriptionServiceType") != null ? execution.getVariable("subscriptionServiceType") : "" def globalSubscriberId = execution.getVariable("globalSubscriberId") != null ? execution.getVariable("globalSubscriberId") : "" def requestId = execution.getVariable("msoRequestId") @@ -382,88 +381,88 @@ class VidUtils { backoutOnFailure = "true" } } - + //'sdncVersion' = current, '1610' (non-RPC SDNC) or '1702' (RPC SDNC) def sdncVersion = execution.getVariable("sdncVersion") - + def source = "VID" def action = execution.getVariable("action") - + def userParamsNode = "" def userParams = execution.getVariable("networkInputParams") if(userParams != null) { userParamsNode = buildUserParams(userParams) } - + String xmlReq = """ - - + + ${MsoUtils.xmlEscape(requestId)} - ${MsoUtils.xmlEscape(action)} - ${MsoUtils.xmlEscape(source)} + ${MsoUtils.xmlEscape(action)} + ${MsoUtils.xmlEscape(source)} ${MsoUtils.xmlEscape(serviceInstanceId)} - - - ${MsoUtils.xmlEscape(networkId)} - ${MsoUtils.xmlEscape(networkName)} + + + ${MsoUtils.xmlEscape(networkId)} + ${MsoUtils.xmlEscape(networkName)} ${MsoUtils.xmlEscape(networkModelName)} ${MsoUtils.xmlEscape(subscriptionServiceType)} ${MsoUtils.xmlEscape(globalSubscriberId)} - ${MsoUtils.xmlEscape(aicCloudReqion)} + ${MsoUtils.xmlEscape(aicCloudReqion)} ${MsoUtils.xmlEscape(tenantId)} - ${MsoUtils.xmlEscape(serviceId)} + ${MsoUtils.xmlEscape(serviceId)} ${MsoUtils.xmlEscape(backoutOnFailure)} ${MsoUtils.xmlEscape(failIfExist)} ${MsoUtils.xmlEscape(networkModelName)} ${MsoUtils.xmlEscape(networkModelUuid)} - ${MsoUtils.xmlEscape(networkModelInvariantUuid)} + ${MsoUtils.xmlEscape(networkModelInvariantUuid)} ${MsoUtils.xmlEscape(networkModelVersion)} ${MsoUtils.xmlEscape(networkModelCustomizationUuid)} ${MsoUtils.xmlEscape(serviceModelName)} ${MsoUtils.xmlEscape(serviceModelUuid)} - ${MsoUtils.xmlEscape(serviceModelInvariantUuid)} + ${MsoUtils.xmlEscape(serviceModelInvariantUuid)} ${MsoUtils.xmlEscape(serviceModelVersion)} ${MsoUtils.xmlEscape(serviceModelCustomizationUuid)} - - - ${MsoUtils.xmlEscape(sdncVersion)} + + + ${MsoUtils.xmlEscape(sdncVersion)} ${userParamsNode} - + """ // return a pretty-print of the volume-request xml without the preamble return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "") - + } - + /** * Create a vnf-request XML using a map - * @param requestMap - map created from VID JSON + * @param requestMap - map created from VID JSON * @param action * @return */ public String createXmlVfModuleRequest(execution, Map requestMap, String action, String serviceInstanceId) { - + //def relatedInstanceList = requestMap.requestDetails.relatedInstanceList - + //relatedInstanceList.each { // if (it.relatedInstance.modelInfo.modelType == 'vnf') { // vnfType = it.relatedInstance.modelInfo.modelName // vnfId = it.relatedInstance.modelInfo.modelInvariantId // } //} - + def vnfName = '' def asdcServiceModelInfo = '' - + def relatedInstanceList = requestMap.requestDetails?.relatedInstanceList - - + + if (relatedInstanceList != null) { relatedInstanceList.each { if (it.relatedInstance.modelInfo?.modelType == 'service') { @@ -474,30 +473,30 @@ class VidUtils { } } } - + def vnfType = execution.getVariable('vnfType') def vnfId = execution.getVariable('vnfId') def vfModuleId = execution.getVariable('vfModuleId') def volumeGroupId = execution.getVariable('volumeGroupId') def userParams = requestMap.requestDetails?.requestParameters?.userParams - - + + def userParamsNode = '' if(userParams != null) { userParamsNode = buildUserParams(userParams) } - + def isBaseVfModule = "false" if (execution.getVariable('isBaseVfModule') == true) { isBaseVfModule = "true" } - + def requestId = execution.getVariable("mso-request-id") def vfModuleName = requestMap.requestDetails?.requestInfo?.instanceName ?: '' def vfModuleModelName = requestMap.requestDetails?.modelInfo?.modelName ?: '' def suppressRollback = requestMap.requestDetails?.requestInfo?.suppressRollback - + def backoutOnFailure = "" if(suppressRollback != null){ if ( suppressRollback == true) { @@ -506,14 +505,14 @@ class VidUtils { backoutOnFailure = "true" } } - + def serviceId = requestMap.requestDetails?.requestParameters?.serviceId ?: '' def aicCloudRegion = requestMap.requestDetails?.cloudConfiguration?.lcpCloudRegionId ?: '' def tenantId = requestMap.requestDetails?.cloudConfiguration?.tenantId ?: '' def personaModelId = requestMap.requestDetails?.modelInfo?.modelInvariantUuid ?: '' def personaModelVersion = requestMap.requestDetails?.modelInfo?.modelUuid ?: '' def modelCustomizationId = requestMap.requestDetails?.modelInfo?.modelCustomizationUuid ?: '' - + String xmlReq = """ @@ -524,17 +523,17 @@ class VidUtils { - ${MsoUtils.xmlEscape(vnfName)} + ${MsoUtils.xmlEscape(vnfName)} ${MsoUtils.xmlEscape(vnfType)} ${MsoUtils.xmlEscape(vnfId)} ${MsoUtils.xmlEscape(volumeGroupId)} ${MsoUtils.xmlEscape(vfModuleId)} - ${MsoUtils.xmlEscape(vfModuleName)} + ${MsoUtils.xmlEscape(vfModuleName)} ${MsoUtils.xmlEscape(vfModuleModelName)} ${MsoUtils.xmlEscape(modelCustomizationId)} ${MsoUtils.xmlEscape(isBaseVfModule)} ${MsoUtils.xmlEscape(asdcServiceModelInfo)} - ${MsoUtils.xmlEscape(aicCloudRegion)} + ${MsoUtils.xmlEscape(aicCloudRegion)} ${MsoUtils.xmlEscape(tenantId)} ${MsoUtils.xmlEscape(serviceId)} ${MsoUtils.xmlEscape(backoutOnFailure)} @@ -546,10 +545,10 @@ class VidUtils { """ - + // return a pretty-print of the volume-request xml without the preamble return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "") } - + } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy index ac67d949a5..aacd385a3b 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy @@ -294,7 +294,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { } catch (IOException ex) { logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter", - "BPMN", ErrorCode.UnknownError.getValue()); + "BPMN", ErrorCode.UnknownError.getValue(), ex); } } @@ -398,7 +398,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { vnfAdapterWorkflowException(execution, callback) } } catch (Exception e) { - logger.debug("Error encountered within VnfAdapterRest ProcessCallback method", e) + logger.debug("Error encountered within VnfAdapterRest ProcessCallback method: {}", e.getMessage(), e) exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method") } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java index 5352fc2fe0..2cc6415a50 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java @@ -146,7 +146,7 @@ public abstract class FlowValidatorRunner