From cae11c1fa7d2c939fd69b30635eddcd845ff82b6 Mon Sep 17 00:00:00 2001 From: "Kalkere Ramesh, Sharan" Date: Thu, 12 Nov 2020 13:02:17 -0500 Subject: added in fix for new vnfc model id populate in added in fix for new vnfc model id populate in tasks added junit for postProcessingExecuteBBActivateVfModule added confirmation test for cust ID update on replace Issue-ID: SO-3379 Signed-off-by: Benjamin, Max (mb388a) Change-Id: Id638d091f0f2d8c7ebb2c7651cce5139f82e272b --- .../workflow/tasks/WorkflowActionBBTasks.java | 55 +++++++++++++--------- 1 file changed, 34 insertions(+), 21 deletions(-) (limited to 'bpmn/so-bpmn-tasks/src/main/java/org') 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 217b3a848e..2be8595336 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 @@ -78,6 +78,7 @@ public class WorkflowActionBBTasks { private static final String ROLLBACKTOCREATEDNOCONFIGURATION = "RollbackToCreatedNoConfiguration"; private static final String REPLACEINSTANCE = "replaceInstance"; private static final String VFMODULE = "VfModule"; + private static final String CONFIGURATION_PATTERN = "(Ad|De)(.*)FabricConfiguration(.*)"; protected String maxRetries = "mso.rainyDay.maxRetries"; private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBTasks.class); @@ -417,12 +418,9 @@ public class WorkflowActionBBTasks { String handlingCode = (String) execution.getVariable(HANDLINGCODE); final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE); int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE); - String requestAction = (String) execution.getVariable(G_ACTION); ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence - 1); String bbFlowName = ebb.getBuildingBlock().getBpmnFlowName(); - if ("ActivateVfModuleBB".equalsIgnoreCase(bbFlowName) && aLaCarte && "Success".equalsIgnoreCase(handlingCode) - && !(requestAction.equalsIgnoreCase("replaceInstance") - || requestAction.equalsIgnoreCase("replaceInstanceRetainAssignments"))) { + if ("ActivateVfModuleBB".equalsIgnoreCase(bbFlowName) && aLaCarte && "Success".equalsIgnoreCase(handlingCode)) { postProcessingExecuteBBActivateVfModule(execution, ebb, flowsToExecute); } } @@ -430,6 +428,7 @@ public class WorkflowActionBBTasks { protected void postProcessingExecuteBBActivateVfModule(DelegateExecution execution, ExecuteBuildingBlock ebb, List flowsToExecute) { try { + String requestAction = (String) execution.getVariable(G_ACTION); String serviceInstanceId = ebb.getWorkflowResourceIds().getServiceInstanceId(); String vnfId = ebb.getWorkflowResourceIds().getVnfId(); String vfModuleId = ebb.getResourceId(); @@ -444,26 +443,40 @@ public class WorkflowActionBBTasks { for (Vnfc vnfc : vnfcs) { String modelCustomizationId = vnfc.getModelCustomizationId(); logger.debug("Processing Vnfc: {}", modelCustomizationId); - CvnfcConfigurationCustomization fabricConfig = catalogDbClient.getCvnfcCustomization(serviceModelUUID, - vnfCustomizationUUID, vfModuleCustomizationUUID, modelCustomizationId); - if (fabricConfig != null && fabricConfig.getConfigurationResource() != null - && fabricConfig.getConfigurationResource().getToscaNodeType() != null - && fabricConfig.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)) { - String configurationId = getConfigurationId(vnfc); - ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys(); - configurationResourceKeys.setCvnfcCustomizationUUID(modelCustomizationId); - configurationResourceKeys.setVfModuleCustomizationUUID(vfModuleCustomizationUUID); - configurationResourceKeys.setVnfResourceCustomizationUUID(vnfCustomizationUUID); - configurationResourceKeys.setVnfcName(vnfc.getVnfcName()); - ExecuteBuildingBlock addConfigBB = getExecuteBBForConfig(ADD_FABRIC_CONFIGURATION_BB, ebb, - configurationId, configurationResourceKeys); - flowsToExecute.add(addConfigBB); - flowsToExecute.forEach(executeBB -> logger.info("Flows to Execute After Post Processing: {}", - executeBB.getBuildingBlock().getBpmnFlowName())); + if (requestAction.equalsIgnoreCase("replaceInstance") + || requestAction.equalsIgnoreCase("replaceInstanceRetainAssignments")) { + List configBBs = flowsToExecute.stream() + .filter(item -> !item.getBuildingBlock().getBpmnFlowName().matches(CONFIGURATION_PATTERN)) + .collect(Collectors.toList()); + for (ExecuteBuildingBlock bb : configBBs) { + bb.getConfigurationResourceKeys().setCvnfcCustomizationUUID(modelCustomizationId); + bb.getConfigurationResourceKeys().setVnfcName(vnfc.getVnfcName()); + } execution.setVariable("flowsToExecute", flowsToExecute); execution.setVariable(COMPLETED, false); } else { - logger.debug("No cvnfcCustomization found for customizationId: {}", modelCustomizationId); + CvnfcConfigurationCustomization fabricConfig = catalogDbClient.getCvnfcCustomization( + serviceModelUUID, vnfCustomizationUUID, vfModuleCustomizationUUID, modelCustomizationId); + if (fabricConfig != null && fabricConfig.getConfigurationResource() != null + && fabricConfig.getConfigurationResource().getToscaNodeType() != null && fabricConfig + .getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)) { + String configurationId = getConfigurationId(vnfc); + ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys(); + configurationResourceKeys.setCvnfcCustomizationUUID(modelCustomizationId); + configurationResourceKeys.setVfModuleCustomizationUUID(vfModuleCustomizationUUID); + configurationResourceKeys.setVnfResourceCustomizationUUID(vnfCustomizationUUID); + configurationResourceKeys.setVnfcName(vnfc.getVnfcName()); + ExecuteBuildingBlock addConfigBB = getExecuteBBForConfig(ADD_FABRIC_CONFIGURATION_BB, ebb, + configurationId, configurationResourceKeys); + flowsToExecute.add(addConfigBB); + flowsToExecute.stream() + .forEach(executeBB -> logger.info("Flows to Execute After Post Processing: {}", + executeBB.getBuildingBlock().getBpmnFlowName())); + execution.setVariable("flowsToExecute", flowsToExecute); + execution.setVariable(COMPLETED, false); + } else { + logger.debug("No cvnfcCustomization found for customizationId: {}", modelCustomizationId); + } } } } catch (EntityNotFoundException e) { -- cgit 1.2.3-korg