diff options
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 { |