Search in sources :

Example 56 with ModelInfo

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());
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) ModelInfoGenericVnf(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) HashMap(java.util.HashMap) ResourceKey(org.onap.so.bpmn.servicedecomposition.entities.ResourceKey) VolumeGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup) Test(org.junit.Test)

Example 57 with ModelInfo

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());
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) Service(org.onap.so.db.catalog.beans.Service) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) VfModuleCustomization(org.onap.so.db.catalog.beans.VfModuleCustomization) VnfResourceCustomization(org.onap.so.db.catalog.beans.VnfResourceCustomization) Test(org.junit.Test)

Example 58 with ModelInfo

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);
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) Vnfs(org.onap.so.serviceinstancebeans.Vnfs)

Example 59 with ModelInfo

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");
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) Service(org.onap.so.db.catalog.beans.Service) RequestInfo(org.onap.so.serviceinstancebeans.RequestInfo) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) Test(org.junit.Test)

Example 60 with ModelInfo

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");
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) RequestInfo(org.onap.so.serviceinstancebeans.RequestInfo) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) Test(org.junit.Test)

Aggregations

ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)84 Test (org.junit.Test)46 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)35 Service (org.onap.so.db.catalog.beans.Service)30 HashMap (java.util.HashMap)18 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)18 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)17 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)17 RelatedInstanceList (org.onap.so.serviceinstancebeans.RelatedInstanceList)15 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)14 RelatedInstance (org.onap.so.serviceinstancebeans.RelatedInstance)14 ServiceInstancesRequest (org.onap.so.serviceinstancebeans.ServiceInstancesRequest)14 VnfResourceCustomization (org.onap.so.db.catalog.beans.VnfResourceCustomization)12 RequestInfo (org.onap.so.serviceinstancebeans.RequestInfo)12 ServiceModel (org.onap.so.bpmn.servicedecomposition.entities.ServiceModel)11 CloudConfiguration (org.onap.so.serviceinstancebeans.CloudConfiguration)11 File (java.io.File)10 VfModule (org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)10 VolumeGroup (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup)10 ModelInfoGenericVnf (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf)10