use of org.onap.so.serviceinstancebeans.ModelInfo in project so by onap.
the class BBInputSetupTest method testGetVolumeGroupIdRelatedToVfModule.
@Test
public void testGetVolumeGroupIdRelatedToVfModule() {
String expected = "volumeGroupId";
String modelCustomizationId = "modelCustomizationId";
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelCustomizationId(modelCustomizationId);
String cloudOwner = "cloudOwner";
String cloudRegionId = "cloudRegionId";
String volumeGroupId = "volumeGroupId";
GenericVnf vnf = new GenericVnf();
VolumeGroup volumeGroup = new VolumeGroup();
volumeGroup.setVolumeGroupId(expected);
vnf.getVolumeGroups().add(volumeGroup);
Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, null);
org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup = new org.onap.aai.domain.yang.VolumeGroup();
aaiVolumeGroup.setModelCustomizationId(modelCustomizationId);
doReturn(aaiVolumeGroup).when(SPY_bbInputSetupUtils).getAAIVolumeGroup(cloudOwner, cloudRegionId, volumeGroupId);
Optional<String> actual = SPY_bbInputSetup.getVolumeGroupIdRelatedToVfModule(vnf, modelInfo, cloudOwner, cloudRegionId, lookupKeyMap);
assertEquals(expected, actual.get());
}
use of org.onap.so.serviceinstancebeans.ModelInfo in project so by onap.
the class BBInputSetupTest method testMapCatalogVfModuleIfNoVfUnderVnf.
@Test
public void testMapCatalogVfModuleIfNoVfUnderVnf() {
String vnfModelCustomizationUUID = "vnfResourceCustUUID";
String vfModuleCustomizationUUID = "vfModelCustomizationUUID";
VfModule vfModule = new VfModule();
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelCustomizationUuid(vfModuleCustomizationUUID);
Service service = new Service();
VnfResourceCustomization vnfResourceCust = new VnfResourceCustomization();
vnfResourceCust.setModelCustomizationUUID(vnfModelCustomizationUUID);
VfModuleCustomization vfModuleCust = new VfModuleCustomization();
vfModuleCust.setModelCustomizationUUID(vfModuleCustomizationUUID);
ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
doReturn(vfModuleCust).when(SPY_bbInputSetupUtils).getVfModuleCustomizationByModelCuztomizationUUID(vfModuleCustomizationUUID);
doReturn(modelInfoVfModule).when(bbInputSetupMapperLayer).mapCatalogVfModuleToVfModule(vfModuleCust);
SPY_bbInputSetup.mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID);
assertThat(vfModule.getModelInfoVfModule(), sameBeanAs(modelInfoVfModule));
verify(SPY_bbInputSetupUtils, times(1)).getVfModuleCustomizationByModelCuztomizationUUID(modelInfo.getModelCustomizationId());
}
use of org.onap.so.serviceinstancebeans.ModelInfo in project so by onap.
the class ConfigureInstanceParamsForVnfTest method createVnfs.
private List<Vnfs> createVnfs() {
Vnfs vnf1 = new Vnfs();
vnf1.setInstanceName(VNF_1_INSTANCE_NAME);
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelCustomizationId(VNF_1_CUSTOMIZATION_ID);
vnf1.setModelInfo(modelInfo);
vnf1.setInstanceParams(VNF_1_INSTANCE_PARAMS);
Vnfs vnf2 = new Vnfs();
modelInfo = new ModelInfo();
modelInfo.setModelCustomizationId(VNF_2_CUSTOMIZATION_ID);
vnf2.setModelInfo(modelInfo);
vnf2.setInstanceName(VNF_2_INSTANCE_NAME);
vnf2.setInstanceParams(VNF_2_INSTANCE_PARAMS);
return Arrays.asList(vnf1, vnf2);
}
use of org.onap.so.serviceinstancebeans.ModelInfo in project so by onap.
the class ServiceInstancesTest method setServiceTypeTest.
@Test
public void setServiceTypeTest() throws JsonProcessingException {
String requestScope = ModelType.service.toString();
Boolean aLaCarteFlag = false;
ServiceInstancesRequest sir = new ServiceInstancesRequest();
RequestDetails requestDetails = new RequestDetails();
RequestInfo requestInfo = new RequestInfo();
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelVersionId("0dd91181-49da-446b-b839-cd959a96f04a");
requestInfo.setSource("VID");
requestDetails.setModelInfo(modelInfo);
requestDetails.setRequestInfo(requestInfo);
sir.setRequestDetails(requestDetails);
Service defaultService = new Service();
defaultService.setServiceType("testServiceType");
wireMockServer.stubFor(get(urlMatching(".*/service/0dd91181-49da-446b-b839-cd959a96f04a")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
String serviceType = requestHandlerUtils.getServiceType(requestScope, sir, aLaCarteFlag);
assertEquals(serviceType, "testServiceType");
}
use of org.onap.so.serviceinstancebeans.ModelInfo in project so by onap.
the class RequestHandlerUtilsTest method setServiceTypeTestNetwork.
@Test
public void setServiceTypeTestNetwork() throws JsonProcessingException {
String requestScope = ModelType.network.toString();
Boolean aLaCarteFlag = null;
ServiceInstancesRequest sir = new ServiceInstancesRequest();
RequestDetails requestDetails = new RequestDetails();
RequestInfo requestInfo = new RequestInfo();
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelName("networkModelName");
requestInfo.setSource("VID");
requestDetails.setModelInfo(modelInfo);
requestDetails.setRequestInfo(requestInfo);
sir.setRequestDetails(requestDetails);
String serviceType = requestHandlerUtils.getServiceType(requestScope, sir, aLaCarteFlag);
assertEquals(serviceType, "networkModelName");
}
Aggregations