CNF Healthcheck query based on helm status 67/126067/3
authorsreejatechm <sg00744975@techmahindra.com>
Mon, 10 Jan 2022 06:56:46 +0000 (12:26 +0530)
committersreejatechm <sg00744975@techmahindra.com>
Mon, 10 Jan 2022 06:57:26 +0000 (12:27 +0530)
-Enhancement of CNFO model with helm upgrade
-Included code changes with respect to HealthCheckBB

Issue-ID: SO-3814
Signed-off-by: sreejatechm <sg00744975@techmahindra.com>
Change-Id: I44f11f156c132d713f42f0a855adb6730b7c6abe

bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HealthCheckBB.bpmn

index d39da5e..603e11d 100644 (file)
@@ -1250,7 +1250,7 @@ public class BBInputSetup implements JavaDelegate {
                 || requestAction.equalsIgnoreCase("activateFabricConfiguration")
                 || requestAction.equalsIgnoreCase("recreateInstance")
                 || requestAction.equalsIgnoreCase("replaceInstance")
-                || requestAction.equalsIgnoreCase("upgradeInstance")) {
+                || requestAction.equalsIgnoreCase("upgradeInstance") || requestAction.equalsIgnoreCase("healthCheck")) {
             return getGBBMacroExistingService(executeBB, lookupKeyMap, bbName, requestAction,
                     requestDetails.getCloudConfiguration());
         }
@@ -1564,6 +1564,9 @@ public class BBInputSetup implements JavaDelegate {
                     break;
                 }
             }
+        } else if (bbName.equals("HealthCheckBB")
+                && (VNF).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope())) {
+            this.setisHelmforHealthCheckBB(service, serviceInstance, gBB);
         }
         if (executeBB.getWorkflowResourceIds() != null) {
             parameter.setResourceId(executeBB.getWorkflowResourceIds().getNetworkCollectionId());
@@ -2112,6 +2115,28 @@ public class BBInputSetup implements JavaDelegate {
         return collection;
     }
 
+    private void setisHelmforHealthCheckBB(Service service, ServiceInstance serviceInstance, GeneralBuildingBlock gBB) {
+        for (GenericVnf vnf : serviceInstance.getVnfs()) {
+            for (VfModule vfModule : vnf.getVfModules()) {
+                String vnfModelCustomizationUUID =
+                        this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()).getModelCustomizationId();
+                ModelInfo vnfModelInfo = new ModelInfo();
+                vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID);
+                this.mapCatalogVnf(vnf, vnfModelInfo, service);
+                String vfModuleCustomizationUUID = this.bbInputSetupUtils
+                        .getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId()).getModelCustomizationId();
+                ModelInfo vfModuleModelInfo = new ModelInfo();
+                vfModuleModelInfo.setModelCustomizationId(vfModuleCustomizationUUID);
+                this.mapCatalogVfModule(vfModule, vfModuleModelInfo, service, vnfModelCustomizationUUID);
+                if (vfModule.getModelInfoVfModule() != null && vfModule.getModelInfoVfModule().getModelName() != null
+                        && vfModule.getModelInfoVfModule().getModelName().contains("helm")) {
+                    gBB.getRequestContext().setIsHelm(true);
+                    break;
+                }
+            }
+        }
+    }
+
     protected void mapL3Networks(List<AAIResourceUri> list, List<L3Network> l3Networks) {
         for (AAIResourceUri aaiResourceUri : list) {
             l3Networks.add(this.mapL3Network(aaiResourceUri));
index 8272bd3..fad2e55 100755 (executable)
@@ -1,30 +1,29 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1bvx7yi" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.0">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0gwymqy" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.7.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.14.0">
   <bpmn:process id="HealthCheckBB" name="HealthCheckBB" isExecutable="true">
-    <bpmn:startEvent id="StartEvent_1" name="HealthCheckBB_start">
-      <bpmn:outgoing>Flow_0gd6hy6</bpmn:outgoing>
+    <bpmn:startEvent id="Event_0rgusxn" name="HealthCheckBB_start">
+      <bpmn:outgoing>Flow_0udh4cd</bpmn:outgoing>
     </bpmn:startEvent>
-    <bpmn:endEvent id="Event_1dklvvk" name="HealthCheckBB_end">
-      <bpmn:incoming>Flow_0xiyno7</bpmn:incoming>
+    <bpmn:endEvent id="Event_0o1nl3y" name="HealthCheckBB_end">
+      <bpmn:incoming>Flow_0n17e0q</bpmn:incoming>
+      <bpmn:incoming>Flow_131rwms</bpmn:incoming>
     </bpmn:endEvent>
-    <bpmn:sequenceFlow id="Flow_0gd6hy6" sourceRef="StartEvent_1" targetRef="Activity_11hkwkn" />
-    <bpmn:subProcess id="Activity_1pto2qh" name="Error Handling&#10;&#10;" triggeredByEvent="true">
-      <bpmn:startEvent id="Event_0929aqj">
-        <bpmn:outgoing>Flow_05rbrsm</bpmn:outgoing>
-        <bpmn:errorEventDefinition id="ErrorEventDefinition_0k0ly65" />
+    <bpmn:subProcess id="Activity_0tw4ak3" name="Error Handling&#10;&#10;" triggeredByEvent="true">
+      <bpmn:startEvent id="Event_1v6jbfd">
+        <bpmn:outgoing>Flow_03ogqmx</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_1xw7dq4" />
       </bpmn:startEvent>
-      <bpmn:endEvent id="Event_1s698ql">
-        <bpmn:incoming>Flow_05rbrsm</bpmn:incoming>
-        <bpmn:terminateEventDefinition id="TerminateEventDefinition_0mn6xgi" />
+      <bpmn:endEvent id="Event_0wwzune">
+        <bpmn:incoming>Flow_03ogqmx</bpmn:incoming>
+        <bpmn:terminateEventDefinition id="TerminateEventDefinition_0c07ott" />
       </bpmn:endEvent>
-      <bpmn:sequenceFlow id="Flow_05rbrsm" sourceRef="Event_0929aqj" targetRef="Event_1s698ql" />
+      <bpmn:sequenceFlow id="Flow_03ogqmx" sourceRef="Event_1v6jbfd" targetRef="Event_0wwzune" />
     </bpmn:subProcess>
-    <bpmn:serviceTask id="Activity_11hkwkn" name="Prepare Cnf Adapter request" camunda:expression="${CnfHealthCheckTasks.prepareCnfAdaperRequest(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
-      <bpmn:incoming>Flow_0gd6hy6</bpmn:incoming>
-      <bpmn:outgoing>Flow_1aqdd5k</bpmn:outgoing>
+    <bpmn:serviceTask id="Activity_0pnb21p" name="Prepare Cnf Adapter request" camunda:expression="${CnfHealthCheckTasks.prepareCnfAdaperRequest(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+      <bpmn:incoming>Flow_0jxw1lb</bpmn:incoming>
+      <bpmn:outgoing>Flow_0uoe9ga</bpmn:outgoing>
     </bpmn:serviceTask>
-    <bpmn:sequenceFlow id="Flow_1aqdd5k" sourceRef="Activity_11hkwkn" targetRef="Activity_08mgs1k" />
-    <bpmn:callActivity id="Activity_08mgs1k" name="Call CNFAdapterAsyncCall" calledElement="CNFAdapterAsyncCall">
+    <bpmn:callActivity id="Activity_07txikn" name="Call CNFAdapterAsyncCall" calledElement="CNFAdapterAsyncCall">
       <bpmn:extensionElements>
         <camunda:in source="apiPath" target="apiPath" />
         <camunda:in source="cnfRequestPayload" target="cnfRequestPayload" />
         <camunda:in source="messageType" target="messageType" />
         <camunda:in source="true" target="isDebugLogEnabled" />
       </bpmn:extensionElements>
-      <bpmn:incoming>Flow_1aqdd5k</bpmn:incoming>
-      <bpmn:outgoing>Flow_1jeui7e</bpmn:outgoing>
+      <bpmn:incoming>Flow_0uoe9ga</bpmn:incoming>
+      <bpmn:outgoing>Flow_0t6f6l8</bpmn:outgoing>
     </bpmn:callActivity>
-    <bpmn:serviceTask id="Activity_0w4hy3d" name="Process Response" camunda:expression="${CnfHealthCheckTasks.processAsyncResponse(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
-      <bpmn:incoming>Flow_1jeui7e</bpmn:incoming>
-      <bpmn:outgoing>Flow_0xiyno7</bpmn:outgoing>
+    <bpmn:serviceTask id="Activity_1qd7k3z" name="Process Response" camunda:expression="${CnfHealthCheckTasks.processAsyncResponse(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+      <bpmn:incoming>Flow_0t6f6l8</bpmn:incoming>
+      <bpmn:outgoing>Flow_0n17e0q</bpmn:outgoing>
     </bpmn:serviceTask>
-    <bpmn:sequenceFlow id="Flow_0xiyno7" sourceRef="Activity_0w4hy3d" targetRef="Event_1dklvvk" />
-    <bpmn:sequenceFlow id="Flow_1jeui7e" sourceRef="Activity_08mgs1k" targetRef="Activity_0w4hy3d" />
+    <bpmn:exclusiveGateway id="Gateway_07e5xls" name="Check If Is Helm" default="Flow_131rwms">
+      <bpmn:incoming>Flow_0udh4cd</bpmn:incoming>
+      <bpmn:outgoing>Flow_131rwms</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0jxw1lb</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_0udh4cd" sourceRef="Event_0rgusxn" targetRef="Gateway_07e5xls" />
+    <bpmn:sequenceFlow id="Flow_0n17e0q" sourceRef="Activity_1qd7k3z" targetRef="Event_0o1nl3y" />
+    <bpmn:sequenceFlow id="Flow_131rwms" name="No Helm" sourceRef="Gateway_07e5xls" targetRef="Event_0o1nl3y" />
+    <bpmn:sequenceFlow id="Flow_0jxw1lb" name="Yes Helm" sourceRef="Gateway_07e5xls" targetRef="Activity_0pnb21p">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isHelm")}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_0uoe9ga" sourceRef="Activity_0pnb21p" targetRef="Activity_07txikn" />
+    <bpmn:sequenceFlow id="Flow_0t6f6l8" sourceRef="Activity_07txikn" targetRef="Activity_1qd7k3z" />
   </bpmn:process>
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="HealthCheckBB">
-      <bpmndi:BPMNEdge id="Flow_1jeui7e_di" bpmnElement="Flow_1jeui7e">
-        <di:waypoint x="600" y="120" />
-        <di:waypoint x="680" y="120" />
+      <bpmndi:BPMNEdge id="Flow_0udh4cd_di" bpmnElement="Flow_0udh4cd">
+        <di:waypoint x="218" y="150" />
+        <di:waypoint x="245" y="150" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_0xiyno7_di" bpmnElement="Flow_0xiyno7">
-        <di:waypoint x="780" y="120" />
-        <di:waypoint x="842" y="120" />
+      <bpmndi:BPMNEdge id="Flow_0n17e0q_di" bpmnElement="Flow_0n17e0q">
+        <di:waypoint x="780" y="150" />
+        <di:waypoint x="870" y="150" />
+        <di:waypoint x="870" y="202" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_1aqdd5k_di" bpmnElement="Flow_1aqdd5k">
-        <di:waypoint x="400" y="120" />
-        <di:waypoint x="500" y="120" />
+      <bpmndi:BPMNEdge id="Flow_131rwms_di" bpmnElement="Flow_131rwms">
+        <di:waypoint x="270" y="175" />
+        <di:waypoint x="270" y="220" />
+        <di:waypoint x="852" y="220" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="264" y="195" width="43" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0jxw1lb_di" bpmnElement="Flow_0jxw1lb">
+        <di:waypoint x="295" y="150" />
+        <di:waypoint x="350" y="150" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="299" y="132" width="47" height="14" />
+        </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_0gd6hy6_di" bpmnElement="Flow_0gd6hy6">
-        <di:waypoint x="218" y="120" />
-        <di:waypoint x="300" y="120" />
+      <bpmndi:BPMNEdge id="Flow_0uoe9ga_di" bpmnElement="Flow_0uoe9ga">
+        <di:waypoint x="450" y="150" />
+        <di:waypoint x="500" y="150" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="Event_1dklvvk_di" bpmnElement="Event_1dklvvk">
-        <dc:Bounds x="842" y="102" width="36" height="36" />
+      <bpmndi:BPMNEdge id="Flow_0t6f6l8_di" bpmnElement="Flow_0t6f6l8">
+        <di:waypoint x="600" y="150" />
+        <di:waypoint x="680" y="150" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_0rgusxn_di" bpmnElement="Event_0rgusxn">
+        <dc:Bounds x="182" y="132" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="820" y="145" width="85" height="27" />
+          <dc:Bounds x="156" y="175" width="90" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
-        <dc:Bounds x="182" y="102" width="36" height="36" />
+      <bpmndi:BPMNShape id="Event_0o1nl3y_di" bpmnElement="Event_0o1nl3y">
+        <dc:Bounds x="852" y="202" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="156" y="145" width="90" height="27" />
+          <dc:Bounds x="831" y="245" width="84" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_11hkwkn_di" bpmnElement="Activity_11hkwkn">
-        <dc:Bounds x="300" y="80" width="100" height="80" />
+      <bpmndi:BPMNShape id="Activity_0pnb21p_di" bpmnElement="Activity_0pnb21p">
+        <dc:Bounds x="350" y="110" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_07txikn_di" bpmnElement="Activity_07txikn">
+        <dc:Bounds x="500" y="110" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0f7poou_di" bpmnElement="Activity_08mgs1k">
-        <dc:Bounds x="500" y="80" width="100" height="80" />
+      <bpmndi:BPMNShape id="Activity_1qd7k3z_di" bpmnElement="Activity_1qd7k3z">
+        <dc:Bounds x="680" y="110" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0w4hy3d_di" bpmnElement="Activity_0w4hy3d">
-        <dc:Bounds x="680" y="80" width="100" height="80" />
+      <bpmndi:BPMNShape id="Gateway_07e5xls_di" bpmnElement="Gateway_07e5xls" isMarkerVisible="true">
+        <dc:Bounds x="245" y="125" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="230" y="95" width="81" height="14" />
+        </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_1pto2qh_di" bpmnElement="Activity_1pto2qh" isExpanded="true">
-        <dc:Bounds x="280" y="250" width="460" height="135" />
+      <bpmndi:BPMNShape id="Activity_0tw4ak3_di" bpmnElement="Activity_0tw4ak3" isExpanded="true">
+        <dc:Bounds x="280" y="280" width="460" height="135" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="Flow_05rbrsm_di" bpmnElement="Flow_05rbrsm">
-        <di:waypoint x="398" y="324" />
-        <di:waypoint x="632" y="324" />
+      <bpmndi:BPMNEdge id="Flow_03ogqmx_di" bpmnElement="Flow_03ogqmx">
+        <di:waypoint x="398" y="354" />
+        <di:waypoint x="632" y="354" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="Event_0929aqj_di" bpmnElement="Event_0929aqj">
-        <dc:Bounds x="362" y="306" width="36" height="36" />
+      <bpmndi:BPMNShape id="Event_1v6jbfd_di" bpmnElement="Event_1v6jbfd">
+        <dc:Bounds x="362" y="336" width="36" height="36" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_1s698ql_di" bpmnElement="Event_1s698ql">
-        <dc:Bounds x="632" y="306" width="36" height="36" />
+      <bpmndi:BPMNShape id="Event_0wwzune_di" bpmnElement="Event_0wwzune">
+        <dc:Bounds x="632" y="336" width="36" height="36" />
       </bpmndi:BPMNShape>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>