diff options
author | Lukasz Muszkieta <lukasz.muszkieta@nokia.com> | 2020-10-14 15:06:07 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-10-14 15:06:07 +0000 |
commit | 98c50c3184e915945dfe339284fc6dcbd8fdca9f (patch) | |
tree | 3b68ef6766aad745f0b910d00790247dc4fc4145 /bpmn/so-bpmn-tasks | |
parent | 0e4c38d31cf2d5c1b25b05357c7de6af19b61f2e (diff) | |
parent | c759aa4e6aaec556711522e6204a1b0af859d4c5 (diff) |
Merge "Fix skipPostInstConf for PNF"
Diffstat (limited to 'bpmn/so-bpmn-tasks')
2 files changed, 62 insertions, 1 deletions
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 682a0471ee..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 @@ -29,6 +29,7 @@ import org.onap.so.bpmn.common.BBConstants; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulator; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.db.catalog.beans.PnfResourceCustomization; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; @@ -48,6 +49,9 @@ public class SkipCDSBuildingBlockListener implements FlowManipulator { private Set<String> vFModuleAction = new HashSet<String>(Arrays.asList("VfModuleConfigAssign", "VfModuleConfigDeploy")); + private Set<String> pnfActions = + new HashSet<>(Arrays.asList("config-assign", "config-deploy", "PnfConfigAssign", "PnfConfigDeploy")); + @Override public boolean shouldRunFor(String currentBBName, boolean isFirst, BuildingBlockExecution execution) { @@ -95,9 +99,17 @@ public class SkipCDSBuildingBlockListener implements FlowManipulator { boolean skipVfModule = vfc.isSkipPostInstConf(); currentSequenceSkipCheck(execution, skipVfModule); } - } + } else if (currentBB.getBuildingBlock().getBpmnScope().equalsIgnoreCase("PNF") + && containsIgnoreCaseAction(currentBB, pnfActions)) { + PnfResourceCustomization pnfResourceCustomization = + catalogDbClient.getPnfResourceCustomizationByModelCustomizationUUID(customizationUUID); + if (null != pnfResourceCustomization) { + boolean skipConfigPNF = pnfResourceCustomization.isSkipPostInstConf(); + currentSequenceSkipCheck(execution, skipConfigPNF); + } + } } private boolean containsIgnoreCaseAction(ExecuteBuildingBlock currentBB, Set<String> actions) { 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 fb162f857b..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 @@ -36,6 +36,7 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.common.DelegateExecutionImpl; import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.db.catalog.beans.PnfResourceCustomization; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; @@ -47,9 +48,11 @@ public class SkipCDSBuildingBlockListenerTest { private static final String VNF_SCOPE = "VNF"; private static final String VF_SCOPE = "VFModule"; + private static final String PNF_SCOPE = "pnf"; private static final String TEST_MODELUUID = "123456789"; private static final String VNF_TEST_ACTION = "VnfConfigAssign"; private static final String VFModule_TEST_ACTION = "VfModuleConfigAssign"; + private static final String PNFModule_TEST_ACTION = "config-assign"; private static final String MODELCUSTOMIZATIONUUID = "123456789"; private static final String BBNAME = "ControllerExecutionBB"; private static final boolean ISFIRST = true; @@ -63,6 +66,7 @@ public class SkipCDSBuildingBlockListenerTest { private BuildingBlockExecution buildingBlockExecution = new DelegateExecutionImpl(new DelegateExecutionFake()); private VnfResourceCustomization vnfCust = new VnfResourceCustomization(); private VfModuleCustomization vfCust = new VfModuleCustomization(); + private PnfResourceCustomization pnfResourceCustomization = new PnfResourceCustomization(); private BuildingBlock buildingBlock = new BuildingBlock(); @InjectMocks @@ -166,6 +170,44 @@ public class SkipCDSBuildingBlockListenerTest { } + @Test + public void testProcessForPNFToSkipCDSBB() { + // 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); + assertEquals(1, actual); + + } + + @Test + public void testProcessForPNFNotToSkipCDSBB() { + // given + setBuildingBlockAndCurrentSequence(PNF_SCOPE, PNFModule_TEST_ACTION, 0); + pnfResourceCustomization = getPnfResourceCustomization(false); + + when(catalogDbClient + .getPnfResourceCustomizationByModelCustomizationUUID(executeBuildingBlock.getBuildingBlock().getKey())) + .thenReturn(pnfResourceCustomization); + + // when + skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution); + + // then + actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE); + assertEquals(0, actual); + + } + /** * setting scope action in buildingBlock and BB current sequence in BuildingBlockExecution * @@ -199,4 +241,11 @@ public class SkipCDSBuildingBlockListenerTest { return vfModuleCustomizations; } + private PnfResourceCustomization getPnfResourceCustomization(boolean setSkippost) { + PnfResourceCustomization pnfResourceCustomization = new PnfResourceCustomization(); + pnfResourceCustomization.setModelCustomizationUUID(MODELCUSTOMIZATIONUUID); + pnfResourceCustomization.setSkipPostInstConf(setSkippost); + return pnfResourceCustomization; + } + } |