Search in sources :

Example 1 with Resource

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

the class UserParamsServiceTraversal method setVfModuleAndConfigurationWorkFlowTypeToResourceList.

private void setVfModuleAndConfigurationWorkFlowTypeToResourceList(List<Resource> resourceList, Resource vnfResource, Service validate, Vnfs vnf, VfModules vfModule, VfModuleCustomization vfModuleCustomization) {
    if ((vfModuleCustomization.getVfModule().getModuleHeatTemplate() != null && vfModuleCustomization.getHeatEnvironment() != null) || (vfModuleCustomization.getVfModule().getModelName() != null && vfModuleCustomization.getVfModule().getModelName().contains("helm"))) {
        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);
    }
}
Also used : Resource(org.onap.so.bpmn.infrastructure.workflow.tasks.Resource)

Example 2 with Resource

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

the class UserParamsServiceTraversal method setResourceListForPnfs.

private void setResourceListForPnfs(List<Resource> resourceList, Resource serviceResource, Service validate) {
    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);
    }
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) Resource(org.onap.so.bpmn.infrastructure.workflow.tasks.Resource) Pnfs(org.onap.so.serviceinstancebeans.Pnfs)

Example 3 with Resource

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

the class UserParamsServiceTraversal method setConfigurationWorkFlowTypeToResourceList.

private void setConfigurationWorkFlowTypeToResourceList(List<Resource> resourceList, Resource vnfResource, Service validate, Vnfs vnf, VfModules vfModule, Resource resource) {
    if (!vnfCustomizationUUID.isEmpty() && !vfModuleCustomizationUUID.isEmpty()) {
        List<CvnfcConfigurationCustomization> configs = traverseCatalogDbForConfiguration(validate.getModelInfo().getModelVersionId());
        for (CvnfcConfigurationCustomization config : configs) {
            Resource configResource = new Resource(WorkflowType.CONFIGURATION, config.getConfigurationResource().getModelUUID(), false, vnfResource);
            resource.setVnfCustomizationId(vnf.getModelInfo().getModelCustomizationId());
            resource.setVfModuleCustomizationId(vfModule.getModelInfo().getModelCustomizationId());
            resourceList.add(configResource);
        }
    }
}
Also used : Resource(org.onap.so.bpmn.infrastructure.workflow.tasks.Resource) CvnfcConfigurationCustomization(org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization)

Example 4 with Resource

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

the class UserParamsServiceTraversal method setResourceListForVnfs.

private void setResourceListForVnfs(DelegateExecution execution, List<Resource> resourceList, Resource serviceResource, Service validate) {
    for (Vnfs vnf : validate.getResources().getVnfs()) {
        setVnfCustomizationUUID(vnf);
        Resource vnfResource = new Resource(WorkflowType.VNF, vnf.getModelInfo().getModelCustomizationId(), false, 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);
    }
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) Resource(org.onap.so.bpmn.infrastructure.workflow.tasks.Resource) Vnfs(org.onap.so.serviceinstancebeans.Vnfs)

Example 5 with Resource

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

the class ServiceEBBLoader method traverseCatalogDbService.

public void traverseCatalogDbService(DelegateExecution execution, ServiceInstancesRequest sIRequest, List<Resource> resourceList, List<Pair<WorkflowType, String>> aaiResourceIds) throws JsonProcessingException, VrfBondingServiceException {
    String modelUUID = sIRequest.getRequestDetails().getModelInfo().getModelVersionId();
    org.onap.so.db.catalog.beans.Service service = catalogDbClient.getServiceByID(modelUUID);
    if (service == null) {
        buildAndThrowException(execution, "Could not find the service model in catalog db.");
    } else {
        Resource serviceResource = new Resource(WorkflowType.SERVICE, service.getModelUUID(), false, null);
        resourceList.add(serviceResource);
        RelatedInstance relatedVpnBinding = bbInputSetupUtils.getRelatedInstanceByType(sIRequest.getRequestDetails(), ModelType.vpnBinding);
        RelatedInstance relatedLocalNetwork = bbInputSetupUtils.getRelatedInstanceByType(sIRequest.getRequestDetails(), ModelType.network);
        if (relatedVpnBinding != null && relatedLocalNetwork != null) {
            traverseVrfConfiguration(aaiResourceIds, resourceList, serviceResource, service, relatedVpnBinding, relatedLocalNetwork);
        } else {
            traverseNetworkCollection(execution, resourceList, serviceResource, service);
        }
    }
}
Also used : RelatedInstance(org.onap.so.serviceinstancebeans.RelatedInstance) 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