summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuleshov, Elena <evn@att.com>2020-07-01 09:43:53 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-07-01 09:43:54 -0400
commit525416ca5d9fd84be3e2d5693f242455dbb83a39 (patch)
treeb5cd2e3e11d66b782b86281f0e2ac6962d885979
parent1f7a7db265e2f98356e4006631535dd90eab6b7c (diff)
Preserve placement of Config BBs
Preserve placement of Config BBs in the Replace VfModule execution list. Issue-ID: SO-3012 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: Ia3abd3e154a5e0e62a3dc45d74baece7cb19e63e
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java60
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java73
2 files changed, 115 insertions, 18 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index cc89d00e29..dd05b6b73a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -221,18 +221,6 @@ public class WorkflowAction {
cloudOwner, serviceType);
}
Resource resourceKey = getResourceKey(sIRequest, resourceType);
- if (isConfiguration(orchFlows) && !requestAction.equalsIgnoreCase(CREATEINSTANCE)) {
- List<ExecuteBuildingBlock> configBuildingBlocks = getConfigBuildingBlocks(
- new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest).setOrchFlows(orchFlows)
- .setRequestId(requestId).setResourceKey(resourceKey).setApiVersion(apiVersion)
- .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(true)
- .setVnfType(vnfType).setWorkflowResourceIds(workflowResourceIds)
- .setRequestDetails(requestDetails).setExecution(execution));
-
- flowsToExecute.addAll(configBuildingBlocks);
- }
- orchFlows = orchFlows.stream().filter(item -> !item.getFlowName().contains(FABRIC_CONFIGURATION))
- .collect(Collectors.toList());
if ((requestAction.equalsIgnoreCase(REPLACEINSTANCE)
|| requestAction.equalsIgnoreCase(REPLACEINSTANCERETAINASSIGNMENTS))
@@ -244,12 +232,48 @@ public class WorkflowAction {
.setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(true)
.setVnfType(vnfType).setWorkflowResourceIds(workflowResourceIds)
.setRequestDetails(requestDetails).setExecution(execution));
- }
- for (OrchestrationFlow orchFlow : orchFlows) {
- ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey,
- apiVersion, resourceId, requestAction, true, vnfType, workflowResourceIds,
- requestDetails, false, null, null, false);
- flowsToExecute.add(ebb);
+ for (OrchestrationFlow orchFlow : orchFlows) {
+ if (orchFlow.getFlowName().contains(CONFIGURATION)) {
+ List<OrchestrationFlow> configOrchFlows = new ArrayList<OrchestrationFlow>();
+ configOrchFlows.add(orchFlow);
+ List<ExecuteBuildingBlock> configBuildingBlocks =
+ getConfigBuildingBlocks(new ConfigBuildingBlocksDataObject()
+ .setsIRequest(sIRequest).setOrchFlows(configOrchFlows)
+ .setRequestId(requestId).setResourceKey(resourceKey)
+ .setApiVersion(apiVersion).setResourceId(resourceId)
+ .setRequestAction(requestAction).setaLaCarte(true).setVnfType(vnfType)
+ .setWorkflowResourceIds(workflowResourceIds)
+ .setRequestDetails(requestDetails).setExecution(execution));
+ flowsToExecute.addAll(configBuildingBlocks);
+ } else {
+ ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey,
+ apiVersion, resourceId, requestAction, true, vnfType, workflowResourceIds,
+ requestDetails, false, null, null, false);
+ flowsToExecute.add(ebb);
+ }
+ }
+ } else {
+ if (isConfiguration(orchFlows) && !requestAction.equalsIgnoreCase(CREATEINSTANCE)) {
+ List<ExecuteBuildingBlock> configBuildingBlocks =
+ getConfigBuildingBlocks(new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest)
+ .setOrchFlows(orchFlows).setRequestId(requestId).setResourceKey(resourceKey)
+ .setApiVersion(apiVersion).setResourceId(resourceId)
+ .setRequestAction(requestAction).setaLaCarte(true).setVnfType(vnfType)
+ .setWorkflowResourceIds(workflowResourceIds)
+ .setRequestDetails(requestDetails).setExecution(execution));
+
+ flowsToExecute.addAll(configBuildingBlocks);
+ }
+ orchFlows =
+ orchFlows.stream().filter(item -> !item.getFlowName().contains(FABRIC_CONFIGURATION))
+ .collect(Collectors.toList());
+
+ for (OrchestrationFlow orchFlow : orchFlows) {
+ ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey,
+ apiVersion, resourceId, requestAction, true, vnfType, workflowResourceIds,
+ requestDetails, false, null, null, false);
+ flowsToExecute.add(ebb);
+ }
}
} else {
boolean foundRelated = false;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
index e24eaf0581..cf8d98e86e 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -140,6 +140,11 @@ public class WorkflowActionTest extends BaseTaskTest {
"DeleteVfModuleATTBB", "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "UnassignVolumeGroupBB",
"AssignVolumeGroupBB", "ChangeModelVfModuleBB", "CreateVolumeGroupBB", "ActivateVolumeGroupBB",
"CreateVfModuleBB", "ActivateVfModuleBB", "ChangeModelVnfBB", "ChangeModelServiceInstanceBB");
+ private List<OrchestrationFlow> replaceVfModuleWithFabricOrchFlows = createFlowList("DeleteFabricConfigurationBB",
+ "DeactivateVfModuleBB", "DeleteVfModuleATTBB", "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB",
+ "UnassignVFModuleBB", "UnassignVolumeGroupBB", "AssignVolumeGroupBB", "AssignVfModuleBB",
+ "CreateVfModuleBB", "ActivateVfModuleBB", "AddFabricConfigurationBB", "CreateVolumeGroupBB",
+ "ActivateVolumeGroupBB", "ChangeModelVnfBB", "ChangeModelServiceInstanceBB");
@Before
public void before() throws Exception {
@@ -1360,6 +1365,74 @@ public class WorkflowActionTest extends BaseTaskTest {
}
@Test
+ public void selectExecutionListALaCarteVfModuleWithFabricKeepVolumeGroupReplaceTest() throws Exception {
+ String gAction = "replaceInstance";
+ String resource = "VfModule";
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ String bpmnRequest =
+ new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", true);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri",
+ "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
+ execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
+ execution.setVariable("vfModuleId", "1234");
+
+ org.onap.aai.domain.yang.GenericVnf vnf = new org.onap.aai.domain.yang.GenericVnf();
+ vnf.setVnfId("b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
+ vnf.setModelCustomizationId("modelCustomizationId");
+ when(bbSetupUtils.getAAIGenericVnf(any())).thenReturn(vnf);
+
+ org.onap.aai.domain.yang.VfModule vfModuleFromAAI = new org.onap.aai.domain.yang.VfModule();
+ vfModuleFromAAI.setModelCustomizationId("modelCustomizationId");
+ vfModuleFromAAI.setVfModuleId("1234");
+ when(bbSetupUtils.getAAIVfModule(any(), any())).thenReturn(vfModuleFromAAI);
+
+ VolumeGroup volumeGroup = new VolumeGroup();
+ volumeGroup.setVolumeGroupId("volumeGroupId");
+ doReturn(Optional.of(volumeGroup)).when(bbSetupUtils)
+ .getRelatedVolumeGroupFromVfModule("b80b16a5-f80d-4ffa-91c8-bd47c7438a3d", "1234");
+
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+ vfModuleCustomization.setVolumeHeatEnv(new HeatEnvironment());
+ org.onap.so.db.catalog.beans.VfModule vfModule = new org.onap.so.db.catalog.beans.VfModule();
+ vfModule.setVolumeHeatTemplate(new HeatTemplate());
+ vfModuleCustomization.setVfModule(vfModule);
+ when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("9a6d01fd-19a7-490a-9800-460830a12e0b"))
+ .thenReturn(vfModuleCustomization);
+ List<org.onap.aai.domain.yang.Vnfc> vnfcs = new ArrayList<org.onap.aai.domain.yang.Vnfc>();
+ org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc();
+ vnfc.setModelInvariantId("modelInvariantId");
+ vnfc.setVnfcName("testVnfcName");
+ vnfcs.add(vnfc);
+ doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(any(), any(), any(), any());
+
+ List<org.onap.aai.domain.yang.Configuration> configurations =
+ new ArrayList<org.onap.aai.domain.yang.Configuration>();
+ org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration();
+ configuration.setConfigurationId("configurationId");
+ configuration.setModelCustomizationId("modelCustimizationId");
+ configuration.setConfigurationName("testConfigurationName");
+ configurations.add(configuration);
+ doReturn(configurations).when(SPY_workflowAction).getRelatedResourcesInVnfc(any(), any(), any());
+
+ doReturn("testVnfcName").when(SPY_workflowAction).getVnfcNameForConfiguration(any());
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ northBoundRequest.setOrchestrationFlowList(replaceVfModuleWithFabricOrchFlows);
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ true, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ SPY_workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+
+ assertEqualsBulkFlowName(ebbs, "DeleteFabricConfigurationBB", "DeactivateVfModuleBB", "DeleteVfModuleATTBB",
+ "UnassignVFModuleBB", "AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB",
+ "AddFabricConfigurationBB", "ChangeModelVnfBB", "ChangeModelServiceInstanceBB");
+ }
+
+ @Test
public void selectExecutionListALaCarteVfModuleKeepVolumeGroupReplaceRetainAssignmentsTest() throws Exception {
String gAction = "replaceInstanceRetainAssignments";
String resource = "VfModule";