2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
10 * http://www.apache.org/licenses/LICENSE-2.0
\r
12 * Unless required by applicable law or agreed to in writing, software
\r
13 * distributed under the License is distributed on an "AS IS" BASIS,
\r
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
15 * See the License for the specific language governing permissions and
\r
16 * limitations under the License.
\r
17 * ============LICENSE_END=========================================================
\r
20 package org.openecomp.mso.bpmn.infrastructure.scripts
\r
22 import groovy.json.JsonOutput
\r
23 import groovy.json.JsonSlurper
\r
24 import groovy.util.Node
\r
25 import groovy.util.XmlParser;
\r
26 import groovy.xml.QName
\r
28 import java.io.Serializable;
\r
29 import java.util.UUID;
\r
30 import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
\r
31 import org.camunda.bpm.engine.delegate.BpmnError
\r
32 import org.camunda.bpm.engine.impl.cmd.AbstractSetVariableCmd
\r
33 import org.camunda.bpm.engine.delegate.DelegateExecution
\r
34 import org.openecomp.mso.rest.APIResponse
\r
35 import org.openecomp.mso.rest.RESTClient
\r
36 import org.openecomp.mso.rest.RESTConfig
\r
37 import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor;
\r
38 import org.openecomp.mso.bpmn.common.scripts.VidUtils;
\r
39 import org.openecomp.mso.bpmn.core.RollbackData
\r
40 import org.openecomp.mso.bpmn.core.WorkflowException
\r
41 import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
\r
42 import org.openecomp.mso.bpmn.core.json.JsonUtils
\r
43 import org.openecomp.mso.bpmn.core.domain.ModelInfo
\r
44 import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
\r
45 import org.openecomp.mso.bpmn.core.domain.VnfResource
\r
46 import org.openecomp.mso.client.aai.*
\r
48 import org.openecomp.mso.client.appc.ApplicationControllerOrchestrator
\r
49 import org.onap.appc.client.lcm.model.Action;
\r
50 import org.onap.appc.client.lcm.model.ActionIdentifiers;
\r
51 import org.onap.appc.client.lcm.model.LockInput
\r
52 import org.onap.appc.client.lcm.model.UnlockInput
\r
53 import org.onap.appc.client.lcm.model.HealthCheckInput
\r
54 import org.onap.appc.client.lcm.model.StartInput
\r
55 import org.onap.appc.client.lcm.model.Flags
\r
56 import org.onap.appc.client.lcm.model.Status
\r
60 public class ReplaceVnfInfra extends VnfCmBase {
\r
62 ExceptionUtil exceptionUtil = new ExceptionUtil()
\r
63 JsonUtils jsonUtils = new JsonUtils()
\r
64 def prefix = "RPLVnfI_"
\r
67 * Initialize the flow's variables.
\r
69 * @param execution The flow's execution instance.
\r
71 public void initProcessVariables(DelegateExecution execution) {
\r
72 execution.setVariable('prefix', 'RPLVnfI_')
\r
73 execution.setVariable('Request', null)
\r
74 execution.setVariable('requestInfo', null)
\r
75 execution.setVariable('source', null)
\r
76 execution.setVariable('vnfInputs', null)
\r
77 execution.setVariable('tenantId', null)
\r
78 execution.setVariable('vnfParams', null)
\r
79 execution.setVariable('cloudConfiguration', null)
\r
80 execution.setVariable('ReplaceVnfSuccessIndicator', false)
\r
81 execution.setVariable('serviceType', null)
\r
82 execution.setVariable('nfRole', null)
\r
83 execution.setVariable('currentActivity', 'RPLVnfI')
\r
84 execution.setVariable('workStep', null)
\r
85 execution.setVariable('failedActivity', null)
\r
86 execution.setVariable('errorCode', "0")
\r
87 execution.setVariable('errorText', null)
\r
88 execution.setVariable('healthCheckIndex', 1)
\r
89 execution.setVariable('retainResources', true)
\r
90 execution.setVariable('productFamilyId', null)
\r
91 execution.setVariable('healthCheckIndex0', 0)
\r
92 execution.setVariable('healthCheckIndex1', 1)
\r
93 execution.setVariable("rollbackSetClosedLoopDisabledFlag", false)
\r
94 execution.setVariable("rollbackVnfStop", false)
\r
95 execution.setVariable("rollbackVnfLock", false)
\r
96 execution.setVariable("rollbackQuiesceTraffic", false)
\r
97 execution.setVariable("rollbackSetVnfInMaintenanceFlag", false)
\r
101 * Check for missing elements in the received request.
\r
103 * @param execution The flow's execution instance.
\r
105 public void preProcessRequest(DelegateExecution execution) {
\r
106 def method = getClass().getSimpleName() + '.preProcessRequest(' +
\r
107 'execution=' + execution.getId() +
\r
109 initProcessVariables(execution)
\r
110 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
\r
111 logDebug('Entered ' + method, isDebugLogEnabled)
\r
113 initProcessVariables(execution)
\r
115 def incomingRequest = execution.getVariable('bpmnRequest')
\r
117 utils.log("DEBUG", "Incoming Infra Request: " + incomingRequest, isDebugLogEnabled)
\r
119 def jsonSlurper = new JsonSlurper()
\r
120 def jsonOutput = new JsonOutput()
\r
121 Map reqMap = jsonSlurper.parseText(incomingRequest)
\r
122 utils.log("DEBUG", " Request is in JSON format.", isDebugLogEnabled)
\r
124 def serviceInstanceId = execution.getVariable('serviceInstanceId')
\r
125 def vnfId = execution.getVariable('vnfId')
\r
127 execution.setVariable('serviceInstanceId', serviceInstanceId)
\r
128 execution.setVariable("isVidRequest", "true")
\r
129 execution.setVariable('serviceType', 'Mobility')
\r
130 execution.setVariable('retainResources', true)
\r
131 execution.setVariable('disableRollback', true)
\r
132 execution.setVariable('payload', "")
\r
133 execution.setVariable('actionLock', Action.Lock)
\r
134 execution.setVariable('actionUnlock', Action.Unlock)
\r
135 execution.setVariable('actionHealthCheck', Action.HealthCheck)
\r
136 execution.setVariable('actionStart', Action.Start)
\r
137 execution.setVariable('actionStop', Action.Stop)
\r
139 def asdcServiceModelVersion = ''
\r
140 def serviceModelInfo = null
\r
142 def relatedInstanceList = reqMap.requestDetails?.relatedInstanceList
\r
144 if (relatedInstanceList != null) {
\r
145 relatedInstanceList.each {
\r
146 if (it.relatedInstance.modelInfo?.modelType == 'service') {
\r
147 utils.log("DEBUG", "PROCESSING SERVICE INFO", isDebugLogEnabled)
\r
148 asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion
\r
149 serviceModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo)
\r
150 utils.log("DEBUG", "ServiceModelInfo: " + serviceModelInfo, isDebugLogEnabled)
\r
151 def modelInvariant = jsonUtils.getJsonValue(serviceModelInfo, "modelInvariantUuid")
\r
152 utils.log("DEBUG", "modelInvariant: " + modelInvariant, isDebugLogEnabled)
\r
158 execution.setVariable('asdcServiceModelVersion', asdcServiceModelVersion)
\r
159 execution.setVariable('serviceModelInfo', serviceModelInfo)
\r
160 def vnfModelInfo = jsonOutput.toJson(reqMap.requestDetails?.modelInfo)
\r
161 execution.setVariable('vnfModelInfo', vnfModelInfo)
\r
162 def vnfModelInvariantUuid = jsonUtils.getJsonValue(vnfModelInfo, "modelInvariantUuid")
\r
163 execution.setVariable('vnfModelInvariantUuid', vnfModelInvariantUuid)
\r
164 logDebug("vnfModelInvariantUuid: " + vnfModelInvariantUuid, isDebugLogEnabled)
\r
166 def vnfType = execution.getVariable('vnfType')
\r
167 execution.setVariable('vnfType', vnfType)
\r
169 def userParams = reqMap.requestDetails?.requestParameters?.userParams
\r
171 Map<String, String> userParamsMap = [:]
\r
172 if (userParams != null) {
\r
173 userParams.each { userParam ->
\r
174 userParamsMap.put(userParam.name, userParam.value.toString())
\r
178 utils.log("DEBUG", 'Processed user params: ' + userParamsMap, isDebugLogEnabled)
\r
180 execution.setVariable('vfModuleInputParams', userParamsMap)
\r
182 def requestId = execution.getVariable("requestId")
\r
183 execution.setVariable('msoRequestId', requestId)
\r
184 utils.log("DEBUG", "requestId is: " + requestId, isDebugLogEnabled)
\r
186 def vnfName = reqMap.requestDetails?.requestInfo?.instanceName ?: null
\r
187 execution.setVariable('vnfName', vnfName)
\r
189 def requestorId = reqMap.requestDetails?.requestInfo?.requestorId ?: null
\r
190 execution.setVariable('requestorId', requestorId)
\r
192 def usePreload = reqMap.requestDetails?.requestParameters?.usePreload
\r
193 execution.setVariable('usePreload', usePreload)
\r
195 def productFamilyId = reqMap.requestDetails?.requestInfo?.productFamilyId ?: null
\r
196 execution.setVariable('productFamilyId', productFamilyId)
\r
198 def cloudConfiguration = jsonOutput.toJson(reqMap.requestDetails?.cloudConfiguration)
\r
199 execution.setVariable('cloudConfiguration', cloudConfiguration)
\r
200 def lcpCloudRegionId = jsonUtils.getJsonValue(cloudConfiguration, "lcpCloudRegionId")
\r
201 execution.setVariable('lcpCloudRegionId', lcpCloudRegionId)
\r
202 def tenantId = jsonUtils.getJsonValue(cloudConfiguration, "tenantId")
\r
203 execution.setVariable('tenantId', tenantId)
\r
205 def globalSubscriberId = reqMap.requestDetails?.subscriberInfo?.globalSubscriberId ?: ''
\r
206 execution.setVariable('globalSubscriberId', globalSubscriberId)
\r
208 execution.setVariable('sdncVersion', '1702')
\r
210 execution.setVariable("ReplaceVnfInfraSuccessIndicator", false)
\r
212 execution.setVariable("isDebugLogEnabled", isDebugLogEnabled)
\r
214 def source = reqMap.requestDetails?.requestInfo?.source
\r
215 execution.setVariable("source", source)
\r
217 //For Completion Handler & Fallout Handler
\r
218 String requestInfo =
\r
219 """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
\r
220 <request-id>${requestId}</request-id>
\r
221 <action>REPLACE</action>
\r
222 <source>${source}</source>
\r
225 execution.setVariable("requestInfo", requestInfo)
\r
227 logDebug('RequestInfo: ' + execution.getVariable("requestInfo"), isDebugLogEnabled)
\r
229 logDebug('Exited ' + method, isDebugLogEnabled)
\r
232 catch(groovy.json.JsonException je) {
\r
233 utils.log("DEBUG", " Request is not in JSON format.", isDebugLogEnabled)
\r
234 exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format")
\r
237 catch(Exception e) {
\r
238 String restFaultMessage = e.getMessage()
\r
239 utils.log("ERROR", " Exception Encountered - " + "\n" + restFaultMessage, isDebugLogEnabled)
\r
240 exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage)
\r
245 * Prepare and send the sychronous response for this flow.
\r
247 * @param execution The flow's execution instance.
\r
249 public void sendSynchResponse(DelegateExecution execution) {
\r
250 def method = getClass().getSimpleName() + '.sendSynchResponse(' +
\r
251 'execution=' + execution.getId() +
\r
253 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
\r
254 logDebug('Entered ' + method, isDebugLogEnabled)
\r
258 def requestInfo = execution.getVariable('requestInfo')
\r
259 def requestId = execution.getVariable('requestId')
\r
260 def source = execution.getVariable('source')
\r
261 def progress = getNodeTextForce(requestInfo, 'progress')
\r
262 if (progress.isEmpty()) {
\r
265 def startTime = getNodeTextForce(requestInfo, 'start-time')
\r
266 if (startTime.isEmpty()) {
\r
267 startTime = System.currentTimeMillis()
\r
270 // RESTResponse (for API Handler (APIH) Reply Task)
\r
271 def vnfId = execution.getVariable("vnfId")
\r
272 String synchResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim()
\r
274 sendWorkflowResponse(execution, 200, synchResponse)
\r
276 logDebug('Exited ' + method, isDebugLogEnabled)
\r
277 } catch (BpmnError e) {
\r
279 } catch (Exception e) {
\r
280 logError('Caught exception in ' + method, e)
\r
281 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
\r
288 * Get VnfResource decomposition object for this VNF.
\r
291 * @param execution The flow's execution instance.
\r
293 public void getVnfResourceDecomposition(DelegateExecution execution) {
\r
294 def method = getClass().getSimpleName() + '.getVnfResourceDecomposition(' +
\r
295 'execution=' + execution.getId() +
\r
297 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
\r
298 logDebug('Entered ' + method, isDebugLogEnabled)
\r
301 ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
\r
302 String vnfModelInvariantUuid = execution.getVariable('vnfModelInvariantUuid')
\r
303 logDebug("vnfModelInvariantUuid: " + vnfModelInvariantUuid, isDebugLogEnabled)
\r
304 List<VnfResource> vnfResources = serviceDecomposition.getServiceVnfs()
\r
306 for (i in 0..vnfResources.size()-1) {
\r
307 ModelInfo modelInfo = vnfResources[i].getModelInfo()
\r
308 String modelInvariantUuidFromDecomposition = modelInfo.getModelInvariantUuid()
\r
309 logDebug("modelInvariantUuidFromDecomposition: " + modelInvariantUuidFromDecomposition, isDebugLogEnabled)
\r
311 if (vnfModelInvariantUuid.equals(modelInvariantUuidFromDecomposition)) {
\r
312 VnfResource vnfResourceDecomposition = vnfResources[i]
\r
313 execution.setVariable('vnfResourceDecomposition', vnfResourceDecomposition)
\r
314 def nfRole = vnfResourceDecomposition.getNfRole()
\r
315 execution.setVariable('nfRole', nfRole)
\r
316 logDebug("vnfResourceDecomposition: " + vnfResourceDecomposition.toJsonString(), isDebugLogEnabled)
\r
325 logDebug('Exited ' + method, isDebugLogEnabled)
\r
326 } catch (BpmnError e) {
\r
328 } catch (Exception e) {
\r
329 logError('Caught exception in ' + method, e)
\r
330 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage())
\r
335 * Check if this VNF is already in maintenance in A&AI.
\r
338 * @param execution The flow's execution instance.
\r
340 public void checkIfVnfInMaintInAAI(DelegateExecution execution) {
\r
341 def method = getClass().getSimpleName() + '.checkIfVnfInMaintInAAI(' +
\r
342 'execution=' + execution.getId() +
\r
344 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
\r
345 execution.setVariable('errorCode', "0")
\r
346 execution.setVariable("workStep", "checkIfVnfInMaintInAAI")
\r
347 execution.setVariable("failedActivity", "AAI")
\r
348 logDebug('Entered ' + method, isDebugLogEnabled)
\r
351 def transactionLoggingUuid = UUID.randomUUID().toString()
\r
352 AAIRestClientImpl client = new AAIRestClientImpl()
\r
353 AAIValidatorImpl aaiValidator = new AAIValidatorImpl()
\r
354 aaiValidator.setClient(client)
\r
355 def vnfId = execution.getVariable("vnfId")
\r
356 boolean isInMaint = aaiValidator.isVNFLocked(vnfId, transactionLoggingUuid)
\r
357 logDebug("isInMaint result: " + isInMaint, isDebugLogEnabled)
\r
358 execution.setVariable('isVnfInMaintenance', isInMaint)
\r
361 execution.setVariable("errorCode", "1003")
\r
362 execution.setVariable("errorText", "VNF is in maintenance in A&AI")
\r
366 logDebug('Exited ' + method, isDebugLogEnabled)
\r
367 } catch (BpmnError e) {
\r
369 } catch (Exception e) {
\r
370 logError('Caught exception in ' + method, e)
\r
371 execution.setVariable("errorCode", "1002")
\r
372 execution.setVariable("errorText", e.getMessage())
\r
373 //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage())
\r
379 * Check if this VNF's pservers are locked in A&AI.
\r
382 * @param execution The flow's execution instance.
\r
384 public void checkIfPserversInMaintInAAI(DelegateExecution execution) {
\r
385 def method = getClass().getSimpleName() + '.checkIfPserversInMaintInAAI(' +
\r
386 'execution=' + execution.getId() +
\r
388 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
\r
389 execution.setVariable('errorCode', "0")
\r
390 logDebug('Entered ' + method, isDebugLogEnabled)
\r
391 execution.setVariable("workStep", "checkIfPserversInMaintInAAI")
\r
392 execution.setVariable("failedActivity", "AAI")
\r
395 def transactionLoggingUuid = UUID.randomUUID().toString()
\r
396 AAIRestClientImpl client = new AAIRestClientImpl()
\r
397 AAIValidatorImpl aaiValidator = new AAIValidatorImpl()
\r
398 aaiValidator.setClient(client)
\r
399 def vnfId = execution.getVariable("vnfId")
\r
400 boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId, transactionLoggingUuid)
\r
401 logDebug("areLocked result: " + areLocked, isDebugLogEnabled)
\r
402 execution.setVariable('arePserversLocked', areLocked)
\r
405 execution.setVariable("errorCode", "1003")
\r
406 execution.setVariable("errorText", "pServers are locked in A&AI")
\r
409 logDebug('Exited ' + method, isDebugLogEnabled)
\r
410 } catch (BpmnError e) {
\r
412 } catch (Exception e) {
\r
413 logError('Caught exception in ' + method, e)
\r
414 execution.setVariable("errorCode", "1002")
\r
415 execution.setVariable("errorText", e.getMessage())
\r
416 //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage())
\r
421 * Set inMaint flag for this VNF to the specified value in A&AI.
\r
424 * @param execution The flow's execution instance.
\r
425 * @param inMaint The boolean value of the flag to set
\r
427 public void setVnfInMaintFlagInAAI(DelegateExecution execution, boolean inMaint) {
\r
428 def method = getClass().getSimpleName() + '.setVnfInMaintFlagInAAI(' +
\r
429 'execution=' + execution.getId() +
\r
431 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
\r
432 execution.setVariable('errorCode', "0")
\r
433 logDebug('Entered ' + method, isDebugLogEnabled)
\r
435 execution.setVariable("workStep", "setVnfInMaintFlagInAAI")
\r
438 execution.setVariable("workStep", "unsetVnfInMaintFlagInAAI")
\r
440 execution.setVariable("failedActivity", "AAI")
\r
443 def transactionLoggingUuid = UUID.randomUUID().toString()
\r
444 AAIRestClientImpl client = new AAIRestClientImpl()
\r
445 AAIUpdatorImpl aaiUpdator = new AAIUpdatorImpl()
\r
446 aaiUpdator.setClient(client)
\r
447 def vnfId = execution.getVariable("vnfId")
\r
449 aaiUpdator.updateVnfToLocked(vnfId, transactionLoggingUuid)
\r
450 execution.setVariable("rollbackSetVnfInMaintenanceFlag", true)
\r
453 aaiUpdator.updateVnfToUnLocked(vnfId, transactionLoggingUuid)
\r
456 logDebug('Exited ' + method, isDebugLogEnabled)
\r
457 } catch (BpmnError e) {
\r
459 } catch (Exception e) {
\r
460 logError('Caught exception in ' + method, e)
\r
461 execution.setVariable("errorCode", "1002")
\r
462 execution.setVariable("errorText", e.getMessage())
\r
463 //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in setVnfInMaintFlagInAAI(): ' + e.getMessage())
\r
468 * Call APP-C client to execute specified APP-C command for this VNF.
\r
471 * @param execution The flow's execution instance.
\r
472 * @param action The action to take in APP-C.
\r
474 public void runAppcCommand(DelegateExecution execution, Action action) {
\r
475 def method = getClass().getSimpleName() + '.runAppcCommand(' +
\r
476 'execution=' + execution.getId() +
\r
478 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
\r
479 execution.setVariable('errorCode', "0")
\r
480 logDebug('Entered ' + method, isDebugLogEnabled)
\r
483 logDebug("Running APP-C action: " + action.toString(), isDebugLogEnabled)
\r
484 String vnfId = execution.getVariable('vnfId')
\r
485 String msoRequestId = execution.getVariable('requestId')
\r
486 execution.setVariable('msoRequestId', msoRequestId)
\r
487 execution.setVariable("failedActivity", "APP-C")
\r
488 execution.setVariable("workStep", action.toString() + "VNF")
\r
490 ApplicationControllerOrchestrator appcClient = new ApplicationControllerOrchestrator()
\r
491 Status appcStatus = null
\r
494 execution.setVariable('workStep', "LockVNF")
\r
495 appcStatus = appcClient.runCommand(Action.Lock,msoRequestId,vnfId,null)
\r
497 case Action.Unlock:
\r
498 execution.setVariable('workStep', "UnlockVNF")
\r
499 appcStatus = appcClient.runCommand(Action.Unlock,msoRequestId,vnfId,null)
\r
501 case Action.HealthCheck:
\r
502 def healthCheckIndex = execution.getVariable('healthCheckIndex')
\r
503 execution.setVariable('workStep', "HealthCheckVNF" + healthCheckIndex)
\r
504 execution.setVariable('healthCheckIndex', healthCheckIndex + 1)
\r
505 appcStatus = appcClient.runCommand(Action.HealthCheck,msoRequestId,vnfId,null)
\r
508 execution.setVariable('workStep', "StartVNF")
\r
509 appcStatus = appcClient.runCommand(Action.Start,msoRequestId,vnfId,null)
\r
512 execution.setVariable('workStep', "StopVNF")
\r
513 appcStatus = appcClient.runCommand(Action.Stop,msoRequestId,vnfId,null)
\r
518 logDebug("Completed AppC request", isDebugLogEnabled)
\r
519 int appcCode = appcStatus.getCode()
\r
520 logDebug("AppC status code is: " + appcCode, isDebugLogEnabled)
\r
521 logDebug("AppC status message is: " + appcStatus.getMessage(), isDebugLogEnabled)
\r
522 if (support.getCategoryOf(appcStatus) == ApplicationControllerSupport.StatusCategory.ERROR) {
\r
523 execution.setVariable("errorCode", Integer.toString(appcCode))
\r
524 execution.setVariable("errorText", appcStatus.getMessage())
\r
527 logDebug('Exited ' + method, isDebugLogEnabled)
\r
528 } catch (BpmnError e) {
\r
529 logError('Caught exception in ' + method, e)
\r
530 execution.setVariable("errorCode", "1002")
\r
531 execution.setVariable("errorText", e.getMessage())
\r
532 } catch (java.lang.NoSuchMethodError e) {
\r
533 logError('Caught exception in ' + method, e)
\r
534 execution.setVariable("errorCode", "1002")
\r
535 execution.setVariable("errorText", e.getMessage())
\r
536 } catch (Exception e) {
\r
537 logError('Caught exception in ' + method, e)
\r
538 execution.setVariable("errorCode", "1002")
\r
539 execution.setVariable("errorText", e.getMessage())
\r
546 * Prepare DoDeleteVnfAndModules call.
\r
549 * @param execution The flow's execution instance.
\r
551 public void prepDoDeleteVnfAndModules(DelegateExecution execution) {
\r
552 def method = getClass().getSimpleName() + '.prepDoDeleteVnfAndModules(' +
\r
553 'execution=' + execution.getId() +
\r
555 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
\r
556 execution.setVariable('errorCode', "0")
\r
557 logDebug('Entered ' + method, isDebugLogEnabled)
\r
558 execution.setVariable("workStep", "doDeleteVnfAndModules")
\r
559 execution.setVariable("failedActivity", "MSO Delete VNF")
\r
560 logDebug('Exited ' + method, isDebugLogEnabled)
\r
565 * Prepare DoCreateVnfAndModules call.
\r
568 * @param execution The flow's execution instance.
\r
570 public void prepDoCreateVnfAndModules(DelegateExecution execution) {
\r
571 def method = getClass().getSimpleName() + '.prepDoReplaceVnfAndModules(' +
\r
572 'execution=' + execution.getId() +
\r
574 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
\r
575 execution.setVariable('errorCode', "0")
\r
576 logDebug('Entered ' + method, isDebugLogEnabled)
\r
577 execution.setVariable("workStep", "doCreateVnfAndModules")
\r
578 execution.setVariable("failedActivity", "MSO Create VNF")
\r
579 logDebug('Exited ' + method, isDebugLogEnabled)
\r
585 * Handle Abort disposition from RainyDayHandler
\r
587 * @param execution The flow's execution instance.
\r
589 public void abortProcessing(DelegateExecution execution) {
\r
590 def method = getClass().getSimpleName() + '.abortProcessing(' +
\r
591 'execution=' + execution.getId() +
\r
593 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
\r
594 logDebug('Entered ' + method, isDebugLogEnabled)
\r
596 def errorText = execution.getVariable("errorText")
\r
597 def errorCode = execution.getVariable("errorCode")
\r
599 exceptionUtil.buildAndThrowWorkflowException(execution, errorCode as Integer, errorText)
\r
603 * Handle Manual disposition from RainyDayHandler
\r
605 * @param execution The flow's execution instance.
\r
607 public void manualProcessing(DelegateExecution execution) {
\r
608 def method = getClass().getSimpleName() + '.manualProcessing(' +
\r
609 'execution=' + execution.getId() +
\r
611 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
\r
612 logDebug('Entered ' + method, isDebugLogEnabled)
\r
614 def taskId = execution.getVariable("taskId")
\r
616 exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Processing halted - manual task created: " + taskId)
\r