Fix ControllerExecutionBB flow. 84/122884/1
authork.kedron <k.kedron@partner.samsung.com>
Tue, 27 Jul 2021 15:45:40 +0000 (17:45 +0200)
committerk.kedron <k.kedron@partner.samsung.com>
Tue, 27 Jul 2021 15:45:40 +0000 (17:45 +0200)
Adding the condition block on the end,
like in the CDS actor path.

Issue-ID: SO-3719
Signed-off-by: Krystian Kedron <k.kedron@partner.samsung.com>
Change-Id: I3ff8f4b63fda8e4404594b630fb6e5411540c697

bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ControllerExecutionBB.bpmn
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java

index 1935c5b..065d7e0 100644 (file)
@@ -7,7 +7,7 @@
     <bpmn:sequenceFlow id="SequenceFlow_0gmfit3" sourceRef="StartEvent_1" targetRef="ServiceTask_0inxg9l" />
     <bpmn:endEvent id="EndEvent_0lgvk82">
       <bpmn:incoming>SequenceFlow_1mkhog2</bpmn:incoming>
-      <bpmn:incoming>SequenceFlow_0no1qag</bpmn:incoming>
+      <bpmn:incoming>Flow_0qmjpxv</bpmn:incoming>
     </bpmn:endEvent>
     <bpmn:sequenceFlow id="SequenceFlow_1mkhog2" sourceRef="Task_1hs1mn0" targetRef="EndEvent_0lgvk82" />
     <bpmn:serviceTask id="Task_1hs1mn0" name="Update AAI" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatus(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)), execution.getVariable(&#34;scope&#34;), execution.getVariable(&#34;action&#34;))}">
@@ -24,7 +24,7 @@
       <bpmn:outgoing>SequenceFlow_07tqu82</bpmn:outgoing>
       <bpmn:outgoing>SequenceFlow_15gxql1</bpmn:outgoing>
     </bpmn:exclusiveGateway>
-    <bpmn:sequenceFlow id="SequenceFlow_07tqu82" name="success" sourceRef="ExclusiveGateway_13q340y" targetRef="Task_1hs1mn0">
+    <bpmn:sequenceFlow id="SequenceFlow_07tqu82" name="successCDS" sourceRef="ExclusiveGateway_13q340y" targetRef="Task_1hs1mn0">
       <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
     </bpmn:sequenceFlow>
     <bpmn:endEvent id="EndEvent_0mnaj50">
@@ -47,6 +47,7 @@
         <camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
         <camunda:out source="WorkflowException" target="WorkflowException" />
         <camunda:out source="WorkflowExceptionErrorMessage" target="WorkflowExceptionErrorMessage" />
+        <camunda:out source="ControllerStatus" target="ControllerStatus" />
         <camunda:in source="executionObject" target="executionObject" />
         <camunda:in source="mso-request-id" target="mso-request-id" />
         <camunda:in source="isRollback" target="isRollback" />
       </bpmn:extensionElements>
       <bpmn:incoming>SequenceFlow_0fv03vt</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0no1qag</bpmn:outgoing>
-      <bpmn:outgoing>SequenceFlow_0op5irz</bpmn:outgoing>
     </bpmn:callActivity>
     <bpmn:sequenceFlow id="SequenceFlow_1t7hs4k" sourceRef="ExclusiveGateway_0plxwkg" targetRef="Task_1rc2j9" />
-    <bpmn:sequenceFlow id="SequenceFlow_0no1qag" sourceRef="BBToExecute" targetRef="EndEvent_0lgvk82" />
+    <bpmn:sequenceFlow id="SequenceFlow_0no1qag" sourceRef="BBToExecute" targetRef="Gateway_065nxpu" />
     <bpmn:sequenceFlow id="SequenceFlow_0fv03vt" sourceRef="Task_1rc2j9" targetRef="BBToExecute" />
     <bpmn:serviceTask id="Task_1rc2j9" name="select BB " camunda:expression="${ControllerExecution.selectBB(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
       <bpmn:incoming>SequenceFlow_1t7hs4k</bpmn:incoming>
       <bpmn:incoming>SequenceFlow_0op5irz</bpmn:incoming>
       <bpmn:errorEventDefinition id="ErrorEventDefinition_0z001cu" errorRef="Error_0aovtfv" />
     </bpmn:endEvent>
-    <bpmn:sequenceFlow id="SequenceFlow_0op5irz" sourceRef="BBToExecute" targetRef="EndEvent_1lxwuh2" />
+    <bpmn:sequenceFlow id="SequenceFlow_0op5irz" sourceRef="Gateway_065nxpu" targetRef="EndEvent_1lxwuh2" />
     <bpmn:sequenceFlow id="SequenceFlow_0vzx2yr" name="Actor= CDS" sourceRef="ExclusiveGateway_0plxwkg" targetRef="Task_0bhf6tp">
-      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("actor") == "CDS"}</bpmn:conditionExpression>
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("actor") == "CDS"}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:exclusiveGateway id="Gateway_065nxpu" default="SequenceFlow_0op5irz">
+      <bpmn:incoming>SequenceFlow_0no1qag</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0op5irz</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0qmjpxv</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_0qmjpxv" name="success" sourceRef="Gateway_065nxpu" targetRef="EndEvent_0lgvk82">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
     </bpmn:sequenceFlow>
   </bpmn:process>
   <bpmn:error id="Error_0aovtfv" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ControllerExecutionBB">
-      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
-        <dc:Bounds x="160" y="323" width="36" height="36" />
+      <bpmndi:BPMNEdge id="Flow_0qmjpxv_di" bpmnElement="Flow_0qmjpxv">
+        <di:waypoint x="1147" y="233" />
+        <di:waypoint x="1147" y="323" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="-17" y="279" width="90" height="20" />
+          <dc:Bounds x="1170" y="263" width="41" height="14" />
         </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0gmfit3_di" bpmnElement="SequenceFlow_0gmfit3">
-        <di:waypoint x="196" y="341" />
-        <di:waypoint x="259" y="341" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0vzx2yr_di" bpmnElement="SequenceFlow_0vzx2yr">
+        <di:waypoint x="424" y="366" />
+        <di:waypoint x="424" y="462" />
+        <di:waypoint x="572" y="462" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="32.5" y="236" width="90" height="20" />
+          <dc:Bounds x="455" y="436" width="60" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="EndEvent_0lgvk82_di" bpmnElement="EndEvent_0lgvk82">
-        <dc:Bounds x="1129" y="323" width="36" height="36" />
+      <bpmndi:BPMNEdge id="SequenceFlow_0op5irz_di" bpmnElement="SequenceFlow_0op5irz">
+        <di:waypoint x="1147" y="183" />
+        <di:waypoint x="1147" y="128" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1025" y="251" width="90" height="20" />
+          <dc:Bounds x="739" y="58" width="0" height="12" />
         </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0fv03vt_di" bpmnElement="SequenceFlow_0fv03vt">
+        <di:waypoint x="672" y="208" />
+        <di:waypoint x="824" y="208" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="598" y="107" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0no1qag_di" bpmnElement="SequenceFlow_0no1qag">
+        <di:waypoint x="924" y="208" />
+        <di:waypoint x="1122" y="208" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="840.5" y="107" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1t7hs4k_di" bpmnElement="SequenceFlow_1t7hs4k">
+        <di:waypoint x="424" y="316" />
+        <di:waypoint x="424" y="208" />
+        <di:waypoint x="572" y="208" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="271" y="89" width="83" height="36" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1lspfyy_di" bpmnElement="SequenceFlow_1lspfyy">
+        <di:waypoint x="359" y="341" />
+        <di:waypoint x="399" y="341" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="229" y="240" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_15gxql1_di" bpmnElement="SequenceFlow_15gxql1">
+        <di:waypoint x="893" y="487" />
+        <di:waypoint x="893" y="565" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="713" y="436" width="90" height="20" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_07tqu82_di" bpmnElement="SequenceFlow_07tqu82">
+        <di:waypoint x="918" y="462" />
+        <di:waypoint x="979" y="462" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="908" y="443" width="64" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_05qembo_di" bpmnElement="SequenceFlow_05qembo">
+        <di:waypoint x="672" y="462" />
+        <di:waypoint x="868" y="462" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="725" y="437" width="90" height="20" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1mkhog2_di" bpmnElement="SequenceFlow_1mkhog2">
         <di:waypoint x="1079" y="462" />
         <di:waypoint x="1147" y="462" />
           <dc:Bounds x="918" y="357" width="90" height="20" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ServiceTask_0404s6a_di" bpmnElement="Task_1hs1mn0">
-        <dc:Bounds x="979" y="422" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_05qembo_di" bpmnElement="SequenceFlow_05qembo">
-        <di:waypoint x="672" y="462" />
-        <di:waypoint x="868" y="462" />
+      <bpmndi:BPMNEdge id="SequenceFlow_0gmfit3_di" bpmnElement="SequenceFlow_0gmfit3">
+        <di:waypoint x="196" y="341" />
+        <di:waypoint x="259" y="341" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="725" y="437" width="90" height="20" />
+          <dc:Bounds x="32.5" y="236" width="90" height="20" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+        <dc:Bounds x="160" y="323" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="-17" y="279" width="90" height="20" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_0lgvk82_di" bpmnElement="EndEvent_0lgvk82">
+        <dc:Bounds x="1129" y="323" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1025" y="251" width="90" height="20" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ServiceTask_0404s6a_di" bpmnElement="Task_1hs1mn0">
+        <dc:Bounds x="979" y="422" width="100" height="80" />
+      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ServiceTask_01mv1si_di" bpmnElement="Task_0bhf6tp">
         <dc:Bounds x="572" y="422" width="100" height="80" />
       </bpmndi:BPMNShape>
           <dc:Bounds x="698" y="327" width="90" height="20" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_07tqu82_di" bpmnElement="SequenceFlow_07tqu82">
-        <di:waypoint x="918" y="462" />
-        <di:waypoint x="979" y="462" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="856" y="409" width="41" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="EndEvent_0mnaj50_di" bpmnElement="EndEvent_0mnaj50">
         <dc:Bounds x="875" y="565" width="36" height="36" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="698" y="531" width="90" height="20" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_15gxql1_di" bpmnElement="SequenceFlow_15gxql1">
-        <di:waypoint x="893" y="487" />
-        <di:waypoint x="893" y="565" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="713" y="436" width="90" height="20" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ServiceTask_0inxg9l_di" bpmnElement="ServiceTask_0inxg9l">
         <dc:Bounds x="259" y="301" width="100" height="80" />
       </bpmndi:BPMNShape>
           <dc:Bounds x="309" y="255" width="0" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1lspfyy_di" bpmnElement="SequenceFlow_1lspfyy">
-        <di:waypoint x="359" y="341" />
-        <di:waypoint x="399" y="341" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="229" y="240" width="0" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="CallActivity_01dem38_di" bpmnElement="BBToExecute">
         <dc:Bounds x="824" y="168" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1t7hs4k_di" bpmnElement="SequenceFlow_1t7hs4k">
-        <di:waypoint x="424" y="316" />
-        <di:waypoint x="424" y="208" />
-        <di:waypoint x="572" y="208" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="271" y="89" width="83" height="36" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0no1qag_di" bpmnElement="SequenceFlow_0no1qag">
-        <di:waypoint x="924" y="208" />
-        <di:waypoint x="1147" y="208" />
-        <di:waypoint x="1147" y="323" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="840.5" y="107" width="90" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0fv03vt_di" bpmnElement="SequenceFlow_0fv03vt">
-        <di:waypoint x="672" y="208" />
-        <di:waypoint x="824" y="208" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="598" y="107" width="0" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ServiceTask_0qd9p4w_di" bpmnElement="Task_1rc2j9">
         <dc:Bounds x="572" y="168" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_1lxwuh2_di" bpmnElement="EndEvent_1lxwuh2">
-        <dc:Bounds x="856" y="84" width="36" height="36" />
+        <dc:Bounds x="1129" y="92" width="36" height="36" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="679" y="50" width="0" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0op5irz_di" bpmnElement="SequenceFlow_0op5irz">
-        <di:waypoint x="874" y="168" />
-        <di:waypoint x="874" y="120" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="739" y="58" width="0" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0vzx2yr_di" bpmnElement="SequenceFlow_0vzx2yr">
-        <di:waypoint x="424" y="366" />
-        <di:waypoint x="424" y="462" />
-        <di:waypoint x="572" y="462" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="455" y="436" width="60" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Gateway_065nxpu_di" bpmnElement="Gateway_065nxpu" isMarkerVisible="true">
+        <dc:Bounds x="1122" y="183" width="50" height="50" />
+      </bpmndi:BPMNShape>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn:definitions>
index 2d39cc1..76c67ee 100644 (file)
  */
 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<String> payload = null;
+            Optional<String> 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 ");
     }
 }