import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil\r
import org.camunda.bpm.engine.delegate.BpmnError\r
import org.camunda.bpm.engine.impl.cmd.AbstractSetVariableCmd\r
-import org.camunda.bpm.engine.runtime.Execution\r
+import org.camunda.bpm.engine.delegate.DelegateExecution\r
import org.openecomp.mso.rest.APIResponse\r
import org.openecomp.mso.rest.RESTClient\r
import org.openecomp.mso.rest.RESTConfig\r
import org.openecomp.mso.bpmn.core.domain.VnfResource\r
import org.openecomp.mso.client.aai.*\r
\r
-import org.openecomp.mso.client.appc.ApplicationControllerClient;\r
-import org.openecomp.mso.client.appc.ApplicationControllerSupport;\r
-import org.openecomp.appc.client.lcm.model.Action;\r
-import org.openecomp.appc.client.lcm.model.ActionIdentifiers;\r
-import org.openecomp.appc.client.lcm.model.LockInput\r
-import org.openecomp.appc.client.lcm.model.UnlockInput\r
-import org.openecomp.appc.client.lcm.model.HealthCheckInput\r
-import org.openecomp.appc.client.lcm.model.StartInput\r
-import org.openecomp.appc.client.lcm.model.StopInput\r
-import org.openecomp.appc.client.lcm.model.Flags\r
-import org.openecomp.appc.client.lcm.model.Status\r
+import org.openecomp.mso.client.appc.ApplicationControllerOrchestrator\r
+import org.onap.appc.client.lcm.model.Action;\r
+import org.onap.appc.client.lcm.model.ActionIdentifiers;\r
+import org.onap.appc.client.lcm.model.LockInput\r
+import org.onap.appc.client.lcm.model.UnlockInput\r
+import org.onap.appc.client.lcm.model.HealthCheckInput\r
+import org.onap.appc.client.lcm.model.StartInput\r
+import org.onap.appc.client.lcm.model.Flags\r
+import org.onap.appc.client.lcm.model.Status\r
\r
\r
\r
-public class ReplaceVnfInfra extends AbstractServiceTaskProcessor {\r
+public class ReplaceVnfInfra extends VnfCmBase {\r
\r
ExceptionUtil exceptionUtil = new ExceptionUtil()\r
- JsonUtils jsonUtils = new JsonUtils()\r
- ApplicationControllerClient appcClient = new ApplicationControllerClient() \r
+ JsonUtils jsonUtils = new JsonUtils() \r
def prefix = "RPLVnfI_"\r
\r
/**\r
*\r
* @param execution The flow's execution instance.\r
*/\r
- public void initProcessVariables(Execution execution) {\r
+ public void initProcessVariables(DelegateExecution execution) {\r
execution.setVariable('prefix', 'RPLVnfI_')\r
- execution.setVariable('RPLVnfI_Request', null)\r
- execution.setVariable('RPLVnfI_requestInfo', null)\r
- execution.setVariable('RPLVnfI_requestId', null)\r
- execution.setVariable('RPLVnfI_source', null)\r
- execution.setVariable('RPLVnfI_vnfInputs', null)\r
- execution.setVariable('RPLVnfI_vnfId', null) \r
- execution.setVariable('RPLVnfI_tenantId', null) \r
- execution.setVariable('RPLVnfI_vnfParams', null)\r
- execution.setVariable('RPLVnfI_cloudConfiguration', null) \r
+ execution.setVariable('Request', null)\r
+ execution.setVariable('requestInfo', null) \r
+ execution.setVariable('source', null)\r
+ execution.setVariable('vnfInputs', null) \r
+ execution.setVariable('tenantId', null) \r
+ execution.setVariable('vnfParams', null)\r
+ execution.setVariable('cloudConfiguration', null) \r
execution.setVariable('ReplaceVnfSuccessIndicator', false)\r
- execution.setVariable('RPLVnfI_serviceType', null)\r
- execution.setVariable('RPLVnfI_nfRole', null)\r
- execution.setVariable('RPLVnfI_currentActivity', 'RPLVnfI')\r
- execution.setVariable('RPLVnfI_workStep', null)\r
- execution.setVariable('RPLVnfI_failedActivity', null)\r
- execution.setVariable('RPLVnfI_errorCode', "0")\r
- execution.setVariable('RPLVnfI_errorText', null)\r
- execution.setVariable('RPLVnfI_healthCheckIndex', 1)\r
+ execution.setVariable('serviceType', null)\r
+ execution.setVariable('nfRole', null)\r
+ execution.setVariable('currentActivity', 'RPLVnfI')\r
+ execution.setVariable('workStep', null)\r
+ execution.setVariable('failedActivity', null)\r
+ execution.setVariable('errorCode', "0")\r
+ execution.setVariable('errorText', null)\r
+ execution.setVariable('healthCheckIndex', 1)\r
+ execution.setVariable('retainResources', true)\r
+ execution.setVariable('productFamilyId', null)\r
+ execution.setVariable('healthCheckIndex0', 0)\r
+ execution.setVariable('healthCheckIndex1', 1)\r
+ execution.setVariable("rollbackSetClosedLoopDisabledFlag", false)\r
+ execution.setVariable("rollbackVnfStop", false)\r
+ execution.setVariable("rollbackVnfLock", false)\r
+ execution.setVariable("rollbackQuiesceTraffic", false)\r
+ execution.setVariable("rollbackSetVnfInMaintenanceFlag", false)\r
}\r
\r
/**\r
*\r
* @param execution The flow's execution instance.\r
*/\r
- public void preProcessRequest(Execution execution) {\r
+ public void preProcessRequest(DelegateExecution execution) {\r
def method = getClass().getSimpleName() + '.preProcessRequest(' +\r
'execution=' + execution.getId() +\r
')'\r
def serviceInstanceId = execution.getVariable('serviceInstanceId')\r
def vnfId = execution.getVariable('vnfId')\r
\r
- execution.setVariable(prefix + 'serviceInstanceId', serviceInstanceId)\r
- execution.setVariable(prefix + 'vnfId', vnfId)\r
- execution.setVariable("isVidRequest", "true") \r
+ execution.setVariable('serviceInstanceId', serviceInstanceId) \r
+ execution.setVariable("isVidRequest", "true")\r
+ execution.setVariable('serviceType', 'Mobility')\r
+ execution.setVariable('retainResources', true)\r
+ execution.setVariable('disableRollback', true)\r
+ execution.setVariable('payload', "")\r
+ execution.setVariable('actionLock', Action.Lock)\r
+ execution.setVariable('actionUnlock', Action.Unlock)\r
+ execution.setVariable('actionHealthCheck', Action.HealthCheck)\r
+ execution.setVariable('actionStart', Action.Start)\r
+ execution.setVariable('actionStop', Action.Stop)\r
\r
def asdcServiceModelVersion = ''\r
def serviceModelInfo = null\r
}\r
} \r
\r
- execution.setVariable(prefix + 'asdcServiceModelVersion', asdcServiceModelVersion)\r
- execution.setVariable(prefix + 'serviceModelInfo', serviceModelInfo)\r
+ execution.setVariable('asdcServiceModelVersion', asdcServiceModelVersion)\r
+ execution.setVariable('serviceModelInfo', serviceModelInfo) \r
def vnfModelInfo = jsonOutput.toJson(reqMap.requestDetails?.modelInfo)\r
- execution.setVariable(prefix + 'vnfModelInfo', vnfModelInfo)\r
+ execution.setVariable('vnfModelInfo', vnfModelInfo)\r
def vnfModelInvariantUuid = jsonUtils.getJsonValue(vnfModelInfo, "modelInvariantUuid")\r
- execution.setVariable(prefix + 'vnfModelInvariantUuid', vnfModelInvariantUuid) \r
+ execution.setVariable('vnfModelInvariantUuid', vnfModelInvariantUuid) \r
logDebug("vnfModelInvariantUuid: " + vnfModelInvariantUuid, isDebugLogEnabled) \r
\r
def vnfType = execution.getVariable('vnfType')\r
- execution.setVariable(prefix + 'vnfType', vnfType) \r
+ execution.setVariable('vnfType', vnfType) \r
\r
def userParams = reqMap.requestDetails?.requestParameters?.userParams \r
\r
Map<String, String> userParamsMap = [:]\r
if (userParams != null) {\r
userParams.each { userParam ->\r
- userParamsMap.put(userParam.name, userParam.value)\r
+ userParamsMap.put(userParam.name, userParam.value.toString())\r
} \r
} \r
\r
utils.log("DEBUG", 'Processed user params: ' + userParamsMap, isDebugLogEnabled) \r
\r
- execution.setVariable(prefix + 'vfModuleInputParams', userParamsMap) \r
+ execution.setVariable('vfModuleInputParams', userParamsMap) \r
\r
- def requestId = execution.getVariable("mso-request-id")\r
- execution.setVariable(prefix + 'requestId', requestId)\r
- \r
+ def requestId = execution.getVariable("requestId") \r
+ execution.setVariable('msoRequestId', requestId)\r
+ utils.log("DEBUG", "requestId is: " + requestId, isDebugLogEnabled)\r
\r
def vnfName = reqMap.requestDetails?.requestInfo?.instanceName ?: null\r
- execution.setVariable(prefix + 'vnfName', vnfName)\r
+ execution.setVariable('vnfName', vnfName)\r
\r
def requestorId = reqMap.requestDetails?.requestInfo?.requestorId ?: null\r
- execution.setVariable(prefix + 'requestorId', requestorId)\r
+ execution.setVariable('requestorId', requestorId)\r
\r
def usePreload = reqMap.requestDetails?.requestParameters?.usePreload\r
- execution.setVariable(prefix + 'usePreload', usePreload)\r
+ execution.setVariable('usePreload', usePreload)\r
+ \r
+ def productFamilyId = reqMap.requestDetails?.requestInfo?.productFamilyId ?: null\r
+ execution.setVariable('productFamilyId', productFamilyId)\r
\r
def cloudConfiguration = jsonOutput.toJson(reqMap.requestDetails?.cloudConfiguration) \r
- execution.setVariable(prefix + 'cloudConfiguration', cloudConfiguration)\r
+ execution.setVariable('cloudConfiguration', cloudConfiguration)\r
def lcpCloudRegionId = jsonUtils.getJsonValue(cloudConfiguration, "lcpCloudRegionId")\r
- execution.setVariable(prefix + 'lcpCloudRegionId', lcpCloudRegionId)\r
+ execution.setVariable('lcpCloudRegionId', lcpCloudRegionId)\r
def tenantId = jsonUtils.getJsonValue(cloudConfiguration, "tenantId")\r
- execution.setVariable(prefix + 'tenantId', tenantId)\r
+ execution.setVariable('tenantId', tenantId)\r
\r
def globalSubscriberId = reqMap.requestDetails?.subscriberInfo?.globalSubscriberId ?: ''\r
- execution.setVariable(prefix + 'globalSubscriberId', globalSubscriberId)\r
+ execution.setVariable('globalSubscriberId', globalSubscriberId)\r
\r
- execution.setVariable(prefix + 'sdncVersion', '1702')\r
+ execution.setVariable('sdncVersion', '1702')\r
\r
execution.setVariable("ReplaceVnfInfraSuccessIndicator", false)\r
\r
execution.setVariable("isDebugLogEnabled", isDebugLogEnabled) \r
\r
def source = reqMap.requestDetails?.requestInfo?.source\r
- execution.setVariable(prefix + "source", source)\r
+ execution.setVariable("source", source)\r
\r
//For Completion Handler & Fallout Handler\r
String requestInfo =\r
<source>${source}</source>\r
</request-info>"""\r
\r
- execution.setVariable(prefix + "requestInfo", requestInfo) \r
+ execution.setVariable("requestInfo", requestInfo) \r
\r
- logDebug('RequestInfo: ' + execution.getVariable(prefix + "requestInfo"), isDebugLogEnabled) \r
+ logDebug('RequestInfo: ' + execution.getVariable("requestInfo"), isDebugLogEnabled) \r
\r
logDebug('Exited ' + method, isDebugLogEnabled)\r
\r
*\r
* @param execution The flow's execution instance.\r
*/\r
- public void sendSynchResponse(Execution execution) {\r
+ public void sendSynchResponse(DelegateExecution execution) {\r
def method = getClass().getSimpleName() + '.sendSynchResponse(' +\r
'execution=' + execution.getId() +\r
')'\r
\r
\r
try {\r
- def requestInfo = execution.getVariable('RPLVnfI_requestInfo')\r
- def requestId = execution.getVariable('RPLVnfI_requestId')\r
- def source = execution.getVariable('RPLVnfI_source')\r
+ def requestInfo = execution.getVariable('requestInfo')\r
+ def requestId = execution.getVariable('requestId')\r
+ def source = execution.getVariable('source')\r
def progress = getNodeTextForce(requestInfo, 'progress')\r
if (progress.isEmpty()) {\r
progress = '0'\r
*\r
* @param execution The flow's execution instance.\r
*/\r
- public void getVnfResourceDecomposition(Execution execution) {\r
+ public void getVnfResourceDecomposition(DelegateExecution execution) {\r
def method = getClass().getSimpleName() + '.getVnfResourceDecomposition(' +\r
'execution=' + execution.getId() +\r
')'\r
\r
try {\r
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")\r
- String vnfModelInvariantUuid = execution.getVariable(prefix + 'vnfModelInvariantUuid')\r
+ String vnfModelInvariantUuid = execution.getVariable('vnfModelInvariantUuid')\r
logDebug("vnfModelInvariantUuid: " + vnfModelInvariantUuid, isDebugLogEnabled)\r
List<VnfResource> vnfResources = serviceDecomposition.getServiceVnfs()\r
\r
\r
if (vnfModelInvariantUuid.equals(modelInvariantUuidFromDecomposition)) {\r
VnfResource vnfResourceDecomposition = vnfResources[i]\r
- execution.setVariable(prefix + 'vnfResourceDecomposition', vnfResourceDecomposition)\r
+ execution.setVariable('vnfResourceDecomposition', vnfResourceDecomposition)\r
def nfRole = vnfResourceDecomposition.getNfRole() \r
- execution.setVariable(prefix + 'nfRole', nfRole)\r
+ execution.setVariable('nfRole', nfRole)\r
logDebug("vnfResourceDecomposition: " + vnfResourceDecomposition.toJsonString(), isDebugLogEnabled) \r
break\r
}\r
*\r
* @param execution The flow's execution instance.\r
*/\r
- public void checkIfVnfInMaintInAAI(Execution execution) {\r
+ public void checkIfVnfInMaintInAAI(DelegateExecution execution) {\r
def method = getClass().getSimpleName() + '.checkIfVnfInMaintInAAI(' +\r
'execution=' + execution.getId() +\r
')'\r
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')\r
- execution.setVariable(prefix + 'errorCode', "0")\r
- execution.setVariable(prefix + "workStep", "checkIfVnfInMaintInAAI")\r
+ execution.setVariable('errorCode', "0")\r
+ execution.setVariable("workStep", "checkIfVnfInMaintInAAI")\r
execution.setVariable("failedActivity", "AAI")\r
logDebug('Entered ' + method, isDebugLogEnabled)\r
\r
def vnfId = execution.getVariable("vnfId")\r
boolean isInMaint = aaiValidator.isVNFLocked(vnfId, transactionLoggingUuid)\r
logDebug("isInMaint result: " + isInMaint, isDebugLogEnabled)\r
- execution.setVariable(prefix + 'isVnfInMaintenance', isInMaint)\r
+ execution.setVariable('isVnfInMaintenance', isInMaint)\r
+ \r
+ if (isInMaint) {\r
+ execution.setVariable("errorCode", "1003")\r
+ execution.setVariable("errorText", "VNF is in maintenance in A&AI")\r
+ }\r
+\r
\r
logDebug('Exited ' + method, isDebugLogEnabled)\r
} catch (BpmnError e) {\r
throw e;\r
} catch (Exception e) {\r
logError('Caught exception in ' + method, e)\r
- execution.setVariable(prefix + "errorCode", "1002")\r
- execution.setVariable(prefix + "errorText", e.getMessage())\r
+ execution.setVariable("errorCode", "1002")\r
+ execution.setVariable("errorText", e.getMessage())\r
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage())\r
}\r
}\r
*\r
* @param execution The flow's execution instance.\r
*/\r
- public void checkIfPserversInMaintInAAI(Execution execution) {\r
+ public void checkIfPserversInMaintInAAI(DelegateExecution execution) {\r
def method = getClass().getSimpleName() + '.checkIfPserversInMaintInAAI(' +\r
'execution=' + execution.getId() +\r
')'\r
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')\r
- execution.setVariable(prefix + 'errorCode', "0")\r
+ execution.setVariable('errorCode', "0")\r
logDebug('Entered ' + method, isDebugLogEnabled)\r
- execution.setVariable(prefix + "workStep", "checkIfPserversInMaintInAAI")\r
+ execution.setVariable("workStep", "checkIfPserversInMaintInAAI")\r
execution.setVariable("failedActivity", "AAI")\r
\r
try {\r
def vnfId = execution.getVariable("vnfId") \r
boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId, transactionLoggingUuid)\r
logDebug("areLocked result: " + areLocked, isDebugLogEnabled)\r
- execution.setVariable(prefix + 'arePserversLocked', areLocked)\r
+ execution.setVariable('arePserversLocked', areLocked)\r
+ \r
+ if (areLocked) {\r
+ execution.setVariable("errorCode", "1003")\r
+ execution.setVariable("errorText", "pServers are locked in A&AI")\r
+ }\r
\r
logDebug('Exited ' + method, isDebugLogEnabled)\r
} catch (BpmnError e) {\r
throw e;\r
} catch (Exception e) {\r
logError('Caught exception in ' + method, e)\r
- execution.setVariable(prefix + "errorCode", "1002")\r
- execution.setVariable(prefix + "errorText", e.getMessage())\r
+ execution.setVariable("errorCode", "1002")\r
+ execution.setVariable("errorText", e.getMessage())\r
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage())\r
}\r
}\r
* @param execution The flow's execution instance.\r
* @param inMaint The boolean value of the flag to set\r
*/\r
- public void setVnfInMaintFlagInAAI(Execution execution, boolean inMaint) {\r
+ public void setVnfInMaintFlagInAAI(DelegateExecution execution, boolean inMaint) {\r
def method = getClass().getSimpleName() + '.setVnfInMaintFlagInAAI(' +\r
'execution=' + execution.getId() +\r
')'\r
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')\r
- execution.setVariable(prefix + 'errorCode', "0")\r
+ execution.setVariable('errorCode', "0")\r
logDebug('Entered ' + method, isDebugLogEnabled)\r
if (inMaint) {\r
- execution.setVariable(prefix + "workStep", "setVnfInMaintFlagInAAI")\r
+ execution.setVariable("workStep", "setVnfInMaintFlagInAAI")\r
}\r
else {\r
- execution.setVariable(prefix + "workStep", "unsetVnfInMaintFlagInAAI")\r
+ execution.setVariable("workStep", "unsetVnfInMaintFlagInAAI")\r
}\r
execution.setVariable("failedActivity", "AAI")\r
\r
def vnfId = execution.getVariable("vnfId")\r
if (inMaint) {\r
aaiUpdator.updateVnfToLocked(vnfId, transactionLoggingUuid)\r
+ execution.setVariable("rollbackSetVnfInMaintenanceFlag", true)\r
}\r
else {\r
aaiUpdator.updateVnfToUnLocked(vnfId, transactionLoggingUuid)\r
throw e;\r
} catch (Exception e) {\r
logError('Caught exception in ' + method, e)\r
- execution.setVariable(prefix + "errorCode", "1002")\r
- execution.setVariable(prefix + "errorText", e.getMessage())\r
+ execution.setVariable("errorCode", "1002")\r
+ execution.setVariable("errorText", e.getMessage())\r
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in setVnfInMaintFlagInAAI(): ' + e.getMessage())\r
}\r
}\r
* @param execution The flow's execution instance.\r
* @param action The action to take in APP-C.\r
*/\r
- public void runAppcCommand(Execution execution, Action action) {\r
+ public void runAppcCommand(DelegateExecution execution, Action action) {\r
def method = getClass().getSimpleName() + '.runAppcCommand(' +\r
'execution=' + execution.getId() +\r
')'\r
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')\r
- execution.setVariable(prefix + 'errorCode', "0")\r
- logDebug('Entered ' + method, isDebugLogEnabled)\r
+ execution.setVariable('errorCode', "0")\r
+ logDebug('Entered ' + method, isDebugLogEnabled) \r
\r
try {\r
logDebug("Running APP-C action: " + action.toString(), isDebugLogEnabled)\r
String vnfId = execution.getVariable('vnfId')\r
- String msoRequestId = execution.getVariable(prefix + 'requestId')\r
+ String msoRequestId = execution.getVariable('requestId')\r
execution.setVariable('msoRequestId', msoRequestId)\r
- execution.setVariable(prefix + "failedActivity", "APP-C")\r
- \r
- ApplicationControllerSupport support = new ApplicationControllerSupport()\r
- appcClient.appCSupport=support\r
- org.springframework.test.util.ReflectionTestUtils.setField(support, "lcmModelPackage", "org.openecomp.appc.client.lcm.model");\r
- Flags flags = new Flags();\r
- ActionIdentifiers actionIdentifiers = new ActionIdentifiers();\r
- actionIdentifiers.setVnfId(vnfId);\r
- Status appcStatus\r
+ execution.setVariable("failedActivity", "APP-C")\r
+ execution.setVariable("workStep", action.toString() + "VNF")\r
+ \r
+ ApplicationControllerOrchestrator appcClient = new ApplicationControllerOrchestrator() \r
+ Status appcStatus = null\r
switch(action) {\r
case Action.Lock:\r
- execution.setVariable(prefix + 'workStep', "LockVNF")\r
- appcStatus = appcClient.runCommand(Action.Lock,actionIdentifiers,flags,null,msoRequestId)\r
+ execution.setVariable('workStep', "LockVNF")\r
+ appcStatus = appcClient.runCommand(Action.Lock,msoRequestId,vnfId,null)\r
break\r
case Action.Unlock:\r
- execution.setVariable(prefix + 'workStep', "UnlockVNF")\r
- appcStatus = appcClient.runCommand(Action.Unlock,actionIdentifiers,flags,null,msoRequestId)\r
+ execution.setVariable('workStep', "UnlockVNF")\r
+ appcStatus = appcClient.runCommand(Action.Unlock,msoRequestId,vnfId,null)\r
break\r
case Action.HealthCheck:\r
- def healthCheckIndex = execution.getVariable(prefix + 'healthCheckIndex')\r
- execution.setVariable(prefix + 'workStep', "HealthCheckVNF" + healthCheckIndex)\r
- execution.setVariable(prefix + 'healthCheckIndex', healthCheckIndex + 1)\r
- appcStatus = appcClient.runCommand(Action.HealthCheck,actionIdentifiers,flags,null,msoRequestId)\r
+ def healthCheckIndex = execution.getVariable('healthCheckIndex')\r
+ execution.setVariable('workStep', "HealthCheckVNF" + healthCheckIndex)\r
+ execution.setVariable('healthCheckIndex', healthCheckIndex + 1)\r
+ appcStatus = appcClient.runCommand(Action.HealthCheck,msoRequestId,vnfId,null)\r
break\r
case Action.Start:\r
- execution.setVariable(prefix + 'workStep', "StartVNF")\r
- appcStatus = appcClient.runCommand(Action.Start,actionIdentifiers,flags,null,msoRequestId)\r
+ execution.setVariable('workStep', "StartVNF")\r
+ appcStatus = appcClient.runCommand(Action.Start,msoRequestId,vnfId,null)\r
break\r
case Action.Stop:\r
- execution.setVariable(prefix + 'workStep', "StopVNF")\r
- appcStatus = appcClient.runCommand(Action.Stop,actionIdentifiers,flags,null,msoRequestId)\r
+ execution.setVariable('workStep', "StopVNF")\r
+ appcStatus = appcClient.runCommand(Action.Stop,msoRequestId,vnfId,null)\r
break\r
default:\r
break\r
logDebug("AppC status code is: " + appcCode, isDebugLogEnabled)\r
logDebug("AppC status message is: " + appcStatus.getMessage(), isDebugLogEnabled)\r
if (support.getCategoryOf(appcStatus) == ApplicationControllerSupport.StatusCategory.ERROR) {\r
- execution.setVariable(prefix + "errorCode", Integer.toString(appcCode))\r
- execution.setVariable(prefix + "errorText", appcStatus.getMessage())\r
+ execution.setVariable("errorCode", Integer.toString(appcCode))\r
+ execution.setVariable("errorText", appcStatus.getMessage())\r
}\r
+ \r
logDebug('Exited ' + method, isDebugLogEnabled)\r
} catch (BpmnError e) {\r
logError('Caught exception in ' + method, e)\r
- execution.setVariable(prefix + "errorCode", "1002")\r
- execution.setVariable(prefix + "errorText", e.getMessage())\r
- //throw e;\r
+ execution.setVariable("errorCode", "1002")\r
+ execution.setVariable("errorText", e.getMessage()) \r
} catch (java.lang.NoSuchMethodError e) {\r
logError('Caught exception in ' + method, e)\r
- execution.setVariable(prefix + "errorCode", "1002")\r
- execution.setVariable(prefix + "errorText", e.getMessage())\r
- //throw e;\r
+ execution.setVariable("errorCode", "1002")\r
+ execution.setVariable("errorText", e.getMessage()) \r
} catch (Exception e) {\r
logError('Caught exception in ' + method, e)\r
- execution.setVariable(prefix + "errorCode", "1002")\r
- execution.setVariable(prefix + "errorText", e.getMessage())\r
- \r
- //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in ' + method + ': ' + e.getMessage())\r
+ execution.setVariable("errorCode", "1002")\r
+ execution.setVariable("errorText", e.getMessage()) \r
}\r
}\r
\r
\r
\r
-\r
- /**\r
- * Builds a "CompletionHandler" request and stores it in the specified execution variable.\r
- *\r
- * @param execution the execution\r
- * @param resultVar the execution variable in which the result will be stored\r
- */\r
- public void completionHandlerPrep(Execution execution, String resultVar) {\r
- def method = getClass().getSimpleName() + '.completionHandlerPrep(' +\r
- 'execution=' + execution.getId() +\r
- ', resultVar=' + resultVar +\r
- ')'\r
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')\r
- logDebug('Entered ' + method, isDebugLogEnabled)\r
-\r
- try {\r
- def requestInfo = getVariable(execution, 'RPLVnfI_requestInfo')\r
- \r
- appcClient.shutdownclient()\r
-\r
- String content = """\r
- <sdncadapterworkflow:MsoCompletionRequest xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"\r
- xmlns:reqtype="http://org.openecomp/mso/request/types/v1">\r
- ${requestInfo}\r
- <sdncadapterworkflow:mso-bpel-name>MSO_ACTIVATE_BPEL</sdncadapterworkflow:mso-bpel-name>\r
- </sdncadapterworkflow:MsoCompletionRequest>\r
- """\r
-\r
- content = utils.formatXml(content)\r
- logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled)\r
- execution.setVariable(resultVar, content)\r
-\r
- logDebug('Exited ' + method, isDebugLogEnabled)\r
- } catch (BpmnError e) {\r
- throw e;\r
- } catch (Exception e) {\r
- logError('Caught exception in ' + method, e)\r
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error')\r
- }\r
- }\r
- \r
/**\r
* Prepare DoDeleteVnfAndModules call.\r
*\r
*\r
* @param execution The flow's execution instance.\r
*/\r
- public void prepDoDeleteVnfAndModules(Execution execution) {\r
+ public void prepDoDeleteVnfAndModules(DelegateExecution execution) {\r
def method = getClass().getSimpleName() + '.prepDoDeleteVnfAndModules(' +\r
'execution=' + execution.getId() +\r
')'\r
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') \r
- execution.setVariable(prefix + 'errorCode', "0")\r
+ execution.setVariable('errorCode', "0")\r
logDebug('Entered ' + method, isDebugLogEnabled)\r
- execution.setVariable(prefix + "workStep", "doDeleteVnfAndModules")\r
+ execution.setVariable("workStep", "doDeleteVnfAndModules")\r
execution.setVariable("failedActivity", "MSO Delete VNF")\r
logDebug('Exited ' + method, isDebugLogEnabled)\r
\r
*\r
* @param execution The flow's execution instance.\r
*/\r
- public void prepDoCreateVnfAndModules(Execution execution) {\r
+ public void prepDoCreateVnfAndModules(DelegateExecution execution) {\r
def method = getClass().getSimpleName() + '.prepDoReplaceVnfAndModules(' +\r
'execution=' + execution.getId() +\r
')'\r
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')\r
- execution.setVariable(prefix + 'errorCode', "0")\r
+ execution.setVariable('errorCode', "0")\r
logDebug('Entered ' + method, isDebugLogEnabled)\r
- execution.setVariable(prefix + "workStep", "doReplaceVnfAndModules")\r
- execution.setVariable("failedActivity", "MSO Replace VNF")\r
+ execution.setVariable("workStep", "doCreateVnfAndModules")\r
+ execution.setVariable("failedActivity", "MSO Create VNF")\r
logDebug('Exited ' + method, isDebugLogEnabled)\r
\r
}\r
\r
- /**\r
- * Builds a "FalloutHandler" request and stores it in the specified execution variable.\r
- *\r
- * @param execution the execution\r
- * @param resultVar the execution variable in which the result will be stored\r
- */\r
- public void falloutHandlerPrep(Execution execution, String resultVar) {\r
- def method = getClass().getSimpleName() + '.falloutHandlerPrep(' +\r
- 'execution=' + execution.getId() +\r
- ', resultVar=' + resultVar +\r
- ')'\r
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')\r
- logDebug('Entered ' + method, isDebugLogEnabled)\r
-\r
- try {\r
- def prefix = execution.getVariable('prefix')\r
- def request = getVariable(execution, prefix+'Request')\r
- def requestInformation = execution.getVariable(prefix + "requestInfo") \r
- \r
- appcClient.shutdownclient()\r
-\r
- def WorkflowException workflowException = execution.getVariable("WorkflowException")\r
- def errorResponseCode = workflowException.getErrorCode()\r
- def errorResponseMsg = workflowException.getErrorMessage()\r
- def encErrorResponseMsg = ""\r
- if (errorResponseMsg != null) {\r
- encErrorResponseMsg = errorResponseMsg.replace("&", "&").replace("<", "<").replace(">", ">")\r
- }\r
-\r
- String content = """\r
- <sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"\r
- xmlns:reqtype="http://org.openecomp/mso/request/types/v1"\r
- xmlns:msoservtypes="http://org.openecomp/mso/request/types/v1"\r
- xmlns:structuredtypes="http://org.openecomp/mso/structured/types/v1">\r
- ${requestInformation}\r
- <sdncadapterworkflow:WorkflowException>\r
- <sdncadapterworkflow:ErrorMessage>${encErrorResponseMsg}</sdncadapterworkflow:ErrorMessage>\r
- <sdncadapterworkflow:ErrorCode>${errorResponseCode}</sdncadapterworkflow:ErrorCode>\r
- </sdncadapterworkflow:WorkflowException>\r
- </sdncadapterworkflow:FalloutHandlerRequest>\r
- """\r
- content = utils.formatXml(content)\r
- logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled)\r
- execution.setVariable(resultVar, content)\r
-\r
- logDebug('Exited ' + method, isDebugLogEnabled)\r
- } catch (BpmnError e) {\r
- throw e;\r
- } catch (Exception e) {\r
- logError('Caught exception in ' + method, e)\r
- exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error')\r
- }\r
- }\r
\r
/**\r
* Handle Abort disposition from RainyDayHandler\r
* \r
* @param execution The flow's execution instance. \r
*/\r
- public void abortProcessing(Execution execution) {\r
+ public void abortProcessing(DelegateExecution execution) {\r
def method = getClass().getSimpleName() + '.abortProcessing(' +\r
'execution=' + execution.getId() +\r
')'\r
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')\r
logDebug('Entered ' + method, isDebugLogEnabled)\r
\r
- def errorText = execution.getVariable(prefix + "errorText")\r
- def errorCode = execution.getVariable(prefix + "errorCode")\r
+ def errorText = execution.getVariable("errorText")\r
+ def errorCode = execution.getVariable("errorCode")\r
\r
exceptionUtil.buildAndThrowWorkflowException(execution, errorCode as Integer, errorText)\r
}\r
*\r
* @param execution The flow's execution instance.\r
*/\r
- public void manualProcessing(Execution execution) {\r
+ public void manualProcessing(DelegateExecution execution) {\r
def method = getClass().getSimpleName() + '.manualProcessing(' +\r
'execution=' + execution.getId() +\r
')'\r
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')\r
logDebug('Entered ' + method, isDebugLogEnabled)\r
\r
- def taskId = execution.getVariable("RPLVnfI_taskId")\r
+ def taskId = execution.getVariable("taskId")\r
\r
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Processing halted - manual task created: " + taskId)\r
}\r