Code & Workflow Enhancements for CNF - Upgrade 19/130519/3
authorsanket12345 <SX00562924@techmahindra.com>
Tue, 30 Aug 2022 16:03:06 +0000 (21:33 +0530)
committerLukasz Rajewski <lukasz.rajewski@t-mobile.pl>
Mon, 3 Oct 2022 19:46:40 +0000 (19:46 +0000)
- Adding New Building Block : VfModuleUpgradeBB, which delgates Workflow to next BB by just changing AAI Orch_status, else WF fails during Orchestration flow validation DB lookup.
- Adding changes to BB Inputs to take new version VNF & VFM model details and pass to BBs, as done for Service-Macro-Upgrade.
- Adding new operations in CDS to skip execution,when SDC Model has skipCDS=True.
- Calling CNF Adapter with existing heatStackID & passing it for CNF-Upgrade with new customization details.

Issue-ID: SO-3857
Change-Id: I69f71f825b812d423f82f1a902dcb8567d8a6adb
Signed-off-by: sanket12345 <SX00562924@techmahindra.com>
adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpgradeVfModuleBB.bpmn
bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/VfModuleUpgradeStatusBB.bpmn [new file with mode: 0644]
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterUpgradeTasks.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/CnfAdapterClient.java

index c1a67a5..7b15b0c 100644 (file)
@@ -264,14 +264,15 @@ INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, SC
 ('CNF-Macro-Upgrade', '2', 'AAISetVnfInMaintBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
 ('CNF-Macro-Upgrade', '3', 'DeactivateVfModuleBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
 ('CNF-Macro-Upgrade', '4', 'DeactivateVnfBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
-('CNF-Macro-Upgrade', '5', 'ChangeModelVfModuleBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
-('CNF-Macro-Upgrade', '6', 'ControllerExecutionBB', 'vnf', 'config-upgrade-assign', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
-('CNF-Macro-Upgrade', '7', 'UpgradeVfModuleBB', NULL , NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
-('CNF-Macro-Upgrade', '8', 'ControllerExecutionBB', 'vnf', 'config-upgrade-deploy', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
-('CNF-Macro-Upgrade', '9', 'ActivateVfModuleBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
-('CNF-Macro-Upgrade', '10', 'ChangeModelVnfBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
-('CNF-Macro-Upgrade', '11', 'ActivateVnfBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
-('CNF-Macro-Upgrade', '12', 'AAIUnsetVnfInMaintBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT'));
+('CNF-Macro-Upgrade', '5', 'VfModuleUpgradeStatusBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
+('CNF-Macro-Upgrade', '6', 'ChangeModelVfModuleBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
+('CNF-Macro-Upgrade', '7', 'ControllerExecutionBB', 'vnf', 'config-upgrade-assign', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
+('CNF-Macro-Upgrade', '8', 'UpgradeVfModuleBB', NULL , NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
+('CNF-Macro-Upgrade', '9', 'ControllerExecutionBB', 'vnf', 'config-upgrade-deploy', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
+('CNF-Macro-Upgrade', '10', 'ActivateVfModuleBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
+('CNF-Macro-Upgrade', '11', 'ChangeModelVnfBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
+('CNF-Macro-Upgrade', '12', 'ActivateVnfBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
+('CNF-Macro-Upgrade', '13', 'AAIUnsetVnfInMaintBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT'));
 
 INSERT INTO rainy_day_handler_macro (FLOW_NAME, SERVICE_TYPE, VNF_TYPE, ERROR_CODE, WORK_STEP, POLICY, SECONDARY_POLICY, REG_EX_ERROR_MESSAGE, SERVICE_ROLE)
 VALUES
@@ -338,7 +339,8 @@ VALUES
 ('VNFUnsetInMaintFlagActivity','*','*','*','*','Manual','Abort','*', '*'),
 ('VNFUnsetClosedLoopDisabledActivity','*','*','*','*','Manual','Abort','*', '*'),
 ('DeleteChildServiceBB', '*', '*', '*', '*', 'Rollback', 'Abort', '*', '*'),
-('CreateChildServiceBB', '*', '*', '*', '*', 'Rollback', 'Abort', '*', '*');
+('CreateChildServiceBB', '*', '*', '*', '*', 'Rollback', 'Abort', '*', '*'),
+('UpgradeVfModuleBB', '*', '*', '*', '*', 'Rollback', 'Abort', '*', '*');
 
 INSERT INTO building_block_detail (building_block_name, resource_type, target_action)
 VALUES
index c36aaac..f192024 100644 (file)
@@ -1272,7 +1272,8 @@ public class BBInputSetup implements JavaDelegate {
                 || requestAction.equalsIgnoreCase("activateFabricConfiguration")
                 || requestAction.equalsIgnoreCase("recreateInstance")
                 || requestAction.equalsIgnoreCase("replaceInstance")
-                || requestAction.equalsIgnoreCase("upgradeInstance") || requestAction.equalsIgnoreCase("healthCheck")) {
+                || requestAction.equalsIgnoreCase("upgradeInstance") || requestAction.equalsIgnoreCase("healthCheck")
+                || requestAction.equalsIgnoreCase("upgradeCnf")) {
             return getGBBMacroExistingService(executeBB, lookupKeyMap, bbName, requestAction,
                     requestDetails.getCloudConfiguration());
         }
@@ -1489,6 +1490,27 @@ public class BBInputSetup implements JavaDelegate {
             cloudRegion = mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion);
         }
         gBB.setCloudRegion(cloudRegion);
+        String upgradeCnfModelCustomizationUUID = "";
+        String upgradeCnfVfModuleModelCustomizationUUID = "";
+        String upgradeCnfModelVersionId = "";
+        String upgradeCnfVfModuleModelVersionId = "";
+        if (requestDetails.getRelatedInstanceList() != null) {
+            for (RelatedInstanceList relatedInstList : requestDetails.getRelatedInstanceList()) {
+                RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
+                // condition -1
+                if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)
+                        && requestAction.equalsIgnoreCase("upgradeCnf")) {
+                    upgradeCnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId();
+                    upgradeCnfModelVersionId = relatedInstance.getModelInfo().getModelVersionId();
+                }
+                // condition -2
+                if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vfModule)
+                        && parameter.getRequestAction().equals("upgradeCnf")) {
+                    upgradeCnfVfModuleModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId();
+                    upgradeCnfVfModuleModelVersionId = relatedInstance.getModelInfo().getModelVersionId();
+                }
+            }
+        }
         if (bbName.contains(VNF) || (bbName.contains(CONTROLLER)
                 && (VNF).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope()))) {
             for (GenericVnf genericVnf : serviceInstance.getVnfs()) {
@@ -1496,12 +1518,18 @@ public class BBInputSetup implements JavaDelegate {
                         && genericVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) {
                     org.onap.aai.domain.yang.GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(genericVnf.getVnfId());
                     ModelInfo modelInfo = new ModelInfo();
-                    if (vnf != null) {
+                    if ("upgradeCnf".equalsIgnoreCase(requestAction) && upgradeCnfModelCustomizationUUID != null) {
+                        modelInfo.setModelCustomizationUuid(upgradeCnfModelCustomizationUUID);
+                        modelInfo.setModelVersionId(upgradeCnfModelVersionId);
+                        this.mapCatalogVnf(genericVnf, modelInfo, service);
+                    } else if (vnf != null) {
                         modelInfo.setModelCustomizationUuid(vnf.getModelCustomizationId());
+                        this.mapCatalogVnf(genericVnf, modelInfo, service);
                     }
-                    this.mapCatalogVnf(genericVnf, modelInfo, service);
+
                 }
             }
+
         } else if (bbName.contains(VF_MODULE) || (bbName.contains(CONTROLLER)
                 && (VF_MODULE).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope()))) {
             for (GenericVnf vnf : serviceInstance.getVnfs()) {
@@ -1511,14 +1539,28 @@ public class BBInputSetup implements JavaDelegate {
                         String vnfModelCustomizationUUID =
                                 this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()).getModelCustomizationId();
                         ModelInfo vnfModelInfo = new ModelInfo();
-                        vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID);
-                        this.mapCatalogVnf(vnf, vnfModelInfo, service);
+                        if ("upgradeCnf".equalsIgnoreCase(requestAction) && upgradeCnfModelCustomizationUUID != null) {
+                            vnfModelInfo.setModelCustomizationUuid(upgradeCnfModelCustomizationUUID);
+                            vnfModelInfo.setModelVersionId(upgradeCnfModelVersionId);
+                            this.mapCatalogVnf(vnf, vnfModelInfo, service);
+                        } else {
+                            vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID);
+                            this.mapCatalogVnf(vnf, vnfModelInfo, service);
+                        }
                         lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnf.getVnfId());
                         String vfModuleCustomizationUUID = this.bbInputSetupUtils
                                 .getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId()).getModelCustomizationId();
                         ModelInfo vfModuleModelInfo = new ModelInfo();
-                        vfModuleModelInfo.setModelCustomizationId(vfModuleCustomizationUUID);
-                        this.mapCatalogVfModule(vfModule, vfModuleModelInfo, service, vnfModelCustomizationUUID);
+                        if ("upgradeCnf".equalsIgnoreCase(requestAction)
+                                && upgradeCnfVfModuleModelCustomizationUUID != null) {
+                            vfModuleModelInfo.setModelCustomizationUuid(upgradeCnfVfModuleModelCustomizationUUID);
+                            vfModuleModelInfo.setModelVersionId(upgradeCnfVfModuleModelVersionId);
+                            this.mapCatalogVfModule(vfModule, vfModuleModelInfo, service,
+                                    upgradeCnfVfModuleModelCustomizationUUID);
+                        } else {
+                            vfModuleModelInfo.setModelCustomizationId(vfModuleCustomizationUUID);
+                            this.mapCatalogVfModule(vfModule, vfModuleModelInfo, service, vnfModelCustomizationUUID);
+                        }
                         if (cloudRegion != null) {
                             Optional<String> volumeGroupIdOp = getVolumeGroupIdRelatedToVfModule(vnf, vfModuleModelInfo,
                                     cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), lookupKeyMap);
index 59bb404..dcfc834 100644 (file)
@@ -1,5 +1,5 @@
 <?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:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1jxlg2g" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1jxlg2g" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0">
   <bpmn:process id="UpgradeVfModuleBB" name="UpgradeVfModuleBB" isExecutable="true">
     <bpmn:startEvent id="UpgradeVfModuleBB_Start">
       <bpmn:outgoing>SequenceFlow_1xr6chl</bpmn:outgoing>
@@ -15,7 +15,7 @@
       <bpmn:incoming>SequenceFlow_1xr6chl</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_1s4rpyp</bpmn:outgoing>
     </bpmn:serviceTask>
-    <bpmn:serviceTask id="UpdateVfModuleStatus" name="&#10;AAI&#10;Update&#10;(vf module)&#10;" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusCreatedVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+    <bpmn:serviceTask id="UpdateVfModuleStatus" name="&#10;AAI&#10;Update&#10;(vf module) - Pending Activation&#10;" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusPendingActivationVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
       <bpmn:incoming>SequenceFlow_0rds4rj</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_1vbwdaw</bpmn:outgoing>
     </bpmn:serviceTask>
       <bpmndi:BPMNShape id="Activity_1p8hxyt_di" bpmnElement="Activity_1p8hxyt">
         <dc:Bounds x="336" y="544" width="100" height="80" />
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_13ssqoq_di" bpmnElement="Event_1pengt4">
+        <dc:Bounds x="256" y="566" width="36" height="36" />
+      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="UpdateCnfAai_di" bpmnElement="UpdateCnfAai">
         <dc:Bounds x="870" y="80" width="100" height="80" />
       </bpmndi:BPMNShape>
           <dc:Bounds x="162" y="394" width="57" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_13ssqoq_di" bpmnElement="Event_1pengt4">
-        <dc:Bounds x="256" y="566" 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/VfModuleUpgradeStatusBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/VfModuleUpgradeStatusBB.bpmn
new file mode 100644 (file)
index 0000000..faade41
--- /dev/null
@@ -0,0 +1,44 @@
+<?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:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0q1rj69" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0">
+  <bpmn:process id="VfModuleUpgradeStatusBB" name="VfModuleUpgradeStatusBB" isExecutable="true">
+    <bpmn:startEvent id="Start_CNFUpgradeStatus" name="Start">
+      <bpmn:outgoing>SequenceFlow_0zaz9o2</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:endEvent id="End_CNFUpgradeStatus" name="End">
+      <bpmn:incoming>SequenceFlow_1jwsja5</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:serviceTask id="VfModuleUpgradeStatus" name="VfModuleUpgradeStatus" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+      <bpmn:incoming>SequenceFlow_0zaz9o2</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1jwsja5</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0zaz9o2" sourceRef="Start_CNFUpgradeStatus" targetRef="VfModuleUpgradeStatus" />
+    <bpmn:sequenceFlow id="SequenceFlow_1jwsja5" sourceRef="VfModuleUpgradeStatus" targetRef="End_CNFUpgradeStatus" />
+  </bpmn:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VfModuleUpgradeStatusBB">
+      <bpmndi:BPMNEdge id="SequenceFlow_1jwsja5_di" bpmnElement="SequenceFlow_1jwsja5">
+        <di:waypoint x="349" y="120" />
+        <di:waypoint x="418" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0zaz9o2_di" bpmnElement="SequenceFlow_0zaz9o2">
+        <di:waypoint x="188" y="120" />
+        <di:waypoint x="249" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Start_AAISetVnfInMaintBB_di" bpmnElement="Start_CNFUpgradeStatus">
+        <dc:Bounds x="152" y="102" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="158" y="145" width="24" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="End_AAISetVnfInMaintBB_di" bpmnElement="End_CNFUpgradeStatus">
+        <dc:Bounds x="418" y="102" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="426" y="145" width="20" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Task_SetInMaint_di" bpmnElement="VfModuleUpgradeStatus">
+        <dc:Bounds x="249" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
index ed01f22..5e3b781 100644 (file)
@@ -170,7 +170,7 @@ public class CnfAdapterCreateTasks {
         logger.debug("currentFlow: {}", currentFlow);
 
         String apiPath = "http://so-cnf-adapter:8090";
-        if ("CreateVfModuleBB".equals(currentFlow)) {
+        if ("CreateVfModuleBB".equals(currentFlow) || ("UpgradeVfModuleBB".equals(currentFlow))) {
             apiPath = apiPath + "/api/cnf-adapter/v1/aai-update/";
         } else if ("DeleteVfModuleBB".equals(currentFlow)) {
             apiPath = apiPath + "/api/cnf-adapter/v1/aai-delete/";
index 2eebde0..4fd0aab 100644 (file)
@@ -90,7 +90,8 @@ public class CnfAdapterUpgradeTasks {
             Map<String, String> sdncDirectives = getSdncDirectives(paramsMap);
             UpgradeInstanceRequest upgradeInstanceRequest =
                     upgradeInstanceRequest(vfModule, cloudRegion, sdncDirectives);
-            UpgradeInstanceResponse response = cnfAdapterClient.upgradeVfModule(upgradeInstanceRequest);
+            String heatStackId = vfModule.getHeatStackId();
+            UpgradeInstanceResponse response = cnfAdapterClient.upgradeVfModule(upgradeInstanceRequest, heatStackId);
             execution.setVariable("heatStackId", response.getId());
         } catch (Exception ex) {
             logger.error("Exception occurred", ex);
index dc77ea1..6df4f76 100644 (file)
@@ -47,8 +47,8 @@ public class SkipCDSBuildingBlockListener implements PreFlowManipulator {
     @Autowired
     private CatalogDbClient catalogDbClient;
 
-    private Set<String> vnfActions =
-            new HashSet<String>(Arrays.asList("config-assign", "config-deploy", "VnfConfigAssign", "VnfConfigDeploy"));
+    private Set<String> vnfActions = new HashSet<String>(Arrays.asList("config-assign", "config-deploy",
+            "VnfConfigAssign", "VnfConfigDeploy", "config-upgrade-assign", "config-upgrade-deploy"));
 
     private Set<String> vFModuleAction =
             new HashSet<String>(Arrays.asList("VfModuleConfigAssign", "VfModuleConfigDeploy"));
index e8122e7..82c0e49 100644 (file)
@@ -118,11 +118,12 @@ public class CnfAdapterClient {
     }
 
     @Retryable(value = {HttpServerErrorException.class}, maxAttempts = 3, backoff = @Backoff(delay = 3000))
-    public UpgradeInstanceResponse upgradeVfModule(UpgradeInstanceRequest request) throws CnfAdapterClientException {
+    public UpgradeInstanceResponse upgradeVfModule(UpgradeInstanceRequest request, String heatStackId)
+            throws CnfAdapterClientException {
         try {
             String uri = "http://so-cnf-adapter:8090";
-            String endpoint = UriBuilder.fromUri(uri).path("/api/cnf-adapter/v1/instance/{instanceID}/upgrade").build()
-                    .toString();
+            String endpoint = UriBuilder.fromUri(uri).path(INSTANCE_CREATE_PATH + "/" + heatStackId + "/upgrade")
+                    .build().toString();
             HttpEntity<?> entity = getHttpEntity(request);
             ResponseEntity<UpgradeInstanceResponse> result =
                     restTemplate.exchange(endpoint, HttpMethod.POST, entity, UpgradeInstanceResponse.class);