diff options
8 files changed, 82 insertions, 56 deletions
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfDeleteBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfDeleteBB.bpmn index da3577ed61..09c9b69ccf 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfDeleteBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfDeleteBB.bpmn @@ -8,7 +8,7 @@ <bpmn:incoming>Flow_1s7gtbc</bpmn:incoming> </bpmn:endEvent> <bpmn:serviceTask id="invokeCnfmToDeleteAsInstnace" name="Invoke CNFM to DeleteASInstance" camunda:expression="${CnfDeleteTask.invokeCnfmToDeleteAsInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>Flow_0td4p22</bpmn:incoming> + <bpmn:incoming>Flow_00hczi1</bpmn:incoming> <bpmn:outgoing>Flow_1s7gtbc</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_016sgof" sourceRef="StartEvent_0ru3x55" targetRef="Activity_1uqgwny" /> @@ -22,10 +22,32 @@ <bpmn:incoming>SequenceFlow_016sgof</bpmn:incoming> <bpmn:outgoing>Flow_19rm5pn</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_0td4p22" sourceRef="invokeCnfmToTerminateAsInstnace" targetRef="invokeCnfmToDeleteAsInstnace" /> + <bpmn:sequenceFlow id="Flow_0td4p22" sourceRef="invokeCnfmToTerminateAsInstnace" targetRef="Monitor_Termination_Job" /> + <bpmn:callActivity id="Monitor_Termination_Job" name="Monitor Termination Job" calledElement="MonitorCnfmJob"> + <bpmn:extensionElements> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" /> + <camunda:out source="gBuildingBlockExecution" target="gBuildingBlockExecution" /> + <camunda:in source="CnfmStatusCheckUrl" target="CnfmStatusCheckUrl" /> + <camunda:out source="WorkflowExceptionErrorMessage" target="WorkflowExceptionErrorMessage" /> + <camunda:in source="MonitorJobName" target="MonitorJobName" /> + </bpmn:extensionElements> + <bpmn:incoming>Flow_0td4p22</bpmn:incoming> + <bpmn:outgoing>Flow_00hczi1</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="Flow_00hczi1" sourceRef="Monitor_Termination_Job" targetRef="invokeCnfmToDeleteAsInstnace" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CnfDeleteBB"> + <bpmndi:BPMNEdge id="Flow_00hczi1_di" bpmnElement="Flow_00hczi1"> + <di:waypoint x="640" y="140" /> + <di:waypoint x="710" y="140" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0td4p22_di" bpmnElement="Flow_0td4p22"> + <di:waypoint x="480" y="140" /> + <di:waypoint x="540" y="140" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_19rm5pn_di" bpmnElement="Flow_19rm5pn"> <di:waypoint x="320" y="140" /> <di:waypoint x="380" y="140" /> @@ -38,24 +60,23 @@ <di:waypoint x="178" y="140" /> <di:waypoint x="220" y="140" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0td4p22_di" bpmnElement="Flow_0td4p22"> - <di:waypoint x="480" y="140" /> - <di:waypoint x="710" y="140" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="StartEvent_0ru3x55_di" bpmnElement="StartEvent_0ru3x55"> <dc:Bounds x="142" y="122" width="36" height="36" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0ziu33x_di" bpmnElement="Activity_1uqgwny"> - <dc:Bounds x="220" y="100" width="100" height="80" /> + <bpmndi:BPMNShape id="EndEvent_001k15i_di" bpmnElement="EndEvent_001k15i"> + <dc:Bounds x="1022" y="122" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_11_di" bpmnElement="invokeCnfmToDeleteAsInstnace"> + <dc:Bounds x="710" y="100" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_06oby7l_di" bpmnElement="invokeCnfmToTerminateAsInstnace"> <dc:Bounds x="380" y="100" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_11_di" bpmnElement="invokeCnfmToDeleteAsInstnace"> - <dc:Bounds x="710" y="100" width="100" height="80" /> + <bpmndi:BPMNShape id="Activity_0ziu33x_di" bpmnElement="Activity_1uqgwny"> + <dc:Bounds x="220" y="100" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_001k15i_di" bpmnElement="EndEvent_001k15i"> - <dc:Bounds x="1022" y="122" width="36" height="36" /> + <bpmndi:BPMNShape id="CallActivity_0fuqfru_di" bpmnElement="Monitor_Termination_Job"> + <dc:Bounds x="540" y="100" width="100" height="80" /> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfInstantiateBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfInstantiateBB.bpmn index 6e1996acd8..d2d986e87b 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfInstantiateBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfInstantiateBB.bpmn @@ -36,6 +36,7 @@ <camunda:out source="gBuildingBlockExecution" target="gBuildingBlockExecution" /> <camunda:in source="CnfmStatusCheckUrl" target="CnfmStatusCheckUrl" /> <camunda:out source="WorkflowExceptionErrorMessage" target="WorkflowExceptionErrorMessage" /> + <camunda:in source="MonitorJobName" target="MonitorJobName" /> </bpmn:extensionElements> <bpmn:incoming>Flow_1xcu3yl</bpmn:incoming> <bpmn:outgoing>Flow_149m8py</bpmn:outgoing> @@ -44,6 +45,10 @@ </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CnfInstantiateBB"> + <bpmndi:BPMNEdge id="Flow_149m8py_di" bpmnElement="Flow_149m8py"> + <di:waypoint x="1000" y="117" /> + <di:waypoint x="1062" y="117" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1xcu3yl_di" bpmnElement="Flow_1xcu3yl"> <di:waypoint x="840" y="117" /> <di:waypoint x="900" y="117" /> @@ -64,31 +69,27 @@ <di:waypoint x="178" y="117" /> <di:waypoint x="240" y="117" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_149m8py_di" bpmnElement="Flow_149m8py"> - <di:waypoint x="1000" y="117" /> - <di:waypoint x="1062" y="117" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="StartEvent_0ru3x55_di" bpmnElement="StartEvent_0ru3x55"> <dc:Bounds x="142" y="99" width="36" height="36" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_001k15i_di" bpmnElement="EndEvent_001k15i"> + <dc:Bounds x="1062" y="99" width="36" height="36" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1jf7hlc_di" bpmnElement="ServiceTask_11"> <dc:Bounds x="240" y="77" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1y5x7jl_di" bpmnElement="Activity_1y5x7jl"> <dc:Bounds x="410" y="77" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0oa5fst_di" bpmnElement="Activity_0oa5fst"> - <dc:Bounds x="570" y="77" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_00w0lnj_di" bpmnElement="Activity_00w0lnj"> <dc:Bounds x="740" y="77" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0oa5fst_di" bpmnElement="Activity_0oa5fst"> + <dc:Bounds x="570" y="77" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0fuqfru_di" bpmnElement="CallActivity_0fuqfru"> <dc:Bounds x="900" y="77" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_001k15i_di" bpmnElement="EndEvent_001k15i"> - <dc:Bounds x="1062" y="99" width="36" height="36" /> - </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorCnfmJob.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorCnfmJob.bpmn index be683b9ca6..5fe2401180 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorCnfmJob.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorCnfmJob.bpmn @@ -30,14 +30,14 @@ </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_0s1plu9" sourceRef="StartEvent_01r97z2" targetRef="ServiceTask_17jlnng" /> <bpmn:sequenceFlow id="SequenceFlow_0etw572" sourceRef="IntermediateCatchEvent_1besn3n" targetRef="ServiceTask_17jlnng" /> - <bpmn:serviceTask id="ServiceTask_17jlnng" name=" Get Current Operation Status " camunda:asyncAfter="true" camunda:expression="${MonitorCnfmCreateJobTask.getCurrentOperationStatus(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="ServiceTask_17jlnng" name=" Get Current Operation Status " camunda:asyncAfter="true" camunda:expression="${MonitorCnfmJobTask.getCurrentOperationStatus(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0etw572</bpmn:incoming> <bpmn:incoming>SequenceFlow_0s1plu9</bpmn:incoming> <bpmn:outgoing>SequenceFlow_153a3kp</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1vmxw9g" sourceRef="ExclusiveGateway_1hkl6yy" targetRef="IntermediateCatchEvent_1besn3n" /> <bpmn:sequenceFlow id="SequenceFlow_0is7myf" sourceRef="ExclusiveGateway_1hkl6yy" targetRef="EndEvent_1ohsce9"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${MonitorCnfmCreateJobTask.hasOperationFinished(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}</bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${MonitorCnfmJobTask.hasOperationFinished(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_153a3kp" sourceRef="ServiceTask_17jlnng" targetRef="ExclusiveGateway_1hkl6yy" /> </bpmn:subProcess> @@ -54,12 +54,12 @@ <bpmn:sequenceFlow id="SequenceFlow_1v4yr3f" sourceRef="SubProcess_19j0v63" targetRef="ServiceTask_1gms128" /> <bpmn:sequenceFlow id="SequenceFlow_1i1o9sh" sourceRef="BoundaryEvent_0xiabzp" targetRef="ServiceTask_1s87b92" /> <bpmn:sequenceFlow id="SequenceFlow_1x3tbl0" sourceRef="StartEvent_1" targetRef="SubProcess_19j0v63" /> - <bpmn:serviceTask id="ServiceTask_1s87b92" name=" Time Out Log Failure " camunda:asyncAfter="true" camunda:expression="${MonitorCnfmCreateJobTask.timeOutLogFailue(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="ServiceTask_1s87b92" name=" Time Out Log Failure " camunda:asyncAfter="true" camunda:expression="${MonitorCnfmJobTask.timeOutLogFailue(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1i1o9sh</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0bcgtzj</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0bcgtzj" sourceRef="ServiceTask_1s87b92" targetRef="EndEvent_1w3t3t0" /> - <bpmn:serviceTask id="ServiceTask_1gms128" name=" Check if operation was successful " camunda:asyncAfter="true" camunda:expression="${MonitorCnfmCreateJobTask.checkIfOperationWasSuccessful(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="ServiceTask_1gms128" name=" Check if operation was successful " camunda:asyncAfter="true" camunda:expression="${MonitorCnfmJobTask.checkIfOperationWasSuccessful(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1v4yr3f</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1543qy7</bpmn:outgoing> </bpmn:serviceTask> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfDeleteTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfDeleteTask.java index 54b87ec2fe..ac204d448f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfDeleteTask.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfDeleteTask.java @@ -92,7 +92,7 @@ public class CnfDeleteTask { cnfmHttpServiceProvider.invokeTerminateAsRequest(asInstanceId, terminateAsRequest); execution.setVariable(CNFM_REQUEST_STATUS_CHECK_URL, terminateStatusCheck.orElseThrow(() -> new NoSuchElementException("Status check url Not found"))); - execution.setVariable(MONITOR_JOB_NAME, "Terminate"); + execution.setVariable(MONITOR_JOB_NAME, "Instantiate"); LOGGER.debug("Successfully invoked CNFM terminate AS request: {}", asInstanceId); } catch (final Exception exception) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfmHttpServiceProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfmHttpServiceProvider.java index 06784a0564..e196cc67d7 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfmHttpServiceProvider.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfmHttpServiceProvider.java @@ -39,7 +39,7 @@ public interface CnfmHttpServiceProvider { Optional<URI> invokeInstantiateAsRequest(InstantiateAsRequest instantiateAsRequest, String asInstanceId); - Optional<AsLcmOpOcc> getInstantiateOperationJobStatus(final String url); + Optional<AsLcmOpOcc> getOperationJobStatus(final String url); Optional<Boolean> invokeDeleteAsRequest(final String asInstanceId); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfmHttpServiceProviderImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfmHttpServiceProviderImpl.java index ed0bc3937b..a919503aff 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfmHttpServiceProviderImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfmHttpServiceProviderImpl.java @@ -113,7 +113,7 @@ public class CnfmHttpServiceProviderImpl implements CnfmHttpServiceProvider { } @Override - public Optional<AsLcmOpOcc> getInstantiateOperationJobStatus(final String url) { + public Optional<AsLcmOpOcc> getOperationJobStatus(final String url) { try { final ResponseEntity<AsLcmOpOcc> response = httpServiceProvider.getHttpResponse(url, AsLcmOpOcc.class); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/MonitorCnfmCreateJobTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/MonitorCnfmJobTask.java index 40a26cfaf9..72a5cbe1a2 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/MonitorCnfmCreateJobTask.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/MonitorCnfmJobTask.java @@ -19,13 +19,13 @@ */ package org.onap.so.bpmn.infrastructure.adapter.cnfm.tasks; -import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_CNF_STATUS_RESPONSE_PARAM_NAME; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CNF_STATUS_RESPONSE_PARAM_NAME; import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.OPERATION_STATUS_PARAM_NAME; import java.net.URI; -import java.util.NoSuchElementException; import java.util.Optional; import java.util.Set; +import org.camunda.bpm.engine.delegate.BpmnError; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.cnfm.lcm.model.AsLcmOpOcc; @@ -41,25 +41,25 @@ import org.springframework.stereotype.Component; * */ @Component -public class MonitorCnfmCreateJobTask { +public class MonitorCnfmJobTask { private static final String CNFM_REQUEST_STATUS_CHECK_URL = "CnfmStatusCheckUrl"; private static final String MONITOR_JOB_NAME = "MonitorJobName"; public static final Set<OperationStateEnum> OPERATION_FINISHED_STATES = Set.of(OperationStateEnum.COMPLETED, OperationStateEnum.FAILED, OperationStateEnum.ROLLED_BACK); - private static final Logger LOGGER = LoggerFactory.getLogger(MonitorCnfmCreateJobTask.class); + private static final Logger LOGGER = LoggerFactory.getLogger(MonitorCnfmJobTask.class); protected final ExceptionBuilder exceptionUtil; private final CnfmHttpServiceProvider cnfmHttpServiceProvider; @Autowired - public MonitorCnfmCreateJobTask(final CnfmHttpServiceProvider cnfmHttpServiceProvider, + public MonitorCnfmJobTask(final CnfmHttpServiceProvider cnfmHttpServiceProvider, final ExceptionBuilder exceptionUtil) { this.cnfmHttpServiceProvider = cnfmHttpServiceProvider; this.exceptionUtil = exceptionUtil; } /** - * Get the current operation status of instantiation job + * Get the current operation status of cnfm job * * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl} */ @@ -68,22 +68,24 @@ public class MonitorCnfmCreateJobTask { LOGGER.debug("Executing getCurrentOperationStatus ..."); final Optional<URI> operationStatusURL = Optional.of(execution.getVariable(CNFM_REQUEST_STATUS_CHECK_URL)); LOGGER.debug("Executing getCurrentOperationStatus for CNF... :{}", operationStatusURL); - final Optional<AsLcmOpOcc> instantiateOperationJobStatus = - cnfmHttpServiceProvider.getInstantiateOperationJobStatus(String.valueOf(operationStatusURL - .orElseThrow(() -> new NoSuchElementException("Operational Status check url Not found")))); - if (instantiateOperationJobStatus.isPresent()) { - final AsLcmOpOcc asLcmOpOccResponse = instantiateOperationJobStatus.get(); - if (asLcmOpOccResponse.getOperationState() != null) { - final OperationStateEnum operationStatus = asLcmOpOccResponse.getOperationState(); - LOGGER.debug("Operation {} with {} and operation retrieval status : {}", asLcmOpOccResponse.getId(), - operationStatus, asLcmOpOccResponse.getOperationState()); - execution.setVariable(OPERATION_STATUS_PARAM_NAME, asLcmOpOccResponse.getOperationState()); - } - LOGGER.debug("Operation {} without operationStatus and operation retrieval status :{}", - asLcmOpOccResponse.getId(), asLcmOpOccResponse.getOperationState()); + final Optional<AsLcmOpOcc> operationalJobStatus = + cnfmHttpServiceProvider.getOperationJobStatus(String.valueOf(operationStatusURL + .orElseThrow(() -> new BpmnError("Operational Status check url Not found")))); + + final AsLcmOpOcc asLcmOpOccResponse = operationalJobStatus + .orElseThrow(() -> new BpmnError("Unable to get operational Job status from the CNFM")); + + if (asLcmOpOccResponse.getOperationState() != null) { + final OperationStateEnum operationStatus = asLcmOpOccResponse.getOperationState(); + LOGGER.debug("Operation {} with {} and operation retrieval status : {}", asLcmOpOccResponse.getId(), + operationStatus, operationStatus); + execution.setVariable(OPERATION_STATUS_PARAM_NAME, operationStatus); + } else { + LOGGER.debug("Operation {} without operationStatus", asLcmOpOccResponse.getId()); + exceptionUtil.buildAndThrowWorkflowException(execution, 1206, + new Exception("Operation Status is empty")); } - execution.setVariable(CREATE_CNF_STATUS_RESPONSE_PARAM_NAME, - instantiateOperationJobStatus.isPresent() ? instantiateOperationJobStatus.get() : " "); + execution.setVariable(CNF_STATUS_RESPONSE_PARAM_NAME, asLcmOpOccResponse); LOGGER.debug("Finished executing getCurrentOperationStatus for CNF..."); } catch (final Exception exception) { LOGGER.error("Unable to invoke get current Operation status"); @@ -97,24 +99,26 @@ public class MonitorCnfmCreateJobTask { * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl} */ public void timeOutLogFailure(final BuildingBlockExecution execution) { - String message = "CNF" + execution.getVariable(MONITOR_JOB_NAME) + "operation time out"; + String message = "CNF" + execution.getVariable(MONITOR_JOB_NAME) + + "operation time out"; LOGGER.error(message); exceptionUtil.buildAndThrowWorkflowException(execution, 1205, new Exception(message)); } /** - * Check the final status of instantiation throw exception if not completed successfully + * Check the final status of cnfm job throw exception if not completed successfully * * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl} */ public void checkIfOperationWasSuccessful(final BuildingBlockExecution execution) { LOGGER.debug("Executing CNF checkIfOperationWasSuccessful ..."); final OperationStateEnum operationStatusOption = execution.getVariable(OPERATION_STATUS_PARAM_NAME); - final AsLcmOpOcc cnfInstantiateStautusResponse = execution.getVariable(CREATE_CNF_STATUS_RESPONSE_PARAM_NAME); + final AsLcmOpOcc cnfStautusResponse = execution.getVariable(CNF_STATUS_RESPONSE_PARAM_NAME); if ((operationStatusOption == OperationStateEnum.FAILED) || (operationStatusOption == OperationStateEnum.FAILED_TEMP)) { - final String message = "Unable to" + execution.getVariable(MONITOR_JOB_NAME) + "CNF jobId: " - + (cnfInstantiateStautusResponse != null ? cnfInstantiateStautusResponse.getId() : "null"); + final String message = + "Unable to" + execution.getVariable(MONITOR_JOB_NAME) + + "CNF jobId: " + (cnfStautusResponse != null ? cnfStautusResponse.getId() : "null"); LOGGER.error(message); exceptionUtil.buildAndThrowWorkflowException(execution, 1206, new Exception()); } else if ((operationStatusOption == OperationStateEnum.COMPLETED)) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java index 326e764321..6360736865 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java @@ -33,7 +33,7 @@ public class Constants { public static final String CREATE_VNF_REQUEST_PARAM_NAME = "createVnfRequest"; public static final String CREATE_VNF_RESPONSE_PARAM_NAME = "createVnfResponse"; - public static final String CREATE_CNF_STATUS_RESPONSE_PARAM_NAME = "createCnfStatusResponse"; + public static final String CNF_STATUS_RESPONSE_PARAM_NAME = "cnfStatusResponse"; public static final String INPUT_PARAMETER = "inputParameter"; public static final String DELETE_VNF_RESPONSE_PARAM_NAME = "deleteVnfResponse"; public static final String DELETE_VNF_NODE_STATUS = "deleteVnfNodeStatus"; |