import java.util.UUID;\r
\r
import org.camunda.bpm.engine.delegate.BpmnError\r
-import org.camunda.bpm.engine.runtime.Execution\r
+import org.camunda.bpm.engine.delegate.DelegateExecution\r
import org.apache.commons.lang3.*\r
import org.apache.commons.codec.binary.Base64;\r
\r
* Perform initial processing, such as request validation, initialization of variables, etc.\r
* * @param execution\r
*/\r
- public void preProcessRequest(Execution execution) {\r
+ public void preProcessRequest(DelegateExecution execution) {\r
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
preProcessRequest(execution, isDebugEnabled)\r
}\r
\r
- public void preProcessRequest(Execution execution, isDebugLogEnabled) {\r
+ public void preProcessRequest(DelegateExecution execution, isDebugLogEnabled) {\r
\r
execution.setVariable("prefix",prefix)\r
execution.setVariable(prefix+'SuccessIndicator', false)\r
* @param execution\r
* @param isDebugLogEnabled\r
*/\r
- public void displayInput(Execution execution, isDebugLogEnabled) {\r
+ public void displayInput(DelegateExecution execution, isDebugLogEnabled) {\r
def input = ['mso-request-id', 'msoRequestId', 'isDebugLogEnabled', 'disableRollback', 'failIfExists', 'serviceInstanceId',\r
'vnfId', 'vnfName', 'tenantId', 'volumeGroupId', 'volumeGroupName', 'lcpCloudRegionId', 'vnfType', 'vfModuleModelInfo', 'asdcServiceModelVersion',\r
'test-volume-group-name', 'test-volume-group-id', 'vfModuleInputParams']\r
* @param execution\r
* @param isDebugEnabled\r
*/\r
- public void setRollbackData(Execution execution, isDebugEnabled) {\r
+ public void setRollbackData(DelegateExecution execution, isDebugEnabled) {\r
def rollbackData = execution.getVariable("rollbackData")\r
if (rollbackData == null) {\r
rollbackData = new RollbackData()\r
* @param execution\r
* @param isDebugEnabled\r
*/\r
- public void validateGetServiceInstanceCall(Execution execution, isDebugEnabled) {\r
+ public void validateGetServiceInstanceCall(DelegateExecution execution, isDebugEnabled) {\r
def found = execution.getVariable('GENGS_FoundIndicator')\r
def success = execution.getVariable('GENGS_SuccessIndicator')\r
def serviceInstanceId = execution.getVariable('serviceInstanceId')\r
* @param execution\r
* @param isDebugEnabled\r
*/\r
- public void callRESTQueryAAICloudRegion (Execution execution, isDebugEnabled) {\r
+ public void callRESTQueryAAICloudRegion (DelegateExecution execution, isDebugEnabled) {\r
\r
def cloudRegion = execution.getVariable("lcpCloudRegionId")\r
utils.log("DEBUG", 'Request cloud region is: ' + cloudRegion, isDebugEnabled)\r
* @param execution\r
* @param isDebugEnabled\r
*/\r
- public void callRESTQueryAAIVolGrpName(Execution execution, isDebugEnabled) {\r
+ public void callRESTQueryAAIVolGrpName(DelegateExecution execution, isDebugEnabled) {\r
\r
def volumeGroupName = execution.getVariable('volumeGroupName')\r
def cloudRegion = execution.getVariable('lcpCloudRegionId')\r
* @param execution\r
* @param isDebugEnabled\r
*/\r
- public void buildWorkflowException(Execution execution, int errorCode, errorMessage, isDebugEnabled) {\r
+ public void buildWorkflowException(DelegateExecution execution, int errorCode, errorMessage, isDebugEnabled) {\r
utils.log("DEBUG", errorMessage, isDebugEnabled)\r
(new ExceptionUtil()).buildWorkflowException(execution, 2500, errorMessage)\r
}\r
* @param execution\r
* @param isDebugEnabled\r
*/\r
- public void handleError(Execution execution, isDebugEnabled) {\r
+ public void handleError(DelegateExecution execution, isDebugEnabled) {\r
WorkflowException we = execution.getVariable('WorkflowException')\r
if (we == null) {\r
(new ExceptionUtil()).buildWorkflowException(execution, 2500, "Enexpected error encountered!")\r
* @param execution\r
* @param isDebugEnabled\r
*/\r
- public void callRESTCreateAAIVolGrpName(Execution execution, isDebugEnabled) {\r
+ public void callRESTCreateAAIVolGrpName(DelegateExecution execution, isDebugEnabled) {\r
\r
def vnfId = execution.getVariable('vnfId')\r
def volumeGroupId = execution.getVariable('volumeGroupId')\r
* Prepare VNF adapter create request XML\r
* @param execution\r
*/\r
- public void prepareVnfAdapterCreateRequest(Execution execution, isDebugEnabled) {\r
+ public void prepareVnfAdapterCreateRequest(DelegateExecution execution, isDebugEnabled) {\r
\r
def aaiGenericVnfResponse = execution.getVariable(prefix+'AAIQueryGenericVfnResponse')\r
def vnfId = utils.getNodeText1(aaiGenericVnfResponse, 'vnf-id')\r
execution.setVariable(prefix+"createVnfARequest", vnfSubCreateWorkflowRequestAsString)\r
\r
// build rollback request for use later if needed\r
- \r
- String vnfSubRollbackWorkflowRequest =\r
- """<rollbackVolumeGroupRequest>\r
- <cloudSiteId>${cloudSiteId}</cloudSiteId>\r
- <tenantId>${tenantId}</tenantId>\r
- <volumeGroupId>${volumeGroupId}</volumeGroupId>\r
- <skipAAI>true</skipAAI>\r
- <volumeGroupCreated>true</volumeGroupCreated>\r
- <msoRequest>\r
- <requestId>${requestId}</requestId>\r
- <serviceInstanceId>${serviceId}</serviceInstanceId>\r
- </msoRequest>\r
- <messageId>${messageId}</messageId>\r
- <notificationUrl>${notificationUrl}</notificationUrl>\r
- </rollbackVolumeGroupRequest>"""\r
+ String vnfSubRollbackWorkflowRequest = buildRollbackVolumeGroupRequestXml(volumeGroupId, cloudSiteId, tenantId, requestId, serviceId, messageId, notificationUrl)\r
\r
utils.log("DEBUG", "Sub Vnf flow rollback request: vnfSubRollbackWorkflowRequest " + "\n" + vnfSubRollbackWorkflowRequest, isDebugEnabled)\r
\r
String vnfSubRollbackWorkflowRequestAsString = utils.formatXml(vnfSubRollbackWorkflowRequest)\r
execution.setVariable(prefix+"rollbackVnfARequest", vnfSubRollbackWorkflowRequestAsString)\r
}\r
+ \r
+ public String buildRollbackVolumeGroupRequestXml(volumeGroupId, cloudSiteId, tenantId, requestId, serviceId, messageId, notificationUrl) {\r
+ \r
+ def request = """\r
+ <rollbackVolumeGroupRequest>\r
+ <volumeGroupRollback>\r
+ <volumeGroupId>${volumeGroupId}</volumeGroupId>\r
+ <volumeGroupStackId>{{VOLUMEGROUPSTACKID}}</volumeGroupStackId>\r
+ <tenantId>${tenantId}</tenantId>\r
+ <cloudSiteId>${cloudSiteId}</cloudSiteId>\r
+ <volumeGroupCreated>true</volumeGroupCreated>\r
+ <msoRequest>\r
+ <requestId>${requestId}</requestId>\r
+ <serviceInstanceId>${serviceId}</serviceInstanceId>\r
+ </msoRequest>\r
+ <messageId>${messageId}</messageId>\r
+ </volumeGroupRollback>\r
+ <skipAAI>true</skipAAI>\r
+ <notificationUrl>${notificationUrl}</notificationUrl>\r
+ </rollbackVolumeGroupRequest>\r
+ """ \r
+ \r
+ return request \r
+ }\r
\r
+ public String updateRollbackVolumeGroupRequestXml(String rollabackRequest, String heatStackId) {\r
+ String newRequest = rollabackRequest.replace("{{VOLUMEGROUPSTACKID}}", heatStackId)\r
+ return newRequest\r
+ }\r
\r
/**\r
* Validate VNF adapter response\r
* @param execution\r
*/\r
- public void validateVnfResponse(Execution execution, isDebugEnabled) {\r
+ public void validateVnfResponse(DelegateExecution execution, isDebugEnabled) {\r
def vnfSuccess = execution.getVariable('VNFREST_SuccessIndicator')\r
utils.log("DEBUG", "vnfAdapterSuccessIndicator: "+ vnfSuccess, isDebugEnabled)\r
if(vnfSuccess==true) {\r
- def vnfRollbackRequest = execution.getVariable(prefix+"rollbackVnfARequest")\r
- utils.log("DEBUG", "vnfAdapter rollback request: "+ vnfRollbackRequest, isDebugEnabled)\r
+ String createVnfAResponse = execution.getVariable(prefix+"createVnfAResponse")\r
+ String heatStackID = utils.getNodeText1(createVnfAResponse, "volumeGroupStackId")\r
+ String vnfRollbackRequest = execution.getVariable(prefix+"rollbackVnfARequest")\r
+ String updatedVnfRollbackRequest = updateRollbackVolumeGroupRequestXml(vnfRollbackRequest, heatStackID)\r
+ utils.log("DEBUG", "vnfAdapter rollback request: "+ updatedVnfRollbackRequest, isDebugEnabled)\r
RollbackData rollbackData = execution.getVariable("rollbackData")\r
- rollbackData.put("DCVFMODULEVOL", "rollbackVnfARequest", vnfRollbackRequest)\r
+ rollbackData.put("DCVFMODULEVOL", "rollbackVnfARequest", updatedVnfRollbackRequest)\r
rollbackData.put("DCVFMODULEVOL", "isCreateVnfRollbackNeeded", "true")\r
}\r
-\r
}\r
\r
\r
* @param execution\r
* @param isDebugEnabled\r
*/\r
- public void callRESTUpdateCreatedVolGrpName(Execution execution, isDebugEnabled) {\r
+ public void callRESTUpdateCreatedVolGrpName(DelegateExecution execution, isDebugEnabled) {\r
\r
String requeryAAIVolGrpNameResponse = execution.getVariable(prefix+"queryAAIVolGrpNameResponse")\r
String volumeGroupId = utils.getNodeText1(requeryAAIVolGrpNameResponse, "volume-group-id")\r
* @param execution\r
* @param isDebugEnabled\r
*/\r
- public void callRESTQueryAAIGenericVnf(Execution execution, isDebugEnabled) {\r
+ public void callRESTQueryAAIGenericVnf(DelegateExecution execution, isDebugEnabled) {\r
\r
def vnfId = execution.getVariable('vnfId')\r
\r