diff options
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/VnfEBBLoader.java')
-rw-r--r-- | bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/VnfEBBLoader.java | 58 |
1 files changed, 36 insertions, 22 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/VnfEBBLoader.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/VnfEBBLoader.java index b271226414..c1d1d7ad5a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/VnfEBBLoader.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/VnfEBBLoader.java @@ -10,6 +10,8 @@ * ================================================================================ * Modifications Copyright (c) 2020 Tech Mahindra * ================================================================================ + * Modifications Copyright (c) 2021 Orange + * ================================================================================ * 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 @@ -73,9 +75,11 @@ public class VnfEBBLoader { org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceId); ServiceInstance serviceInstanceMSO = bbInputSetup.getExistingServiceInstance(serviceInstanceAAI); - resourceList.add(new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false)); + Resource serviceResource = + new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false, null); + resourceList.add(serviceResource); if (serviceInstanceMSO.getVnfs() != null) { - findVnfWithGivenId(serviceInstanceMSO, vnfId, aaiResourceIds, resourceList, execution); + findVnfWithGivenId(serviceInstanceMSO, vnfId, aaiResourceIds, resourceList, serviceResource, execution); } } catch (Exception ex) { logger.error("Exception in traverseAAIVnf", ex); @@ -90,10 +94,12 @@ public class VnfEBBLoader { org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceId); ServiceInstance serviceInstanceMSO = bbInputSetup.getExistingServiceInstance(serviceInstanceAAI); - resourceList.add(new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false)); + Resource serviceResource = + new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false, null); + resourceList.add(serviceResource); if (serviceInstanceMSO.getVnfs() != null) { findVnfWithGivenIdAndAddCustomizationUUID(serviceInstanceMSO, vnfId, aaiResourceIds, resourceList, - execution); + serviceResource, execution); } } catch (Exception ex) { logger.error("Exception in customTraverseAAIVnf", ex); @@ -104,34 +110,38 @@ public class VnfEBBLoader { } private void findVnfWithGivenId(ServiceInstance serviceInstanceMSO, String vnfId, - List<Pair<WorkflowType, String>> aaiResourceIds, List<Resource> resourceList, DelegateExecution execution) { + List<Pair<WorkflowType, String>> aaiResourceIds, List<Resource> resourceList, Resource serviceResource, + DelegateExecution execution) { for (GenericVnf vnf : serviceInstanceMSO.getVnfs()) { if (vnf.getVnfId().equals(vnfId)) { aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId())); - resourceList.add(new Resource(WorkflowType.VNF, vnf.getVnfId(), false)); - processVfModules(vnf, aaiResourceIds, resourceList, execution); - processVolumeGroups(vnf, aaiResourceIds, resourceList); + Resource vnfResource = new Resource(WorkflowType.VNF, vnf.getVnfId(), false, serviceResource); + resourceList.add(vnfResource); + processVfModules(vnf, aaiResourceIds, resourceList, vnfResource, execution); + processVolumeGroups(vnf, aaiResourceIds, resourceList, vnfResource); break; } } } private void findVnfWithGivenIdAndAddCustomizationUUID(ServiceInstance serviceInstanceMSO, String vnfId, - List<Pair<WorkflowType, String>> aaiResourceIds, List<Resource> resourceList, DelegateExecution execution) { + List<Pair<WorkflowType, String>> aaiResourceIds, List<Resource> resourceList, Resource serviceResource, + DelegateExecution execution) { for (GenericVnf vnf : serviceInstanceMSO.getVnfs()) { if (vnf.getVnfId().equals(vnfId)) { aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId())); - resourceList.add(new Resource(WorkflowType.VNF, - bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId(), false)); - processVfModules(vnf, aaiResourceIds, resourceList, execution); - processVolumeGroups(vnf, aaiResourceIds, resourceList); + Resource vnfResource = new Resource(WorkflowType.VNF, + bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId(), false, serviceResource); + resourceList.add(vnfResource); + processVfModules(vnf, aaiResourceIds, resourceList, vnfResource, execution); + processVolumeGroups(vnf, aaiResourceIds, resourceList, vnfResource); break; } } } private void findConfigurationsInsideVfModule(DelegateExecution execution, String vnfId, String vfModuleId, - List<Resource> resourceList, List<Pair<WorkflowType, String>> aaiResourceIds) { + List<Resource> resourceList, Resource vfModuleResource, List<Pair<WorkflowType, String>> aaiResourceIds) { try { org.onap.aai.domain.yang.VfModule aaiVfModule = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId); AAIResultWrapper vfModuleWrapper = new AAIResultWrapper( @@ -140,7 +150,7 @@ public class VnfEBBLoader { relationshipsOp = vfModuleWrapper.getRelationships(); if (relationshipsOp.isPresent()) { relationshipsOp = workflowActionUtils.extractRelationshipsVnfc(relationshipsOp.get()); - addConfigToResources(relationshipsOp, resourceList, aaiResourceIds); + addConfigToResources(relationshipsOp, resourceList, vfModuleResource, aaiResourceIds); } } catch (Exception ex) { logger.error("Exception in findConfigurationsInsideVfModule", ex); @@ -149,35 +159,39 @@ public class VnfEBBLoader { } private void processVfModules(GenericVnf vnf, List<Pair<WorkflowType, String>> aaiResourceIds, - List<Resource> resourceList, DelegateExecution execution) { + List<Resource> resourceList, Resource vnfResource, DelegateExecution execution) { 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)); + Resource vfModuleResource = + new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false, vnfResource); + resourceList.add(vfModuleResource); findConfigurationsInsideVfModule(execution, vnf.getVnfId(), vfModule.getVfModuleId(), resourceList, - aaiResourceIds); + vfModuleResource, aaiResourceIds); } } } private void processVolumeGroups(GenericVnf vnf, List<Pair<WorkflowType, String>> aaiResourceIds, - List<Resource> resourceList) { + List<Resource> resourceList, Resource vnfResource) { if (vnf.getVolumeGroups() != null) { for (VolumeGroup volumeGroup : vnf.getVolumeGroups()) { aaiResourceIds.add(new Pair<>(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId())); - resourceList.add(new Resource(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId(), false)); + resourceList.add( + new Resource(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId(), false, vnfResource)); } } } private void addConfigToResources(Optional<Relationships> relationshipsOp, List<Resource> resourceList, - List<Pair<WorkflowType, String>> aaiResourceIds) { + Resource vfModuleResource, List<Pair<WorkflowType, String>> aaiResourceIds) { if (relationshipsOp.isPresent()) { Optional<Configuration> config = workflowActionUtils.extractRelationshipsConfiguration(relationshipsOp.get()); if (config.isPresent()) { aaiResourceIds.add(new Pair<>(WorkflowType.CONFIGURATION, config.get().getConfigurationId())); - resourceList.add(new Resource(WorkflowType.CONFIGURATION, config.get().getConfigurationId(), false)); + resourceList.add(new Resource(WorkflowType.CONFIGURATION, config.get().getConfigurationId(), false, + vfModuleResource)); } } } |