diff options
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java')
5 files changed, 106 insertions, 42 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java index 2a8852a4bd..57ff837740 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java @@ -40,6 +40,8 @@ public class Resource implements Serializable { private String cvnfModuleCustomizationId; private String instanceName; private String modelInvariantId; + private String modelVersionId; + private String modelCustomizationId; private int processingPriority; private Resource parent; private List<Resource> children; @@ -140,6 +142,21 @@ public class Resource implements Serializable { this.modelInvariantId = modelInvariantId; } + public String getModelVersionId() { + return modelVersionId; + } + + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + + public String getModelCustomizationId() { + return modelCustomizationId; + } + + public void setModelCustomizationId(String modelCustomizationId) { + this.modelCustomizationId = modelCustomizationId; + } public int getProcessingPriority() { return processingPriority == 0 ? (isBaseVfModule() ? Integer.MIN_VALUE + 1 : 0) : processingPriority; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoader.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoader.java index b5ad8d8c03..cb4ee014b7 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoader.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoader.java @@ -38,6 +38,8 @@ import org.onap.so.bpmn.infrastructure.workflow.tasks.VrfBondingServiceException import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowType; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.client.exception.ExceptionBuilder; @@ -199,6 +201,7 @@ public class ServiceEBBLoader { var serviceResource = new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false, null); serviceResource.setModelInvariantId(serviceInstanceAAI.getModelInvariantId()); + serviceResource.setModelVersionId(serviceInstanceAAI.getModelVersionId()); resourceList.add(serviceResource); traverseServiceInstanceMSOVnfs(resourceList, serviceResource, aaiResourceIds, serviceInstanceMSO); traverseServiceInstanceMSOPnfs(resourceList, serviceResource, aaiResourceIds, serviceInstanceMSO); @@ -206,8 +209,15 @@ public class ServiceEBBLoader { for (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network : serviceInstanceMSO .getNetworks()) { aaiResourceIds.add(new Pair<>(WorkflowType.NETWORK, network.getNetworkId())); - resourceList - .add(new Resource(WorkflowType.NETWORK, network.getNetworkId(), false, serviceResource)); + Resource networkResource = + new Resource(WorkflowType.NETWORK, network.getNetworkId(), false, serviceResource); + ModelInfoNetwork modelInfoNetwork = network.getModelInfoNetwork(); + if (modelInfoNetwork != null) { + networkResource.setModelCustomizationId(modelInfoNetwork.getModelCustomizationUUID()); + networkResource.setModelVersionId(modelInfoNetwork.getModelUUID()); + networkResource.setModelCustomizationId(modelInfoNetwork.getModelCustomizationUUID()); + } + resourceList.add(networkResource); } } if (serviceInstanceMSO.getCollection() != null) { @@ -252,6 +262,8 @@ public class ServiceEBBLoader { GenericVnf genericVnf = bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()); Resource vnfResource = new Resource(WorkflowType.VNF, vnf.getVnfId(), false, serviceResource); vnfResource.setVnfCustomizationId(genericVnf.getModelCustomizationId()); + vnfResource.setModelCustomizationId(genericVnf.getModelCustomizationId()); + vnfResource.setModelVersionId(genericVnf.getModelVersionId()); resourceList.add(vnfResource); traverseVnfModules(resourceList, vnfResource, aaiResourceIds, vnf); if (vnf.getVolumeGroups() != null) { @@ -272,7 +284,13 @@ public class ServiceEBBLoader { } for (org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf pnf : serviceInstanceMSO.getPnfs()) { aaiResourceIds.add(new Pair<>(WorkflowType.PNF, pnf.getPnfId())); - resourceList.add(new Resource(WorkflowType.PNF, pnf.getPnfId(), false, serviceResource)); + Resource resource = new Resource(WorkflowType.PNF, pnf.getPnfId(), false, serviceResource); + ModelInfoPnf modelInfo = pnf.getModelInfoPnf(); + if (modelInfo != null) { + resource.setModelVersionId(modelInfo.getModelUuid()); + resource.setModelCustomizationId(modelInfo.getModelCustomizationUuid()); + } + resourceList.add(resource); } } @@ -437,6 +455,10 @@ public class ServiceEBBLoader { for (VfModule vfModule : vnf.getVfModules()) { aaiResourceIds.add(new Pair<>(WorkflowType.VFMODULE, vfModule.getVfModuleId())); Resource resource = new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false, vnfResource); + org.onap.aai.domain.yang.VfModule aaiVfModule = + bbInputSetupUtils.getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId()); + resource.setModelCustomizationId(aaiVfModule.getModelCustomizationId()); + resource.setModelInvariantId(aaiVfModule.getModelInvariantId()); resource.setBaseVfModule(vfModule.getModelInfoVfModule().getIsBaseBoolean()); resourceList.add(resource); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java index c383b4a73a..77cd65b946 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java @@ -38,6 +38,7 @@ import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.CvnfcCustomization; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.Networks; import org.onap.so.serviceinstancebeans.Pnfs; import org.onap.so.serviceinstancebeans.Service; @@ -93,6 +94,11 @@ public class UserParamsServiceTraversal { List<Resource> resourceList = new ArrayList<>(); Resource serviceResource = new Resource(WorkflowType.SERVICE, validate.getModelInfo().getModelVersionId(), false, null); + ModelInfo modelInfo = validate.getModelInfo(); + if (modelInfo != null) { + serviceResource.setModelVersionId(modelInfo.getModelVersionId()); + serviceResource.setModelInvariantId(modelInfo.getModelInvariantUuid()); + } resourceList.add(serviceResource); if (validate.getResources().getVnfs() != null) { setResourceListForVnfs(execution, resourceList, serviceResource, validate); @@ -115,6 +121,11 @@ public class UserParamsServiceTraversal { serviceResource); vnfResource.setProcessingPriority(vnf.getProcessingPriority()); vnfResource.setInstanceName(vnf.getInstanceName()); + ModelInfo modelInfo = vnf.getModelInfo(); + if (modelInfo != null) { + vnfResource.setModelCustomizationId(modelInfo.getModelCustomizationUuid()); + vnfResource.setModelVersionId(modelInfo.getModelVersionId()); + } resourceList.add(vnfResource); setResourceListForVfModules(execution, resourceList, vnfResource, validate, vnf); } @@ -160,6 +171,11 @@ public class UserParamsServiceTraversal { foundVfModuleOrVG = true; Resource resource = setVfModuleWorkFlowTypeToResourceList(resourceList, vnfResource, vfModuleCustomization, vfModule); + if (vnf.getModelInfo() != null) { + resource.setModelVersionId(vnf.getModelInfo().getModelVersionId()); + } + resource.setVfModuleCustomizationId(vfModuleCustomization.getModelCustomizationUUID()); + resource.setModelCustomizationId(vfModuleCustomization.getModelCustomizationUUID()); setConfigurationWorkFlowTypeToResourceList(resourceList, vnfResource, validate, vnf, vfModule, resource); } } @@ -211,6 +227,11 @@ public class UserParamsServiceTraversal { for (Pnfs pnf : validate.getResources().getPnfs()) { Resource pnfResource = new Resource(WorkflowType.PNF, pnf.getModelInfo().getModelCustomizationId(), false, serviceResource); + ModelInfo modelInfo = pnf.getModelInfo(); + if (modelInfo != null) { + pnfResource.setModelCustomizationId(modelInfo.getModelCustomizationUuid()); + pnfResource.setModelVersionId(modelInfo.getModelVersionId()); + } pnfResource.setProcessingPriority(pnf.getProcessingPriority()); resourceList.add(pnfResource); } @@ -222,6 +243,11 @@ public class UserParamsServiceTraversal { Resource networkResource = new Resource(WorkflowType.NETWORK, network.getModelInfo().getModelCustomizationId(), false, serviceResource); networkResource.setProcessingPriority(network.getProcessingPriority()); + ModelInfo modelInfo = network.getModelInfo(); + if (modelInfo != null) { + networkResource.setModelCustomizationId(modelInfo.getModelCustomizationUuid()); + networkResource.setModelVersionId(modelInfo.getModelVersionId()); + } resourceList.add(networkResource); } if (requestAction.equals(CREATE_INSTANCE)) { 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 b950eb41be..3778f64612 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 @@ -40,7 +40,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; -import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.client.exception.ExceptionBuilder; @@ -117,6 +116,9 @@ public class VnfEBBLoader { if (vnf.getVnfId().equals(vnfId)) { aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId())); Resource vnfResource = new Resource(WorkflowType.VNF, vnf.getVnfId(), false, serviceResource); + org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = bbInputSetupUtils.getAAIGenericVnf(vnfId); + vnfResource.setModelCustomizationId(aaiGenericVnf.getModelCustomizationId()); + vnfResource.setModelVersionId(aaiGenericVnf.getModelVersionId()); resourceList.add(vnfResource); processVfModules(vnf, aaiResourceIds, resourceList, vnfResource, execution); processVolumeGroups(vnf, aaiResourceIds, resourceList, vnfResource); @@ -131,8 +133,11 @@ public class VnfEBBLoader { for (GenericVnf vnf : serviceInstanceMSO.getVnfs()) { if (vnf.getVnfId().equals(vnfId)) { aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId())); - Resource vnfResource = new Resource(WorkflowType.VNF, - bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId(), false, serviceResource); + org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = bbInputSetupUtils.getAAIGenericVnf(vnfId); + Resource vnfResource = + new Resource(WorkflowType.VNF, aaiGenericVnf.getModelCustomizationId(), false, serviceResource); + vnfResource.setModelCustomizationId(aaiGenericVnf.getModelCustomizationId()); + vnfResource.setModelVersionId(aaiGenericVnf.getModelVersionId()); resourceList.add(vnfResource); processVfModules(vnf, aaiResourceIds, resourceList, vnfResource, execution); processVolumeGroups(vnf, aaiResourceIds, resourceList, vnfResource); @@ -141,10 +146,10 @@ public class VnfEBBLoader { } } - private void findConfigurationsInsideVfModule(DelegateExecution execution, String vnfId, String vfModuleId, - List<Resource> resourceList, Resource vfModuleResource, List<Pair<WorkflowType, String>> aaiResourceIds) { + private void findConfigurationsInsideVfModule(DelegateExecution execution, + org.onap.aai.domain.yang.VfModule aaiVfModule, 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( new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiVfModule)); Optional<Relationships> relationshipsOp; @@ -166,11 +171,14 @@ public class VnfEBBLoader { aaiResourceIds.add(new Pair<>(WorkflowType.VFMODULE, vfModule.getVfModuleId())); Resource vfModuleResource = new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false, vnfResource); - Optional.ofNullable(vfModule.getModelInfoVfModule()).map(ModelInfoVfModule::getIsBaseBoolean) - .ifPresent(vfModuleResource::setBaseVfModule); + org.onap.aai.domain.yang.VfModule aaiVfModule = + bbInputSetupUtils.getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId()); + vfModuleResource.setModelInvariantId(aaiVfModule.getModelInvariantId()); + vfModuleResource.setModelCustomizationId(aaiVfModule.getModelCustomizationId()); + vfModuleResource.setBaseVfModule(aaiVfModule.isIsBaseVfModule()); resourceList.add(vfModuleResource); - findConfigurationsInsideVfModule(execution, vnf.getVnfId(), vfModule.getVfModuleId(), resourceList, - vfModuleResource, aaiResourceIds); + findConfigurationsInsideVfModule(execution, aaiVfModule, resourceList, vfModuleResource, + aaiResourceIds); } } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java index ff6c113af3..dc77ea1f0c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java @@ -24,12 +24,10 @@ import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; -import org.apache.logging.log4j.util.Strings; import org.onap.so.bpmn.common.BBConstants; import org.onap.so.bpmn.common.BuildingBlockExecution; -import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner; import org.onap.so.bpmn.common.listener.flowmanipulator.PreFlowManipulator; -import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.infrastructure.workflow.tasks.Resource; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.db.catalog.beans.PnfResourceCustomization; import org.onap.so.db.catalog.beans.Service; @@ -40,7 +38,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; @Component public class SkipCDSBuildingBlockListener implements PreFlowManipulator { @@ -76,43 +73,37 @@ public class SkipCDSBuildingBlockListener implements PreFlowManipulator { @Override public void run(List<ExecuteBuildingBlock> flowsToExecute, ExecuteBuildingBlock currentBB, BuildingBlockExecution execution) { - String customizationUUID = currentBB.getBuildingBlock().getKey(); + String resourceKey = currentBB.getBuildingBlock().getKey(); + List<Resource> resources = execution.getVariable("resources"); + Resource resource = resources.stream().filter(r -> resourceKey.equals(r.getResourceId())).findFirst() + .orElseThrow(() -> new IllegalArgumentException("Resource not found for key:" + resourceKey)); - if ("SERVICE".equalsIgnoreCase(currentBB.getBuildingBlock().getBpmnScope())) { - String modelUUID = currentBB.getRequestDetails().getModelInfo().getModelUuid(); - Service service = catalogDbClient.getServiceByID(modelUUID); - currentSequenceSkipCheck(execution, service.getSkipPostInstConf()); - } else if (currentBB.getBuildingBlock().getBpmnScope().equalsIgnoreCase("VNF") - && containsIgnoreCaseAction(currentBB, vnfActions)) { - List<VnfResourceCustomization> vnfResourceCustomizations = - catalogDbClient.getVnfResourceCustomizationByModelUuid( - currentBB.getRequestDetails().getModelInfo().getModelUuid()); - if (!CollectionUtils.isEmpty(vnfResourceCustomizations)) { - VnfResourceCustomization vrc = catalogDbClient.findVnfResourceCustomizationInList(customizationUUID, - vnfResourceCustomizations); - if (null != vrc) { - logger.debug("getSkipPostInstConf value: " + vrc.getSkipPostInstConf().booleanValue()); - boolean skipConfigVNF = vrc.getSkipPostInstConf().booleanValue(); - currentSequenceSkipCheck(execution, skipConfigVNF); - } + String scope = currentBB.getBuildingBlock().getBpmnScope(); + if ("SERVICE".equalsIgnoreCase(scope)) { + Service service = catalogDbClient.getServiceByID(resource.getModelVersionId()); + currentSequenceSkipCheck(execution, service.getSkipPostInstConf()); + } else if ("VNF".equalsIgnoreCase(scope) && containsIgnoreCaseAction(currentBB, vnfActions)) { + VnfResourceCustomization vrc = catalogDbClient + .getVnfResourceCustomizationByModelCustomizationUUID(resource.getModelCustomizationId()); + if (vrc != null) { + logger.debug("getSkipPostInstConf value: " + vrc.getSkipPostInstConf()); + boolean skipConfigVNF = vrc.getSkipPostInstConf(); + currentSequenceSkipCheck(execution, skipConfigVNF); } } else if (currentBB.getBuildingBlock().getBpmnScope().equalsIgnoreCase("VFModule") && containsIgnoreCaseAction(currentBB, vFModuleAction)) { - - VfModuleCustomization vfc = - catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID(customizationUUID); - + VfModuleCustomization vfc = catalogDbClient + .getVfModuleCustomizationByModelCuztomizationUUID(resource.getModelCustomizationId()); if (null != vfc) { logger.debug("getSkipPostInstConf value: " + vfc.getSkipPostInstConf().booleanValue()); boolean skipVfModule = vfc.getSkipPostInstConf(); currentSequenceSkipCheck(execution, skipVfModule); } - } else if (currentBB.getBuildingBlock().getBpmnScope().equalsIgnoreCase("PNF") && containsIgnoreCaseAction(currentBB, pnfActions)) { - PnfResourceCustomization pnfResourceCustomization = - catalogDbClient.getPnfResourceCustomizationByModelCustomizationUUID(customizationUUID); + PnfResourceCustomization pnfResourceCustomization = catalogDbClient + .getPnfResourceCustomizationByModelCustomizationUUID(resource.getModelCustomizationId()); if (null != pnfResourceCustomization) { logger.debug("getSkipPostInstConf value: " + pnfResourceCustomization.getSkipPostInstConf()); |