Search in sources :

Example 26 with Resource

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

the class UpgradePreWorkflowValidatorTest method validateAAIVnfsNotSupported.

@Test
public void validateAAIVnfsNotSupported() throws JsonProcessingException {
    ServiceInstancesRequest sir = new ServiceInstancesRequest();
    sir.setRequestDetails(new RequestDetails());
    sir.getRequestDetails().setModelInfo(new ModelInfo());
    sir.getRequestDetails().getModelInfo().setModelUuid(UUID.randomUUID().toString());
    String modelInvariantId = UUID.randomUUID().toString();
    sir.getRequestDetails().getModelInfo().setModelInvariantId(modelInvariantId);
    Resource serviceResource = new Resource(WorkflowType.SERVICE, "", false, null);
    serviceResource.setModelInvariantId(modelInvariantId);
    Resource vnfResource = new Resource(WorkflowType.VNF, "", false, serviceResource);
    vnfResource.setVnfCustomizationId(UUID.randomUUID().toString());
    Service service = new Service();
    VnfResourceCustomization vnfCustomization = new VnfResourceCustomization();
    vnfCustomization.setModelCustomizationUUID(UUID.randomUUID().toString());
    service.setVnfCustomizations(Arrays.asList(vnfCustomization));
    when(catalogDbClient.getServiceByModelUUID(anyString())).thenReturn(service);
    BuildingBlockExecution execution = createExecution(sir, Arrays.asList(serviceResource, vnfResource));
    Optional<String> message = validator.validate(execution);
    assertTrue(message.isPresent());
    assertTrue(message.get().startsWith("Existing vnfs in AAI are not supported by service model"));
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) BuildingBlockExecution(org.onap.so.bpmn.common.BuildingBlockExecution) Resource(org.onap.so.bpmn.infrastructure.workflow.tasks.Resource) Service(org.onap.so.db.catalog.beans.Service) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) VnfResourceCustomization(org.onap.so.db.catalog.beans.VnfResourceCustomization) Test(org.junit.Test)

Example 27 with Resource

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

the class SkipCDSBuildingBlockListenerTest method before.

@Before
public void before() {
    executeBuildingBlock = new ExecuteBuildingBlock();
    buildingBlock = new BuildingBlock();
    ArrayList<Resource> resources = new ArrayList<>();
    Resource service = new Resource(WorkflowType.SERVICE, SERVICE_MODEL_VERSION_ID, false, null);
    service.setModelVersionId(SERVICE_MODEL_VERSION_ID);
    resources.add(service);
    Resource vnf = new Resource(WorkflowType.VNF, VNF_MODEL_CUSTOMIZATION_ID, false, null);
    vnf.setModelCustomizationId(VNF_MODEL_CUSTOMIZATION_ID);
    resources.add(vnf);
    Resource vfModule = new Resource(WorkflowType.VFMODULE, VF_MODULE_CUSTOMIZATION_ID, false, null);
    vfModule.setModelCustomizationId(VF_MODULE_CUSTOMIZATION_ID);
    resources.add(vfModule);
    Resource pnf = new Resource(WorkflowType.PNF, PNF_CUSTOMIZATION_ID, false, null);
    pnf.setModelCustomizationId(PNF_CUSTOMIZATION_ID);
    resources.add(pnf);
    buildingBlockExecution.setVariable("resources", resources);
    vnfCust = new VnfResourceCustomization();
    vfCust = new VfModuleCustomization();
    pnfResourceCustomization = new PnfResourceCustomization();
}
Also used : PnfResourceCustomization(org.onap.so.db.catalog.beans.PnfResourceCustomization) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) BuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock) Resource(org.onap.so.bpmn.infrastructure.workflow.tasks.Resource) ArrayList(java.util.ArrayList) VfModuleCustomization(org.onap.so.db.catalog.beans.VfModuleCustomization) VnfResourceCustomization(org.onap.so.db.catalog.beans.VnfResourceCustomization) Before(org.junit.Before)

Example 28 with Resource

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

the class UserParamsServiceTraversal method setVolumeGroupWorkFlowTypeToResourceList.

private void setVolumeGroupWorkFlowTypeToResourceList(List<Resource> resourceList, Resource vnfResource, VfModuleCustomization vfModuleCustomization) {
    if (vfModuleCustomization.getVfModule().getVolumeHeatTemplate() != null && vfModuleCustomization.getVolumeHeatEnv() != null) {
        foundVfModuleOrVG = true;
        resourceList.add(new Resource(WorkflowType.VOLUMEGROUP, vfModuleCustomization.getModelCustomizationUUID(), false, vnfResource));
    }
}
Also used : Resource(org.onap.so.bpmn.infrastructure.workflow.tasks.Resource)

Example 29 with Resource

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

the class UserParamsServiceTraversal method setVfModuleWorkFlowTypeToResourceList.

private Resource setVfModuleWorkFlowTypeToResourceList(List<Resource> resourceList, Resource vnfResource, VfModuleCustomization vfModuleCustomization, VfModules vfModule) {
    Resource resource = new Resource(WorkflowType.VFMODULE, vfModuleCustomization.getModelCustomizationUUID(), false, vnfResource);
    resource.setProcessingPriority(vfModule.getProcessingPriority());
    resource.setBaseVfModule(vfModuleCustomization.getVfModule().getIsBase() != null && vfModuleCustomization.getVfModule().getIsBase());
    resource.setInstanceName(vfModule.getInstanceName());
    resourceList.add(resource);
    return resource;
}
Also used : Resource(org.onap.so.bpmn.infrastructure.workflow.tasks.Resource)

Example 30 with Resource

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

the class UserParamsServiceTraversal method setResourceListForNetworks.

private void setResourceListForNetworks(DelegateExecution execution, String serviceModelVersionId, String requestAction, List<Resource> resourceList, Resource serviceResource, Service validate) {
    for (Networks network : validate.getResources().getNetworks()) {
        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)) {
        String networkColCustId = queryCatalogDbForNetworkCollection(execution, serviceModelVersionId);
        if (networkColCustId != null) {
            resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, networkColCustId, false, serviceResource));
        }
    }
}
Also used : Networks(org.onap.so.serviceinstancebeans.Networks) ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) 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