diff options
author | Seshu Kumar M <seshu.kumar.m@huawei.com> | 2020-08-28 12:12:37 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-08-28 12:12:37 +0000 |
commit | 3804be5918d8bdfa7ea98c4d45bba357fd5de554 (patch) | |
tree | fc8b0f90e569e5dd0fca939a41b9a8bf2af35b4f /bpmn | |
parent | 10dbf2c86d9c2d40c41caa62d65eba94672bc51b (diff) | |
parent | e66d3fe891bacd825e1b00f08e3e71696ce7b83b (diff) |
Merge "Implement ModifyConfig SO Work flow (Day 2 configuration)"
Diffstat (limited to 'bpmn')
-rw-r--r-- | bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java | 48 |
1 files changed, 48 insertions, 0 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 75d3ddf2e6..feb5444d5b 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 @@ -300,6 +300,9 @@ public class WorkflowAction { || ("recreateInstance".equalsIgnoreCase(requestAction)))) { traverseAAIVnf(execution, resourceList, workflowResourceIds.getServiceInstanceId(), workflowResourceIds.getVnfId(), aaiResourceIds); + } else if (resourceType == WorkflowType.VNF && "updateInstance".equalsIgnoreCase(requestAction)) { + customTraverseAAIVnf(execution, resourceList, workflowResourceIds.getServiceInstanceId(), + workflowResourceIds.getVnfId(), aaiResourceIds); } else { buildAndThrowException(execution, "Current Macro Request is not supported"); } @@ -1108,6 +1111,51 @@ public class WorkflowAction { } } + private void customTraverseAAIVnf(DelegateExecution execution, List<Resource> resourceList, String serviceId, + String vnfId, List<Pair<WorkflowType, String>> aaiResourceIds) { + try { + ServiceInstance serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceId); + org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO = + bbInputSetup.getExistingServiceInstance(serviceInstanceAAI); + resourceList.add(new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false)); + if (serviceInstanceMSO.getVnfs() != null) { + for (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf : serviceInstanceMSO.getVnfs()) { + if (vnf.getVnfId().equals(vnfId)) { + aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId())); + + String vnfCustomizationUUID = + bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId(); + resourceList.add(new Resource(WorkflowType.VNF, vnfCustomizationUUID, false)); + + if (vnf.getVfModules() != null) { + for (VfModule vfModule : vnf.getVfModules()) { + aaiResourceIds.add(new Pair<>(WorkflowType.VFMODULE, vfModule.getVfModuleId())); + resourceList.add(new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false)); + findConfigurationsInsideVfModule(execution, vnf.getVnfId(), vfModule.getVfModuleId(), + resourceList, aaiResourceIds); + } + } + if (vnf.getVolumeGroups() != null) { + for (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup : vnf + .getVolumeGroups()) { + aaiResourceIds + .add(new Pair<>(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId())); + resourceList.add( + new Resource(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId(), false)); + } + } + break; + } + } + } + } catch (Exception ex) { + logger.error("Exception in customTraverseAAIVnf", ex); + buildAndThrowException(execution, + "Could not find existing Vnf or related Instances to execute the request on."); + } + + } + private void findConfigurationsInsideVfModule(DelegateExecution execution, String vnfId, String vfModuleId, List<Resource> resourceList, List<Pair<WorkflowType, String>> aaiResourceIds) { try { |