2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.bpmn.infrastructure.scripts;
23 import org.apache.commons.lang3.*
24 import org.camunda.bpm.engine.delegate.BpmnError
25 import org.camunda.bpm.engine.delegate.DelegateExecution
26 import org.onap.aai.domain.yang.v12.GenericVnf;
27 import org.onap.appc.client.lcm.model.Action
28 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor;
29 import org.onap.so.bpmn.common.scripts.ExceptionUtil;
30 import org.onap.so.bpmn.common.scripts.MsoUtils
31 import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils;
32 import org.onap.so.bpmn.core.RollbackData
33 import org.onap.so.bpmn.core.UrnPropertiesReader
34 import org.onap.so.bpmn.core.WorkflowException
35 import org.onap.so.bpmn.core.json.JsonUtils
36 import org.onap.so.bpmn.infrastructure.aai.AAICreateResources;
37 import org.onap.so.logger.MessageEnum
38 import org.onap.so.logger.MsoLogger
40 import javax.xml.parsers.*
41 import org.xml.sax.InputSource
42 import groovy.json.JsonOutput
43 import groovy.json.JsonSlurper
45 public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
46 private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateVfModuleInfra.class);
48 ExceptionUtil exceptionUtil = new ExceptionUtil()
49 JsonUtils jsonUtil = new JsonUtils()
51 private AbstractServiceTaskProcessor taskProcessor
53 public SDNCAdapterUtils(AbstractServiceTaskProcessor taskProcessor) {
54 this.taskProcessor = taskProcessor
58 * Validates the request message and sets up the workflow.
59 * @param execution the execution
61 public void preProcessRequest(DelegateExecution execution) {
62 def method = getClass().getSimpleName() + '.preProcessRequest(' +
63 'execution=' + execution.getId() +
66 msoLogger.debug('Started ' + method)
67 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
69 execution.setVariable("CVFMI_sentSyncResponse", false)
72 execution.setVariable('prefix', prefix)
73 execution.setVariable("isVidRequest", "false")
75 def rollbackData = execution.getVariable("RollbackData")
76 if (rollbackData == null) {
77 rollbackData = new RollbackData()
79 execution.setVariable("RollbackData", rollbackData)
81 def incomingRequest = execution.getVariable('bpmnRequest')
82 msoLogger.debug("Incoming Infra Request: " + incomingRequest)
83 msoLogger.debug("CreateVfModule Infra incoming Request: " + incomingRequest)
85 setBasicDBAuthHeader(execution, isDebugLogEnabled)
87 // check if request is xml or json
89 def jsonSlurper = new JsonSlurper()
90 def jsonOutput = new JsonOutput()
91 Map reqMap = jsonSlurper.parseText(incomingRequest)
92 msoLogger.debug(" Request is in JSON format.")
94 def serviceInstanceId = execution.getVariable('serviceInstanceId')
95 def vnfId = execution.getVariable('vnfId')
97 execution.setVariable(prefix + 'serviceInstanceId', serviceInstanceId)
98 execution.setVariable(prefix+'vnfId', vnfId)
99 execution.setVariable("isVidRequest", "true")
102 def asdcServiceModelVersion = ''
103 def serviceModelInfo = null
104 def vnfModelInfo = null
106 def relatedInstanceList = reqMap.requestDetails?.relatedInstanceList
108 if (relatedInstanceList != null) {
109 relatedInstanceList.each {
110 if (it.relatedInstance.modelInfo?.modelType == 'service') {
111 asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion
112 serviceModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo)
115 if (it.relatedInstance.modelInfo.modelType == 'vnf') {
116 vnfName = it.relatedInstance.instanceName ?: ''
117 vnfModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo)
122 execution.setVariable(prefix + 'vnfName', vnfName)
123 execution.setVariable(prefix + 'asdcServiceModelVersion', asdcServiceModelVersion)
124 execution.setVariable(prefix + 'serviceModelInfo', serviceModelInfo)
125 execution.setVariable(prefix + 'vnfModelInfo', vnfModelInfo)
128 def vnfType = execution.getVariable('vnfType')
129 execution.setVariable(prefix + 'vnfType', vnfType)
130 def vfModuleId = execution.getVariable('vfModuleId')
131 execution.setVariable(prefix + 'vfModuleId', vfModuleId)
132 def volumeGroupId = execution.getVariable('volumeGroupId')
133 execution.setVariable(prefix + 'volumeGroupId', volumeGroupId)
134 def userParams = reqMap.requestDetails?.requestParameters?.userParams
136 Map<String, String> userParamsMap = [:]
137 if (userParams != null) {
138 userParams.each { userParam ->
139 userParamsMap.put(userParam.name, userParam.value.toString())
143 msoLogger.debug('Processed user params: ' + userParamsMap)
145 execution.setVariable(prefix + 'vfModuleInputParams', userParamsMap)
147 def isBaseVfModule = "false"
148 if (execution.getVariable('isBaseVfModule') == true) {
149 isBaseVfModule = "true"
152 execution.setVariable(prefix + 'isBaseVfModule', isBaseVfModule)
154 def requestId = execution.getVariable("mso-request-id")
155 execution.setVariable(prefix + 'requestId', requestId)
157 def vfModuleModelInfo = jsonOutput.toJson(reqMap.requestDetails?.modelInfo)
158 execution.setVariable(prefix + 'vfModuleModelInfo', vfModuleModelInfo)
160 def suppressRollback = reqMap.requestDetails?.requestInfo?.suppressRollback
163 def backoutOnFailure = ""
164 if(suppressRollback != null){
165 if ( suppressRollback == true) {
166 backoutOnFailure = "false"
167 } else if ( suppressRollback == false) {
168 backoutOnFailure = "true"
172 execution.setVariable('disableRollback', suppressRollback)
174 def vfModuleName = reqMap.requestDetails?.requestInfo?.instanceName ?: null
175 execution.setVariable(prefix + 'vfModuleName', vfModuleName)
177 def serviceId = reqMap.requestDetails?.requestParameters?.serviceId ?: ''
178 execution.setVariable(prefix + 'serviceId', serviceId)
180 def usePreload = reqMap.requestDetails?.requestParameters?.usePreload
181 execution.setVariable(prefix + 'usePreload', usePreload)
183 // This is aLaCarte flow, so aLaCarte flag is always on
184 execution.setVariable(prefix + 'aLaCarte', true)
186 def cloudConfiguration = reqMap.requestDetails?.cloudConfiguration
187 def lcpCloudRegionId = cloudConfiguration.lcpCloudRegionId
188 execution.setVariable(prefix + 'lcpCloudRegionId', lcpCloudRegionId)
190 def cloudOwner = cloudConfiguration.cloudOwner
191 execution.setVariable(prefix + 'cloudOwner', cloudOwner)
193 def tenantId = cloudConfiguration.tenantId
194 execution.setVariable(prefix + 'tenantId', tenantId)
196 def globalSubscriberId = reqMap.requestDetails?.subscriberInfo?.globalSubscriberId ?: ''
197 execution.setVariable(prefix + 'globalSubscriberId', globalSubscriberId)
199 execution.setVariable(prefix + 'sdncVersion', '1702')
201 execution.setVariable("CreateVfModuleInfraSuccessIndicator", false)
202 execution.setVariable("RollbackCompleted", false)
204 execution.setVariable("isDebugLogEnabled", isDebugLogEnabled)
207 def source = reqMap.requestDetails?.requestInfo?.source
208 execution.setVariable("CVFMI_source", source)
210 //For Completion Handler & Fallout Handler
212 """<request-info xmlns="http://org.onap/so/infra/vnf-request/v1">
213 <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
214 <action>CREATE</action>
215 <source>${MsoUtils.xmlEscape(source)}</source>
218 execution.setVariable("CVFMI_requestInfo", requestInfo)
222 execution.setVariable("CVFMI_originalWorkflowException", null)
225 def newVfModuleId = UUID.randomUUID().toString()
226 execution.setVariable("newVfModuleId", newVfModuleId)
227 execution.setVariable(prefix + 'vfModuleId', newVfModuleId)
228 execution.setVariable('actionHealthCheck', Action.HealthCheck)
229 execution.setVariable('actionConfigScaleOut', Action.ConfigScaleOut)
230 execution.setVariable('controllerType', "APPC")
231 def controllerType = execution.getVariable('controllerType')
232 execution.setVariable(prefix + 'controllerType', controllerType)
233 execution.setVariable('healthCheckIndex0', 0)
235 msoLogger.debug('RequestInfo: ' + execution.getVariable("CVFMI_requestInfo"))
237 msoLogger.debug('rollbackEnabled: ' + execution.getVariable("CVFMI_rollbackEnabled"))
239 msoLogger.trace('Finished ' + method)
240 } catch (BpmnError bpmnError) {
243 catch(groovy.json.JsonException je) {
244 msoLogger.debug("Request is not in JSON format.")
245 exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest")
248 String restFaultMessage = e.getMessage()
249 //execution.setVariable("CVFMODVOL2_RESTFault", restFaultMessage)
250 //execution.setVariable("CVFMODVOL2_isDataOk", false)
251 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(),
252 MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
253 exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest")
259 * Validates a workflow response.
260 * @param execution the execution
261 * @param responseVar the execution variable in which the response is stored
262 * @param responseCodeVar the execution variable in which the response code is stored
263 * @param errorResponseVar the execution variable in which the error response is stored
265 public void validateWorkflowResponse(DelegateExecution execution, String responseVar,
266 String responseCodeVar, String errorResponseVar) {
267 SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
268 sdncAdapterUtils.validateSDNCResponse(execution, responseVar, responseCodeVar, errorResponseVar)
273 * Sends the empty, synchronous response back to the API Handler.
274 * @param execution the execution
276 public void sendResponse(DelegateExecution execution) {
277 def method = getClass().getSimpleName() + '.sendResponse(' +
278 'execution=' + execution.getId() +
281 msoLogger.trace('Started ' + method)
284 def requestInfo = execution.getVariable('CVFMI_requestInfo')
285 def requestId = execution.getVariable('CVFMI_requestId')
286 def source = execution.getVariable('CVFMI_source')
288 // RESTResponse (for API Handler (APIH) Reply Task)
289 def newVfModuleId = execution.getVariable("newVfModuleId")
290 String synchResponse = """{"requestReferences":{"instanceId":"${newVfModuleId}","requestId":"${requestId}"}}""".trim()
292 sendWorkflowResponse(execution, 200, synchResponse)
294 execution.setVariable("CVFMI_sentSyncResponse", true)
295 msoLogger.debug("CreateVfModule Infra Response: " + synchResponse)
296 msoLogger.trace('Finished ' + method)
297 } catch (BpmnError e) {
299 } catch (Exception e) {
300 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered ", "BPMN", MsoLogger.getServiceName(),
301 MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
302 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
307 * Query AAI for vnf orchestration status to determine if health check and config scaling should be run
309 public void queryAAIForVnfOrchestrationStatus(DelegateExecution execution) {
310 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
311 def vnfId = execution.getVariable("CVFMI_vnfId")
312 execution.setVariable("runHealthCheck", false);
313 execution.setVariable("runConfigScaleOut", false);
314 AAICreateResources aaiCreateResources = new AAICreateResources();
315 Optional<GenericVnf> vnf = aaiCreateResources.getVnfInstance(vnfId);
317 def vnfOrchestrationStatus = vnf.get().getOrchestrationStatus();
318 if("active".equalsIgnoreCase(vnfOrchestrationStatus)){
319 execution.setVariable("runHealthCheck", false);
320 execution.setVariable("runConfigScaleOut", true);
326 * Retrieve data for ConfigScaleOut from SDNC topology
329 public void retreiveConfigScaleOutData(DelegateExecution execution){
330 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
331 def vfModuleId = execution.getVariable("CVFMI_vfModuleId")
332 String ipAddress = "";
333 String oamIpAddress = "";
334 String vnfHostIpAddress = "";
336 String vnfGetSDNC = execution.getVariable("DCVFM_getSDNCAdapterResponse");
338 String data = utils.getNodeXml(vnfGetSDNC, "response-data")
339 data = data.replaceAll("<", "<")
340 data = data.replaceAll(">", ">")
342 InputSource source = new InputSource(new StringReader(data));
343 DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
344 docFactory.setNamespaceAware(true)
345 DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
346 Document responseXml = docBuilder.parse(source)
348 NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters")
349 for (int z = 0; z < paramsList.getLength(); z++) {
350 Node node = paramsList.item(z)
351 Element eElement = (Element) node
352 String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name")
353 String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value")
354 if (vnfParameterName.equals("vlb_private_ip_1")) {
355 vnfHostIpAddress = vnfParameterValue
357 else if (vnfParameterName.equals("vdns_private_ip_0")) {
358 ipAddress = vnfParameterValue
360 else if (vnfParameterName.equals("vdns_private_ip_1")) {
361 oamIpAddress = vnfParameterValue
365 String payload = "{\"request-parameters\":{\"vnf-host-ip-address\":\"" + vnfHostIpAddress + "\",\"vf-module-id\":\"" + vfModuleId + "\"},\"configuration-parameters\":{\"ip-addr\":\"" + ipAddress +"\", \"oam-ip-addr\":\""+ oamIpAddress +"\",\"enabled\":\"true\"}}"
366 execution.setVariable("payload", payload);
371 * @param execution the execution
373 public void postProcessResponse(DelegateExecution execution){
374 msoLogger.trace("STARTED PostProcessResponse Process")
376 def requestInfo = execution.getVariable("CVFMI_requestInfo")
377 def action = utils.getNodeText(requestInfo, "action")
379 msoLogger.debug("requestInfo is: " + requestInfo)
380 msoLogger.debug("action is: " + action)
383 """ <aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
384 xmlns:ns="http://org.onap/so/request/types/v1"
385 xmlns:ns8="http://org.onap/so/workflow/schema/v1">
386 <request-info xmlns="http://org.onap/so/infra/vnf-request/v1">
389 <ns8:status-message>Vf Module has been created successfully.</ns8:status-message>
390 <ns8:mso-bpel-name>BPMN</ns8:mso-bpel-name>
391 </aetgt:MsoCompletionRequest>"""
393 payload = utils.formatXml(payload)
394 execution.setVariable("CVFMI_SuccessFlag", true)
395 execution.setVariable("CVFMI_msoCompletionRequest", payload)
396 msoLogger.debug("CreateVfModuleInfra completion request: " + payload)
397 msoLogger.debug("Outgoing MsoCompletionRequest: \n" + payload)
400 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Occured Processing PostProcessResponse - " + "\n", "BPMN", MsoLogger.getServiceName(),
401 MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
402 execution.setVariable("CVFMI_ErrorResponse", "Error Occured during PostProcessResponse Method:\n" + e.getMessage())
404 msoLogger.trace("COMPLETED PostProcessResponse Process")
412 * Validates the request, request id and service instance id. If a problem is found,
413 * a WorkflowException is generated and an MSOWorkflowException event is thrown. This
414 * method also sets up the log context for the workflow.
415 * @param execution the execution
416 * @return the validated request
418 public String validateInfraRequest(DelegateExecution execution) {
419 def method = getClass().getSimpleName() + '.validateInfraRequest(' +
420 'execution=' + execution.getId() +
423 msoLogger.trace('Started ' + method)
425 String processKey = getProcessKey(execution);
426 def prefix = execution.getVariable("prefix")
428 if (prefix == null) {
429 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " prefix is null")
433 def request = execution.getVariable(prefix + 'Request')
435 if (request == null) {
436 request = execution.getVariable(processKey + 'Request')
438 if (request == null) {
439 request = execution.getVariable('bpmnRequest')
442 setVariable(execution, processKey + 'Request', null);
443 setVariable(execution, 'bpmnRequest', null);
444 setVariable(execution, prefix + 'Request', request);
447 if (request == null) {
448 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request is null")
453 def requestId = execution.getVariable("mso-request-id")
455 if (requestId == null) {
456 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request has no mso-request-id")
459 setVariable(execution, prefix + 'requestId', requestId)
461 def serviceInstanceId = execution.getVariable("mso-service-instance-id")
463 if (serviceInstanceId == null) {
464 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request message has no mso-service-instance-id")
467 utils.logContext(requestId, serviceInstanceId)
469 msoLogger.debug("CreateVfModule incoming request: " + request)
470 msoLogger.debug('Incoming message: ' + System.lineSeparator() + request)
471 msoLogger.trace('Finished ' + method)
473 } catch (BpmnError e) {
475 } catch (Exception e) {
476 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Caught exception in " + method , "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
477 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message")
481 public void prepareUpdateInfraRequest(DelegateExecution execution){
482 msoLogger.trace("STARTED prepareUpdateInfraRequest Process")
485 String requestInfo = execution.getVariable("CVFMI_requestInfo")
486 def aicCloudRegion = execution.getVariable("CVFMI_lcpCloudRegionId")
487 def tenantId = execution.getVariable("CVFMI_tenantId")
488 def requestId = utils.getNodeText(requestInfo, "request-id")
489 def vnfId = execution.getVariable("CVFMI_vnfId")
490 def vfModuleId = execution.getVariable("CVFMI_vfModuleId")
491 // vfModuleName may be generated by DoCreateVfModule subprocess if it is not specified on the input
492 def vfModuleName = execution.getVariable("CVFMI_vfModuleName")
494 def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint",execution)
495 execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
496 msoLogger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint)
499 """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
500 xmlns:ns="http://org.onap.so/requestsdb">
503 <ns:updateInfraRequest xmlns:ns="http://org.onap.so/requestsdb">
504 <requestId>${MsoUtils.xmlEscape(requestId)}</requestId>
505 <lastModifiedBy>BPMN</lastModifiedBy>
506 <statusMessage>VF Module successfully created</statusMessage>
507 <responseBody></responseBody>
508 <requestStatus>COMPLETE</requestStatus>
509 <progress>100</progress>
510 <vnfOutputs><vnf-outputs xmlns="http://org.onap/so/infra/vnf-request/v1" xmlns:aetgt="http://org.onap/so/infra/vnf-request/v1" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"><vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id><vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id></vnf-outputs></vnfOutputs>
511 <vfModuleId>${MsoUtils.xmlEscape(vfModuleId)}</vfModuleId>
512 <vfModuleName>${MsoUtils.xmlEscape(vfModuleName)}</vfModuleName>
513 </ns:updateInfraRequest>
515 </soapenv:Envelope>"""
517 payload = utils.formatXml(payload)
518 execution.setVariable("CVFMI_updateInfraRequest", payload)
519 msoLogger.debug("Outgoing UpdateInfraRequest: \n" + payload)
520 msoLogger.debug("CreateVfModuleInfra Outgoing UpdateInfra Request: " + payload)
523 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing prepareUpdateInfraRequest.", "BPMN", MsoLogger.getServiceName(),
524 MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
525 execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateInfraRequest Method:\n" + e.getMessage())
527 msoLogger.trace("COMPLETED prepareUpdateInfraRequest Process")
531 * Builds a "FalloutHandler" request and stores it in the specified execution variable.
533 * @param execution the execution
534 * @param resultVar the execution variable in which the result will be stored
536 public void falloutHandlerPrep(DelegateExecution execution, String resultVar) {
537 def method = getClass().getSimpleName() + '.falloutHandlerPrep(' +
538 'execution=' + execution.getId() +
539 ', resultVar=' + resultVar +
542 msoLogger.trace("Started " + method)
546 def WorkflowException workflowException = execution.getVariable("WorkflowException")
547 def requestInformation = execution.getVariable("CVFMI_requestInfo")
548 def errorResponseCode = workflowException.getErrorCode()
549 def errorResponseMsg = workflowException.getErrorMessage()
550 def encErrorResponseMsg = ""
551 if (errorResponseMsg != null) {
552 encErrorResponseMsg = errorResponseMsg
556 <aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
557 xmlns:reqtype="http://org.onap/so/request/types/v1"
558 xmlns:msoservtypes="http://org.onap/so/request/types/v1"
559 xmlns:structuredtypes="http://org.onap/so/structured/types/v1">
560 ${requestInformation}
561 <aetgt:WorkflowException>
562 <aetgt:ErrorMessage>${MsoUtils.xmlEscape(encErrorResponseMsg)}</aetgt:ErrorMessage>
563 <aetgt:ErrorCode>${MsoUtils.xmlEscape(errorResponseCode)}</aetgt:ErrorCode>
564 </aetgt:WorkflowException>
565 </aetgt:FalloutHandlerRequest>
568 msoLogger.debug("CONTENT before translation: " + content)
569 content = utils.formatXml(content)
570 msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content)
571 msoLogger.debug("CreateVfModuleInfra FallOutHander Request: " + content)
572 execution.setVariable(resultVar, content)
574 msoLogger.trace('Exited ' + method)
575 } catch (BpmnError e) {
577 } catch (Exception e) {
578 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Caught exception in " + method , "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
579 exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error')
583 public void logAndSaveOriginalException(DelegateExecution execution) {
584 def method = getClass().getSimpleName() + '.validateRollbackResponse(' +
585 'execution=' + execution.getId() +
587 msoLogger.trace('Entered ' + method)
589 logWorkflowException(execution, 'CreateVfModuleInfra caught an event')
590 saveWorkflowException(execution, 'CVFMI_originalWorkflowException')
593 public void validateRollbackResponse(DelegateExecution execution) {
594 def method = getClass().getSimpleName() + '.validateRollbackResponse(' +
595 'execution=' + execution.getId() +
597 msoLogger.trace('Entered ' + method)
598 def originalException = execution.getVariable("CVFMI_originalWorkflowException")
599 execution.setVariable("WorkflowException", originalException)
601 execution.setVariable("RollbackCompleted", true)
605 public void sendErrorResponse(DelegateExecution execution){
606 msoLogger.trace("STARTED CreateVfModulenfra sendErrorResponse Process")
608 def sentSyncResponse = execution.getVariable("CVFMI_sentSyncResponse")
609 if(sentSyncResponse == false){
610 WorkflowException wfex = execution.getVariable("WorkflowException")
611 String response = exceptionUtil.buildErrorResponseXml(wfex)
612 msoLogger.debug(response)
613 sendWorkflowResponse(execution, 500, response)
615 msoLogger.debug("Not Sending Error Response. Sync Response Already Sent")
618 } catch (Exception ex) {
619 msoLogger.debug("Error Occured in CreateVfModuleInfra sendErrorResponse Process " + ex.getMessage())
620 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVfModuleInfra sendErrorResponse Process")
622 msoLogger.trace("COMPLETED CreateVfModuleInfra sendErrorResponse Process")