From aaec67060a5973ccf2ef263cb928e3a7e8d36b6a Mon Sep 17 00:00:00 2001 From: Steve Smokowski Date: Tue, 27 Oct 2020 12:32:37 +0000 Subject: Revert "PNF service instantiation using building blocks fails" This reverts commit eeaf0330f835b237812bbbf26ca5bba3c44f4671. Reason for revert: Change-Id: I866ca90e763bfeca73e4a734bb47102f69fecf79 Issue-ID: SO-3322 Signed-off-by: Smokowski, Steve --- .../subprocess/BuildingBlock/WorkflowActionBB.bpmn | 575 ++++++++++----------- .../workflow/tasks/WorkflowActionBBTasks.java | 7 +- .../listeners/SkipCDSBuildingBlockListener.java | 19 +- .../workflow/tasks/WorkflowActionBBTasksTest.java | 4 + .../SkipCDSBuildingBlockListenerTest.java | 42 +- 5 files changed, 291 insertions(+), 356 deletions(-) diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn index b4954e0b75..5fd9701880 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn @@ -1,5 +1,5 @@ - + @@ -41,7 +41,7 @@ SequenceFlow_0mqrkxv - SequenceFlow_16fwl31 + SequenceFlow_1fftixk SequenceFlow_1m2eezj SequenceFlow_0v588sm SequenceFlow_11530ei @@ -49,7 +49,7 @@ SequenceFlow_0l7kaba - + ${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==false&&execution.getVariable("handlingCode")=="Success"} SequenceFlow_15s0okp @@ -86,7 +86,7 @@ - + ${execution.getVariable("isTopLevelFlow")==true&&execution.getVariable("sentSyncResponse")==false} @@ -95,10 +95,10 @@ - + ${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"||execution.getVariable("handlingCode")=="RollbackToCreated"||execution.getVariable("handlingCode")=="RollbackToCreatedNoConfiguration"} - + ${execution.getVariable("isRollbackNeeded")==true} SequenceFlow_0v588sm @@ -107,7 +107,7 @@ - + ${execution.getVariable("handlingCode")=="Abort"} SequenceFlow_02ksbt0 @@ -130,7 +130,7 @@ - + ${execution.getVariable("isTopLevelFlow")==false} SequenceFlow_11530ei @@ -139,7 +139,7 @@ - + ${execution.getVariable("isTopLevelFlow")==false} SequenceFlow_1m2eezj @@ -147,13 +147,13 @@ SequenceFlow_0kf5sen - + ${execution.getVariable("isTopLevelFlow")==false} SequenceFlow_1ui67mc - + ${execution.getVariable("isRollbackNeeded")==false} SequenceFlow_11dlyzt @@ -161,7 +161,7 @@ SequenceFlow_1ui67mc - + ${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==true&&execution.getVariable("handlingCode")=="Success"} @@ -193,9 +193,10 @@ SequenceFlow_1hsqed1 - SequenceFlow_0tps01a + SequenceFlow_1fftixk + SequenceFlow_1lrz41x @@ -204,399 +205,302 @@ - + ${execution.getVariable("generateIdsOnly") == null || execution.getVariable("generateIdsOnly")==false} SequenceFlow_0ilo6lo - - SequenceFlow_0tps01a - SequenceFlow_16fwl31 - - - - - - + + - + - - - - + + + - + - - - - + + + + - + - - - + + + + + + - + - - - + + + + + - + - - - - - + + + + + - + - - - + + + + + + + + + + + + + - + - - - - - + + + + + - + - - - - - + + + - + - - - - + + + + + - + - - - - - + + + - + - - - - - + + + + + + - + - - - - + + + + - + - - - - - + + + + + - + - - - - + + + + + + - + - - - - + + + + + - + - - - + + + + + - + - + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - + - - - - + + - + - - - - - + + + + + - + - - - - + + + - + - - - + + - + - - - - + + + + + + - + - - - - - - - - + + - + - - - - - - - - + + + + - + + + + - - - - - - - - - - - - - - + + - - - - - - - - - - - + + + + + - + - - - - - + + + - + - - + + - - - + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - + - - - + + + + + - + - - - + + + + - + - - - + + + - - - - - - - - - - - - - - @@ -612,27 +516,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java index 0cb8fb2ccd..43a85051be 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java @@ -103,6 +103,7 @@ public class WorkflowActionBBTasks { (List) execution.getVariable("flowsToExecute"); execution.setVariable("MacroRollback", false); + flowManipulatorListenerRunner.modifyFlows(flowsToExecute, new DelegateExecutionImpl(execution)); int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE); ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence); @@ -113,12 +114,6 @@ public class WorkflowActionBBTasks { execution.setVariable(G_CURRENT_SEQUENCE, currentSequence); } - public void runFlowManipulator(DelegateExecution execution) { - List flowsToExecute = - (List) execution.getVariable("flowsToExecute"); - flowManipulatorListenerRunner.modifyFlows(flowsToExecute, new DelegateExecutionImpl(execution)); - } - public void updateFlowStatistics(DelegateExecution execution) { try { int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java index 42aab4c16e..2119ced951 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java @@ -52,8 +52,6 @@ public class SkipCDSBuildingBlockListener implements FlowManipulator { private Set pnfActions = new HashSet<>(Arrays.asList("config-assign", "config-deploy", "PnfConfigAssign", "PnfConfigDeploy")); - private static final String COMPLETED = "completed"; - @Override public boolean shouldRunFor(String currentBBName, boolean isFirst, BuildingBlockExecution execution) { @@ -72,7 +70,6 @@ public class SkipCDSBuildingBlockListener implements FlowManipulator { public void run(List flowsToExecute, ExecuteBuildingBlock currentBB, BuildingBlockExecution execution) { String customizationUUID = currentBB.getBuildingBlock().getKey(); - int flowsToExecuteSize = flowsToExecute.size(); if (Strings.isEmpty(customizationUUID)) { return; @@ -88,7 +85,7 @@ public class SkipCDSBuildingBlockListener implements FlowManipulator { vnfResourceCustomizations); if (null != vrc) { boolean skipConfigVNF = vrc.isSkipPostInstConf(); - currentSequenceSkipCheck(execution, skipConfigVNF, flowsToExecuteSize); + currentSequenceSkipCheck(execution, skipConfigVNF); } } @@ -100,7 +97,7 @@ public class SkipCDSBuildingBlockListener implements FlowManipulator { if (null != vfc) { boolean skipVfModule = vfc.isSkipPostInstConf(); - currentSequenceSkipCheck(execution, skipVfModule, flowsToExecuteSize); + currentSequenceSkipCheck(execution, skipVfModule); } } else if (currentBB.getBuildingBlock().getBpmnScope().equalsIgnoreCase("PNF") @@ -110,7 +107,7 @@ public class SkipCDSBuildingBlockListener implements FlowManipulator { if (null != pnfResourceCustomization) { boolean skipConfigPNF = pnfResourceCustomization.isSkipPostInstConf(); - currentSequenceSkipCheck(execution, skipConfigPNF, flowsToExecuteSize); + currentSequenceSkipCheck(execution, skipConfigPNF); } } } @@ -121,16 +118,10 @@ public class SkipCDSBuildingBlockListener implements FlowManipulator { } - private void currentSequenceSkipCheck(BuildingBlockExecution execution, boolean skipModule, - int flowsToExecuteSize) { + private void currentSequenceSkipCheck(BuildingBlockExecution execution, boolean skipModule) { if (skipModule) { int currentSequence = execution.getVariable(BBConstants.G_CURRENT_SEQUENCE); - currentSequence++; - if (currentSequence >= flowsToExecuteSize) { - execution.setVariable(COMPLETED, true); - } else { - execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, currentSequence); - } + execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, currentSequence + 1); } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java index b0358c51f0..3290bb3dce 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java @@ -41,6 +41,7 @@ import org.onap.aai.domain.yang.ServiceInstance; import org.onap.aai.domain.yang.VfModule; import org.onap.aai.domain.yang.VolumeGroup; import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys; @@ -89,6 +90,9 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { @Mock protected Environment environment; + @Mock + private FlowManipulatorListenerRunner flowManipulatorListenerRunner; + @Rule public ExpectedException thrown = ExpectedException.none(); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java index 1d68cf0adb..fdf4d36c89 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java @@ -55,10 +55,10 @@ public class SkipCDSBuildingBlockListenerTest { private static final String PNFModule_TEST_ACTION = "config-assign"; private static final String MODELCUSTOMIZATIONUUID = "123456789"; private static final String BBNAME = "ControllerExecutionBB"; - private static final String COMPLETED = "completed"; private static final boolean ISFIRST = true; private int actual; + private List flowsToExecute = new ArrayList<>(); private List vnfResourceCustomization; private List vfModuleCustomization; private ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock(); @@ -91,9 +91,6 @@ public class SkipCDSBuildingBlockListenerTest { @Test public void testProcessForVNFToSkipCDSBB() { - List flowsToExecute = new ArrayList<>(); - flowsToExecute.add(executeBuildingBlock); - flowsToExecute.add(new ExecuteBuildingBlock()); // given setBuildingBlockAndCurrentSequence(VNF_SCOPE, VNF_TEST_ACTION, 0); vnfResourceCustomization = getVnfResourceCustomizationList(true); @@ -115,9 +112,6 @@ public class SkipCDSBuildingBlockListenerTest { @Test public void testProcessForVNFNotToSkipCDSBB() { - List flowsToExecute = new ArrayList<>(); - flowsToExecute.add(executeBuildingBlock); - flowsToExecute.add(new ExecuteBuildingBlock()); // given setBuildingBlockAndCurrentSequence(VNF_SCOPE, VNF_TEST_ACTION, 0); vnfResourceCustomization = getVnfResourceCustomizationList(false); @@ -140,9 +134,6 @@ public class SkipCDSBuildingBlockListenerTest { @Test public void testProcessForVFToSkipCDSBB() { - List flowsToExecute = new ArrayList<>(); - flowsToExecute.add(executeBuildingBlock); - flowsToExecute.add(new ExecuteBuildingBlock()); // given setBuildingBlockAndCurrentSequence(VF_SCOPE, VFModule_TEST_ACTION, 0); vfModuleCustomization = getVfModuleCustomizationList(true); @@ -162,9 +153,6 @@ public class SkipCDSBuildingBlockListenerTest { @Test public void testProcessForVFNotToSkipCDSBB() { - List flowsToExecute = new ArrayList<>(); - flowsToExecute.add(executeBuildingBlock); - flowsToExecute.add(new ExecuteBuildingBlock()); // given setBuildingBlockAndCurrentSequence(VF_SCOPE, VFModule_TEST_ACTION, 0); vfModuleCustomization = getVfModuleCustomizationList(false); @@ -184,9 +172,6 @@ public class SkipCDSBuildingBlockListenerTest { @Test public void testProcessForPNFToSkipCDSBB() { - List flowsToExecute = new ArrayList<>(); - flowsToExecute.add(executeBuildingBlock); - flowsToExecute.add(new ExecuteBuildingBlock()); // given setBuildingBlockAndCurrentSequence(PNF_SCOPE, PNFModule_TEST_ACTION, 0); pnfResourceCustomization = getPnfResourceCustomization(true); @@ -204,33 +189,8 @@ public class SkipCDSBuildingBlockListenerTest { } - @Test - public void testProcessForPNFToSkipCDSBBLastBBInList() { - List flowsToExecute = new ArrayList<>(); - flowsToExecute.add(executeBuildingBlock); - // given - setBuildingBlockAndCurrentSequence(PNF_SCOPE, PNFModule_TEST_ACTION, 0); - pnfResourceCustomization = getPnfResourceCustomization(true); - - when(catalogDbClient - .getPnfResourceCustomizationByModelCustomizationUUID(executeBuildingBlock.getBuildingBlock().getKey())) - .thenReturn(pnfResourceCustomization); - - // when - skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution); - - // then - actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE); - boolean isCompleted = buildingBlockExecution.getVariable(COMPLETED); - assertEquals(true, isCompleted); - assertEquals(0, actual); - } - @Test public void testProcessForPNFNotToSkipCDSBB() { - List flowsToExecute = new ArrayList<>(); - flowsToExecute.add(executeBuildingBlock); - flowsToExecute.add(new ExecuteBuildingBlock()); // given setBuildingBlockAndCurrentSequence(PNF_SCOPE, PNFModule_TEST_ACTION, 0); pnfResourceCustomization = getPnfResourceCustomization(false); -- cgit 1.2.3-korg