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));
}
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());
}
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"));
}
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();
}
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);
}
}
}
Aggregations