aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-tasks')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfDeleteTask.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfmHttpServiceProvider.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfmHttpServiceProviderImpl.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/MonitorCnfmJobTask.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/MonitorCnfmCreateJobTask.java)56
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java2
5 files changed, 34 insertions, 30 deletions
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";