diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN')
13 files changed, 111 insertions, 120 deletions
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 = """ <volume-request xmlns="http://www.w3.org/2001/XMLSchema"> <request-info> @@ -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 = """ - <network-request xmlns="http://www.w3.org/2001/XMLSchema"> - <request-info> + <network-request xmlns="http://www.w3.org/2001/XMLSchema"> + <request-info> <request-id>${MsoUtils.xmlEscape(requestId)}</request-id> - <action>${MsoUtils.xmlEscape(requestAction)}</action> - <source>VID</source> + <action>${MsoUtils.xmlEscape(requestAction)}</action> + <source>VID</source> <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - </request-info> + </request-info> <network-inputs> - <network-id>${MsoUtils.xmlEscape(networkId)}</network-id> - <network-name>${MsoUtils.xmlEscape(instanceName)}</network-name> + <network-id>${MsoUtils.xmlEscape(networkId)}</network-id> + <network-name>${MsoUtils.xmlEscape(instanceName)}</network-name> <network-type>${MsoUtils.xmlEscape(modelName)}</network-type> - <modelCustomizationId>${MsoUtils.xmlEscape(modelCustomizationId)}</modelCustomizationId> - <aic-cloud-region>${MsoUtils.xmlEscape(lcpCloudRegionId)}</aic-cloud-region> + <modelCustomizationId>${MsoUtils.xmlEscape(modelCustomizationId)}</modelCustomizationId> + <aic-cloud-region>${MsoUtils.xmlEscape(lcpCloudRegionId)}</aic-cloud-region> <tenant-id>${MsoUtils.xmlEscape(tenantId)}</tenant-id> - <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id> + <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id> <backout-on-failure>${MsoUtils.xmlEscape(backoutOnFailure)}</backout-on-failure> <sdncVersion>${MsoUtils.xmlEscape(sdncVersion)}</sdncVersion> </network-inputs> @@ -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 = """ - <network-request xmlns="http://www.w3.org/2001/XMLSchema"> - <request-info> + <network-request xmlns="http://www.w3.org/2001/XMLSchema"> + <request-info> <request-id>${MsoUtils.xmlEscape(requestId)}</request-id> - <action>${MsoUtils.xmlEscape(action)}</action> - <source>${MsoUtils.xmlEscape(source)}</source> + <action>${MsoUtils.xmlEscape(action)}</action> + <source>${MsoUtils.xmlEscape(source)}</source> <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> - </request-info> - <network-inputs> - <network-id>${MsoUtils.xmlEscape(networkId)}</network-id> - <network-name>${MsoUtils.xmlEscape(networkName)}</network-name> + </request-info> + <network-inputs> + <network-id>${MsoUtils.xmlEscape(networkId)}</network-id> + <network-name>${MsoUtils.xmlEscape(networkName)}</network-name> <network-type>${MsoUtils.xmlEscape(networkModelName)}</network-type> <subscription-service-type>${MsoUtils.xmlEscape(subscriptionServiceType)}</subscription-service-type> <global-customer-id>${MsoUtils.xmlEscape(globalSubscriberId)}</global-customer-id> - <aic-cloud-region>${MsoUtils.xmlEscape(aicCloudReqion)}</aic-cloud-region> + <aic-cloud-region>${MsoUtils.xmlEscape(aicCloudReqion)}</aic-cloud-region> <tenant-id>${MsoUtils.xmlEscape(tenantId)}</tenant-id> - <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id> + <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id> <backout-on-failure>${MsoUtils.xmlEscape(backoutOnFailure)}</backout-on-failure> <failIfExist>${MsoUtils.xmlEscape(failIfExist)}</failIfExist> <networkModelInfo> <modelName>${MsoUtils.xmlEscape(networkModelName)}</modelName> <modelUuid>${MsoUtils.xmlEscape(networkModelUuid)}</modelUuid> - <modelInvariantUuid>${MsoUtils.xmlEscape(networkModelInvariantUuid)}</modelInvariantUuid> + <modelInvariantUuid>${MsoUtils.xmlEscape(networkModelInvariantUuid)}</modelInvariantUuid> <modelVersion>${MsoUtils.xmlEscape(networkModelVersion)}</modelVersion> <modelCustomizationUuid>${MsoUtils.xmlEscape(networkModelCustomizationUuid)}</modelCustomizationUuid> </networkModelInfo> <serviceModelInfo> <modelName>${MsoUtils.xmlEscape(serviceModelName)}</modelName> <modelUuid>${MsoUtils.xmlEscape(serviceModelUuid)}</modelUuid> - <modelInvariantUuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</modelInvariantUuid> + <modelInvariantUuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</modelInvariantUuid> <modelVersion>${MsoUtils.xmlEscape(serviceModelVersion)}</modelVersion> <modelCustomizationUuid>${MsoUtils.xmlEscape(serviceModelCustomizationUuid)}</modelCustomizationUuid> - - </serviceModelInfo> - <sdncVersion>${MsoUtils.xmlEscape(sdncVersion)}</sdncVersion> + + </serviceModelInfo> + <sdncVersion>${MsoUtils.xmlEscape(sdncVersion)}</sdncVersion> </network-inputs> <network-params> ${userParamsNode} - </network-params> + </network-params> </network-request> """ // 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 = """ <vnf-request> <request-info> @@ -524,17 +523,17 @@ class VidUtils { </request-info> <vnf-inputs> <!-- not in use in 1610 --> - <vnf-name>${MsoUtils.xmlEscape(vnfName)}</vnf-name> + <vnf-name>${MsoUtils.xmlEscape(vnfName)}</vnf-name> <vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type> <vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id> <volume-group-id>${MsoUtils.xmlEscape(volumeGroupId)}</volume-group-id> <vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id> - <vf-module-name>${MsoUtils.xmlEscape(vfModuleName)}</vf-module-name> + <vf-module-name>${MsoUtils.xmlEscape(vfModuleName)}</vf-module-name> <vf-module-model-name>${MsoUtils.xmlEscape(vfModuleModelName)}</vf-module-model-name> <model-customization-id>${MsoUtils.xmlEscape(modelCustomizationId)}</model-customization-id> <is-base-vf-module>${MsoUtils.xmlEscape(isBaseVfModule)}</is-base-vf-module> <asdc-service-model-version>${MsoUtils.xmlEscape(asdcServiceModelInfo)}</asdc-service-model-version> - <aic-cloud-region>${MsoUtils.xmlEscape(aicCloudRegion)}</aic-cloud-region> + <aic-cloud-region>${MsoUtils.xmlEscape(aicCloudRegion)}</aic-cloud-region> <tenant-id>${MsoUtils.xmlEscape(tenantId)}</tenant-id> <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id> <backout-on-failure>${MsoUtils.xmlEscape(backoutOnFailure)}</backout-on-failure> @@ -546,10 +545,10 @@ class VidUtils { </vnf-params> </vnf-request> """ - + // 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<S extends FlowValidator, E extends Flo result.add(klass.newInstance()); } } catch (InstantiationException | IllegalAccessException e) { - logger.error("failed to build validator list for " + clazz.getName(), e); + logger.error("failed to build validator list for {}", clazz.getName(), e); throw new RuntimeException(e); } |