From 7b73b4999eb7d0b6c762307bf97bb106494f3a28 Mon Sep 17 00:00:00 2001 From: "k.kedron" Date: Tue, 27 Jul 2021 17:45:40 +0200 Subject: Fix ControllerExecutionBB flow. Adding the condition block on the end, like in the CDS actor path. Issue-ID: SO-3719 Signed-off-by: Krystian Kedron Change-Id: I3ff8f4b63fda8e4404594b630fb6e5411540c697 (cherry picked from commit 5aec6989f31a3074d65e5bea3aa203f6130c3cc1) --- .../BuildingBlock/ControllerExecutionBB.bpmn | 187 +++++++++++---------- .../flowspecific/tasks/GenericVnfHealthCheck.java | 21 ++- 2 files changed, 114 insertions(+), 94 deletions(-) diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ControllerExecutionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ControllerExecutionBB.bpmn index c46d504186..94c32cc4a6 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ControllerExecutionBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ControllerExecutionBB.bpmn @@ -7,7 +7,7 @@ SequenceFlow_1mkhog2 - SequenceFlow_0no1qag + Flow_0qmjpxv @@ -24,7 +24,7 @@ SequenceFlow_07tqu82 SequenceFlow_15gxql1 - + #{execution.getVariable("ControllerStatus").equals("Success")} @@ -46,6 +46,7 @@ + @@ -53,10 +54,9 @@ SequenceFlow_0fv03vt SequenceFlow_0no1qag - SequenceFlow_0op5irz - + SequenceFlow_1t7hs4k @@ -66,33 +66,94 @@ SequenceFlow_0op5irz - + - ${execution.getVariable("actor") == "CDS"} + #{execution.getVariable("actor") == "CDS"} + + + SequenceFlow_0no1qag + SequenceFlow_0op5irz + Flow_0qmjpxv + + + #{execution.getVariable("ControllerStatus").equals("Success")} - - + + + - + - - - - + + + + + - + - - + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -101,16 +162,28 @@ - - - - - - + + + - + + + + + + + + + + + + + + + + @@ -120,26 +193,12 @@ - - - - - - - - - - - - - - @@ -149,63 +208,21 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + + + diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java index 2d39cc185e..76c67eefc5 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java @@ -21,11 +21,12 @@ */ package org.onap.so.bpmn.infrastructure.flowspecific.tasks; +import static org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.common.SoPropertyConstants.CONTROLLER_STATUS; import java.util.HashMap; import java.util.Optional; -import org.onap.so.logger.LoggingAnchor; import org.camunda.bpm.engine.delegate.BpmnError; import org.onap.appc.client.lcm.model.Action; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; @@ -33,9 +34,9 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.appc.ApplicationControllerAction; import org.onap.so.client.exception.ExceptionBuilder; -import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.catalog.beans.ControllerSelectionReference; -import org.onap.logging.filter.base.ErrorCode; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -90,13 +91,12 @@ public class GenericVnfHealthCheck { public void callAppcClient(BuildingBlockExecution execution) { logger.trace("Start runAppcCommand "); String appcCode = "1002"; - String appcMessage = ""; + String appcMessage; try { - Action action = null; - action = Action.valueOf(execution.getVariable("action")); + Action action = Action.valueOf(execution.getVariable("action")); String msoRequestId = execution.getVariable("msoRequestId"); String vnfId = execution.getVariable("vnfId"); - Optional payload = null; + Optional payload = Optional.empty(); if (execution.getVariable("payload") != null) { String pay = execution.getVariable("payload"); payload = Optional.of(pay); @@ -108,7 +108,7 @@ public class GenericVnfHealthCheck { payloadInfo.put(OAM_IP_ADDRESS, execution.getVariable(OAM_IP_ADDRESS)); payloadInfo.put(VNF_HOST_IP_ADDRESS, execution.getVariable(VNF_HOST_IP_ADDRESS)); - logger.debug("Running APP-C action: {}", action.toString()); + logger.debug("Running APP-C action: {}", action); logger.debug("VNFID: {}", vnfId); // PayloadInfo contains extra information that adds on to payload before making request to appc appCClient.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType); @@ -134,11 +134,14 @@ public class GenericVnfHealthCheck { exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); } } + logger.error("Error Message: " + appcMessage); logger.error("ERROR CODE: " + appcCode); - logger.trace("End of runAppCommand "); if (appcCode != null && !("0").equals(appcCode)) { exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); } + + execution.setVariable(CONTROLLER_STATUS, "Success"); + logger.debug("Successfully end of runAppCommand "); } } -- cgit 1.2.3-korg