diff options
author | Sunil <sb00577584@techmahindra.com> | 2020-04-25 13:48:21 +0530 |
---|---|---|
committer | Sunil Kumar Biradar <SB00577584@techmahindra.com> | 2020-04-28 04:54:08 +0000 |
commit | fe7a17f308f23ea8963d0948b5dc5388d626c1f9 (patch) | |
tree | 6dd096779948c211fcd39d3f94a84dfc9d2fdd6a /bpmn/so-bpmn-tasks | |
parent | 0151f5c120f7d325a337efd522f7b46b0f027a1f (diff) |
Adding Generic VNF information in ControllerExeuctionBB flow
Solving BlueprintName and BlueprintVersion issue
Changing vf-module to vfmodule
Updating AAI with Orchestration status
Issue-ID: SO-2806
Signed-off-by: sunilb <sb00577584@techmahindra.com>
Change-Id: I91aa653b946bae3940000f724710de87af3ce7df
Diffstat (limited to 'bpmn/so-bpmn-tasks')
6 files changed, 74 insertions, 14 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java index 0190e693be..cc630232c2 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java @@ -7,6 +7,7 @@ * Modifications Copyright (c) 2019 Samsung * Modifications Copyright (c) 2019 Bell Canada. * Modifications Copyright (c) 2020 Nokia + * Modifications Copyright (c) 2020 Tech Mahindra * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -568,6 +569,21 @@ public class AAIUpdateTasks { updateOrchestrationStatusForVnf(execution, OrchestrationStatus.CONFIGURED); } + /** + * BPMN access method to update status of Vnf/vfmodule to configAssigned/ConfigDeployed in AAI + */ + public void updateOrchestrationStatus(BuildingBlockExecution execution, String scope, String action) { + if (scope.equalsIgnoreCase("vnf") && action.equalsIgnoreCase("config-assign")) { + updateOrchestrationStatusForVnf(execution, OrchestrationStatus.CONFIGASSIGNED); + } else if (scope.equalsIgnoreCase("vnf") && action.equalsIgnoreCase("config-deploy")) { + updateOrchestrationStatusForVnf(execution, OrchestrationStatus.CONFIGDEPLOYED); + } else if (scope.equalsIgnoreCase("vfModule") && action.equalsIgnoreCase("config-assign")) { + updateOrchestrationStatusForVfModule(execution, OrchestrationStatus.CONFIGASSIGNED); + } else if (scope.equalsIgnoreCase("vfModule") && action.equalsIgnoreCase("config-deploy")) { + updateOrchestrationStatusForVfModule(execution, OrchestrationStatus.CONFIGDEPLOYED); + } + } + private void updateOrchestrationStatusForService(BuildingBlockExecution execution, OrchestrationStatus status) { try { ServiceInstance serviceInstance = diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java index 86d56005f6..754c377914 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java @@ -39,7 +39,7 @@ import org.springframework.stereotype.Component; @Component public class ControllerExecution { private static final Logger logger = LoggerFactory.getLogger(ControllerExecution.class); - private static final String CONTROLLER_ACTOR = "controllerActor"; + private static final String CONTROLLER_ACTOR = "actor"; private static final String BUILDING_BLOCK = "buildingBlock"; private static final String SCOPE = "scope"; private static final String ACTION = "action"; @@ -59,9 +59,9 @@ public class ControllerExecution { public void setControllerActorScopeAction(BuildingBlockExecution execution) { try { GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - String modleUuid = genericVnf.getModelInfoGenericVnf().getModelCustomizationUuid(); + String modelUuid = genericVnf.getModelInfoGenericVnf().getModelCustomizationUuid(); VnfResourceCustomization vnfResourceCustomization = - catalogDbClient.getVnfResourceCustomizationByModelCustomizationUUID(modleUuid); + catalogDbClient.getVnfResourceCustomizationByModelCustomizationUUID(modelUuid); // Fetching Controller Actor at VNF level if null then Controller Actor is set as "APPC" String controllerActor = Optional.ofNullable(vnfResourceCustomization.getControllerActor()).orElse("APPC"); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericCDSProcessingBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericCDSProcessingBB.java index f568026aa5..854678a6a6 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericCDSProcessingBB.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericCDSProcessingBB.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2019 Bell Canada * ================================================================================ + * Modifications Copyright (c) 2020 Tech Mahindra + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -34,7 +36,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** - * For Vnf/Vf-Module/Service BuildingBlockExecution is being used. + * This class is used in context of Building Block flow for configuration of vnf/vfmodule/service. * * @param - BuildingBlockExecution */ @@ -44,15 +46,12 @@ public class GenericCDSProcessingBB implements ControllerRunnable<BuildingBlockE private static final String EXECUTION_OBJECT = "executionObject"; public static final String CDS_ACTOR = "cds"; public static final String VNF_SCOPE = "vnf"; - public static final String VF_MODULE_SCOPE = "vf-module"; + public static final String VF_MODULE_SCOPE = "vfmodule"; @Autowired private ExceptionBuilder exceptionBuilder; @Autowired - private ExtractPojosForBB extractPojosForBB; - - @Autowired private AbstractCDSProcessingBBUtils cdsDispather; @Autowired 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 d26b9d6d03..f83c0fce86 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 @@ -8,6 +8,8 @@ * ================================================================================ * Modifications Copyright (c) 2020 Nokia * ================================================================================ + * Modifications Copyright (c) 2020 Tech Mahindra + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -139,6 +141,7 @@ public class WorkflowAction { private static final String ACTIVATENETWORKBB = "ActivateNetworkBB"; private static final String VOLUMEGROUP_DELETE_PATTERN = "(Un|De)(.*)Volume(.*)"; private static final String VOLUMEGROUP_CREATE_PATTERN = "(A|C)(.*)Volume(.*)"; + private static final String CONTROLLER = "Controller"; @Autowired protected BBInputSetup bbInputSetup; @@ -664,8 +667,10 @@ public class WorkflowAction { resourceId = UUID.randomUUID().toString(); } for (ExecuteBuildingBlock ebb : flowsToExecute) { - if (key != null && key.equalsIgnoreCase(ebb.getBuildingBlock().getKey()) - && ebb.getBuildingBlock().getBpmnFlowName().contains(resourceType.toString())) { + if (key != null && key.equalsIgnoreCase(ebb.getBuildingBlock().getKey()) && (ebb.getBuildingBlock() + .getBpmnFlowName().contains(resourceType.toString()) + || (ebb.getBuildingBlock().getBpmnFlowName().contains(CONTROLLER) + && ebb.getBuildingBlock().getBpmnScope().equalsIgnoreCase(resourceType.toString())))) { WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); workflowResourceIds.setServiceInstanceId(serviceInstanceId); WorkflowResourceIdsUtils.setResourceIdByWorkflowType(workflowResourceIds, resourceType, resourceId); @@ -1332,7 +1337,8 @@ public class WorkflowAction { addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.SERVICE, orchFlow, requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, false); - } else if (orchFlow.getFlowName().contains(VNF)) { + } else if (orchFlow.getFlowName().contains(VNF) || (orchFlow.getFlowName().contains(CONTROLLER) + && (VNF).equalsIgnoreCase(orchFlow.getBpmnScope()))) { addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.VNF, orchFlow, requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, false); @@ -1348,7 +1354,8 @@ public class WorkflowAction { addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.VIRTUAL_LINK, orchFlow, requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, true, false); - } else if (orchFlow.getFlowName().contains(VFMODULE)) { + } else if (orchFlow.getFlowName().contains(VFMODULE) || (orchFlow.getFlowName().contains(CONTROLLER) + && (VFMODULE).equalsIgnoreCase(orchFlow.getBpmnScope()))) { List<Resource> vfModuleResourcesSorted = null; if (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE) || requestAction.equals("activateInstance")) { diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java index e5b003a437..a7dfe7f7a4 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2020 Tech Mahindra + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -753,4 +755,40 @@ public class AAIUpdateTasksTest extends BaseTaskTest { when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.PNF))).thenReturn(pnf); return pnf; } + + @Test + public void updateOrchestrationStatusVnfConfigAssignedTest() throws Exception { + doNothing().when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.CONFIGASSIGNED); + + aaiUpdateTasks.updateOrchestrationStatus(execution, "vnf", "config-assign"); + + verify(aaiVnfResources, times(1)).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.CONFIGASSIGNED); + } + + @Test + public void updateOrchestrationStatusVnfConfigDeployedTest() throws Exception { + doNothing().when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.CONFIGDEPLOYED); + + aaiUpdateTasks.updateOrchestrationStatus(execution, "vnf", "config-deploy"); + + verify(aaiVnfResources, times(1)).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.CONFIGDEPLOYED); + } + + @Test + public void updateOrchestrationStatusVfModuleConfigDeployedTest() throws Exception { + doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, + OrchestrationStatus.CONFIGDEPLOYED); + aaiUpdateTasks.updateOrchestrationStatus(execution, "vfmodule", "config-deploy"); + verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, + OrchestrationStatus.CONFIGDEPLOYED); + } + + @Test + public void updateOrchestrationStatusVfModuleConfigAssignedTest() throws Exception { + doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, + OrchestrationStatus.CONFIGASSIGNED); + aaiUpdateTasks.updateOrchestrationStatus(execution, "vfmodule", "config-assign"); + verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, + OrchestrationStatus.CONFIGASSIGNED); + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecutionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecutionTest.java index 72a987c395..f35939ec39 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecutionTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecutionTest.java @@ -99,7 +99,7 @@ public class ControllerExecutionTest extends BaseTaskTest { controllerExecution.setControllerActorScopeAction(execution); assertEquals(TEST_SCOPE, execution.getVariable("scope")); assertEquals(TEST_ACTION, execution.getVariable("action")); - assertEquals(TEST_CONTROLLER_ACTOR, execution.getVariable("controllerActor")); + assertEquals(TEST_CONTROLLER_ACTOR, execution.getVariable("actor")); } @@ -114,7 +114,7 @@ public class ControllerExecutionTest extends BaseTaskTest { bbNameSelectionReference.setScope(TEST_SCOPE); doReturn(bbNameSelectionReference).when(catalogDbClient).getBBNameSelectionReference(TEST_CONTROLLER_ACTOR, TEST_SCOPE, TEST_ACTION); - execution.setVariable("controllerActor", TEST_CONTROLLER_ACTOR); + execution.setVariable("actor", TEST_CONTROLLER_ACTOR); execution.setVariable("scope", TEST_SCOPE); execution.setVariable("action", TEST_ACTION); |