Search in sources :

Example 6 with Resource

use of org.onap.so.bpmn.infrastructure.workflow.tasks.Resource in project so by onap.

the class ServiceEBBLoader method traverseVrfConfiguration.

protected void traverseVrfConfiguration(List<Pair<WorkflowType, String>> aaiResourceIds, List<Resource> resourceList, Resource serviceResource, org.onap.so.db.catalog.beans.Service service, RelatedInstance relatedVpnBinding, RelatedInstance relatedLocalNetwork) throws VrfBondingServiceException, JsonProcessingException {
    org.onap.aai.domain.yang.L3Network aaiLocalNetwork = bbInputSetupUtils.getAAIL3Network(relatedLocalNetwork.getInstanceId());
    vrfValidation.vrfServiceValidation(service);
    vrfValidation.vrfCatalogDbChecks(service);
    vrfValidation.aaiVpnBindingValidation(relatedVpnBinding.getInstanceId(), bbInputSetupUtils.getAAIVpnBinding(relatedVpnBinding.getInstanceId()));
    vrfValidation.aaiNetworkValidation(relatedLocalNetwork.getInstanceId(), aaiLocalNetwork);
    vrfValidation.aaiSubnetValidation(aaiLocalNetwork);
    vrfValidation.aaiAggregateRouteValidation(aaiLocalNetwork);
    vrfValidation.aaiRouteTargetValidation(aaiLocalNetwork);
    String existingAAIVrfConfiguration = getExistingAAIVrfConfiguration(relatedVpnBinding, aaiLocalNetwork);
    if (existingAAIVrfConfiguration != null) {
        aaiResourceIds.add(new Pair<>(WorkflowType.CONFIGURATION, existingAAIVrfConfiguration));
    }
    resourceList.add(new Resource(WorkflowType.CONFIGURATION, service.getConfigurationCustomizations().get(0).getModelCustomizationUUID(), false, serviceResource));
}
Also used : Resource(org.onap.so.bpmn.infrastructure.workflow.tasks.Resource)

Example 7 with Resource

use of org.onap.so.bpmn.infrastructure.workflow.tasks.Resource in project so by onap.

the class ServiceEBBLoader method traverseServiceInstanceMSOVnfs.

private void traverseServiceInstanceMSOVnfs(List<Resource> resourceList, Resource serviceResource, List<Pair<WorkflowType, String>> aaiResourceIds, org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO) {
    if (serviceInstanceMSO.getVnfs() == null) {
        return;
    }
    for (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf : serviceInstanceMSO.getVnfs()) {
        aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId()));
        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) {
            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, vnfResource));
            }
        }
    }
}
Also used : GenericVnf(org.onap.aai.domain.yang.GenericVnf) Resource(org.onap.so.bpmn.infrastructure.workflow.tasks.Resource)

Example 8 with Resource

use of org.onap.so.bpmn.infrastructure.workflow.tasks.Resource in project so by onap.

the class VnfEBBLoader method findVnfWithGivenId.

private void findVnfWithGivenId(ServiceInstance serviceInstanceMSO, String vnfId, 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()));
            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);
            break;
        }
    }
}
Also used : GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) Resource(org.onap.so.bpmn.infrastructure.workflow.tasks.Resource)

Example 9 with Resource

use of org.onap.so.bpmn.infrastructure.workflow.tasks.Resource in project so by onap.

the class VnfEBBLoader method customTraverseAAIVnf.

public void customTraverseAAIVnf(DelegateExecution execution, List<Resource> resourceList, String serviceId, String vnfId, List<Pair<WorkflowType, String>> aaiResourceIds) {
    try {
        org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceId);
        ServiceInstance serviceInstanceMSO = bbInputSetup.getExistingServiceInstance(serviceInstanceAAI);
        Resource serviceResource = new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false, null);
        resourceList.add(serviceResource);
        if (serviceInstanceMSO.getVnfs() != null) {
            findVnfWithGivenIdAndAddCustomizationUUID(serviceInstanceMSO, vnfId, aaiResourceIds, resourceList, serviceResource, execution);
        }
    } catch (Exception ex) {
        logger.error("Exception in customTraverseAAIVnf", ex);
        buildAndThrowException(execution, "Could not find existing Vnf or related Instances to execute the request on.");
    }
}
Also used : Resource(org.onap.so.bpmn.infrastructure.workflow.tasks.Resource) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)

Example 10 with Resource

use of org.onap.so.bpmn.infrastructure.workflow.tasks.Resource in project so by onap.

the class VnfEBBLoader method processVolumeGroups.

private void processVolumeGroups(GenericVnf vnf, List<Pair<WorkflowType, String>> aaiResourceIds, 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, vnfResource));
        }
    }
}
Also used : VolumeGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup) Resource(org.onap.so.bpmn.infrastructure.workflow.tasks.Resource)

Aggregations

Resource (org.onap.so.bpmn.infrastructure.workflow.tasks.Resource)40 Test (org.junit.Test)14 ArrayList (java.util.ArrayList)10 BaseTaskTest (org.onap.so.bpmn.BaseTaskTest)9 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)8 CollectionResource (org.onap.so.db.catalog.beans.CollectionResource)7 ServiceInstancesRequest (org.onap.so.serviceinstancebeans.ServiceInstancesRequest)6 Pair (org.javatuples.Pair)5 Service (org.onap.so.db.catalog.beans.Service)5 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)4 BuildingBlockExecution (org.onap.so.bpmn.common.BuildingBlockExecution)4 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)4 VnfResourceCustomization (org.onap.so.db.catalog.beans.VnfResourceCustomization)4 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)4 Mockito.anyString (org.mockito.Mockito.anyString)3 Relationship (org.onap.aai.domain.yang.Relationship)3 Configuration (org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration)3 VfModule (org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)3 ConfigurationResource (org.onap.so.db.catalog.beans.ConfigurationResource)3 VfModuleCustomization (org.onap.so.db.catalog.beans.VfModuleCustomization)3