Search in sources :

Example 21 with VnfResourceCustomization

use of org.onap.so.db.catalog.beans.VnfResourceCustomization in project so by onap.

the class SkipConfigVnfListenerTest method createVnfResourceCustomizationList.

private List<VnfResourceCustomization> createVnfResourceCustomizationList() {
    VnfResourceCustomization vnfResourceCustomization2 = new VnfResourceCustomization();
    vnfResourceCustomization2.setSkipPostInstConf(false);
    return new ArrayList<>(Arrays.asList(createVnfResourceCustomization(), vnfResourceCustomization2));
}
Also used : ArrayList(java.util.ArrayList) VnfResourceCustomization(org.onap.so.db.catalog.beans.VnfResourceCustomization)

Example 22 with VnfResourceCustomization

use of org.onap.so.db.catalog.beans.VnfResourceCustomization in project so by onap.

the class UpgradePreWorkflowValidatorTest method validateHappyCase.

@Test
public void validateHappyCase() 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);
    String vnfCustomiationId = UUID.randomUUID().toString();
    vnfResource.setVnfCustomizationId(vnfCustomiationId);
    Service service = new Service();
    VnfResourceCustomization vnfCustomization = new VnfResourceCustomization();
    vnfCustomization.setModelCustomizationUUID(vnfCustomiationId);
    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);
    assertFalse(message.isPresent());
}
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 23 with VnfResourceCustomization

use of org.onap.so.db.catalog.beans.VnfResourceCustomization 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 24 with VnfResourceCustomization

use of org.onap.so.db.catalog.beans.VnfResourceCustomization 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 25 with VnfResourceCustomization

use of org.onap.so.db.catalog.beans.VnfResourceCustomization in project so by onap.

the class BBInputSetup method mapVnfcCollectionInstanceGroup.

protected void mapVnfcCollectionInstanceGroup(GenericVnf genericVnf, ModelInfo modelInfo, Service service) {
    VnfResourceCustomization vnfResourceCustomization = getVnfResourceCustomizationFromService(modelInfo, service);
    if (vnfResourceCustomization != null) {
        List<VnfcInstanceGroupCustomization> vnfcInstanceGroups = vnfResourceCustomization.getVnfcInstanceGroupCustomizations();
        for (VnfcInstanceGroupCustomization vnfcInstanceGroupCust : vnfcInstanceGroups) {
            InstanceGroup instanceGroup = this.createInstanceGroup();
            org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = bbInputSetupUtils.getCatalogInstanceGroup(vnfcInstanceGroupCust.getInstanceGroup().getModelUUID());
            instanceGroup.setModelInfoInstanceGroup(this.mapperLayer.mapCatalogInstanceGroupToInstanceGroup(null, catalogInstanceGroup));
            instanceGroup.getModelInfoInstanceGroup().setFunction(vnfcInstanceGroupCust.getFunction());
            instanceGroup.getModelInfoInstanceGroup().setDescription(vnfcInstanceGroupCust.getDescription());
            genericVnf.getInstanceGroups().add(instanceGroup);
        }
    }
}
Also used : VnfResourceCustomization(org.onap.so.db.catalog.beans.VnfResourceCustomization) VnfcInstanceGroupCustomization(org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization) InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup)

Aggregations

VnfResourceCustomization (org.onap.so.db.catalog.beans.VnfResourceCustomization)43 Test (org.junit.Test)23 ArrayList (java.util.ArrayList)17 Service (org.onap.so.db.catalog.beans.Service)15 VfModuleCustomization (org.onap.so.db.catalog.beans.VfModuleCustomization)13 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)11 VnfResource (org.onap.so.db.catalog.beans.VnfResource)10 VfModule (org.onap.so.db.catalog.beans.VfModule)7 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)7 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)6 PnfResourceCustomization (org.onap.so.db.catalog.beans.PnfResourceCustomization)6 Transactional (org.springframework.transaction.annotation.Transactional)6 List (java.util.List)5 BuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock)5 VnfcInstanceGroupCustomization (org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization)5 Autowired (org.springframework.beans.factory.annotation.Autowired)5 BuildingBlockExecution (org.onap.so.bpmn.common.BuildingBlockExecution)4 Resource (org.onap.so.bpmn.infrastructure.workflow.tasks.Resource)4 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)4 NetworkResourceCustomization (org.onap.so.db.catalog.beans.NetworkResourceCustomization)4