Search in sources :

Example 26 with ModelInfoVfModule

use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule in project so by onap.

the class VnfAdapterVfModuleObjectMapperPayloadTest method createVfModuleRequestMapperWithNullUserParamsTest.

@Test
public void createVfModuleRequestMapperWithNullUserParamsTest() throws Exception {
    // prepare and set service instance
    ServiceInstance serviceInstance = new ServiceInstance();
    serviceInstance.setServiceInstanceId("serviceInstanceId");
    ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
    modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid");
    modelInfoServiceInstance.setModelName("serviceModelName");
    modelInfoServiceInstance.setModelUuid("serviceModelUuid");
    modelInfoServiceInstance.setModelVersion("serviceModelVersion");
    modelInfoServiceInstance.setEnvironmentContext("environmentContext");
    modelInfoServiceInstance.setWorkloadContext("workloadContext");
    serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
    RequestContext requestContext = new RequestContext();
    requestContext.setMsoRequestId("requestId");
    requestContext.setProductFamilyId("productFamilyId");
    GenericVnf vnf = new GenericVnf();
    vnf.setVnfId("vnfId");
    vnf.setVnfType("vnfType");
    vnf.setVnfName("vnfName");
    ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
    modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid");
    modelInfoGenericVnf.setModelName("vnfModelName");
    modelInfoGenericVnf.setModelVersion("vnfModelVersion");
    modelInfoGenericVnf.setModelUuid("vnfModelUuid");
    modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid");
    vnf.setModelInfoGenericVnf(modelInfoGenericVnf);
    Integer vfModuleIndex = 1;
    VfModule vfModule = new VfModule();
    vfModule.setVfModuleId("vfModuleId");
    vfModule.setVfModuleName("vfModuleName");
    vfModule.setModuleIndex(vfModuleIndex);
    ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
    modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid");
    modelInfoVfModule.setModelName("vfModuleModelName");
    modelInfoVfModule.setModelVersion("vfModuleModelVersion");
    modelInfoVfModule.setModelUUID("vfModuleModelUuid");
    modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid");
    vfModule.setModelInfoVfModule(modelInfoVfModule);
    CloudRegion cloudRegion = new CloudRegion();
    cloudRegion.setLcpCloudRegionId("cloudRegionId");
    cloudRegion.setTenantId("tenantId");
    OrchestrationContext orchestrationContext = new OrchestrationContext();
    orchestrationContext.setIsRollbackEnabled(false);
    String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopology.json")));
    String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json")));
    CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
    String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestNoUserParams.json")));
    CreateVfModuleRequest reqMapper1 = omapper.readValue(jsonToCompare, CreateVfModuleRequest.class);
    assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
}
Also used : CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) CreateVfModuleRequest(org.onap.so.adapters.vnfrest.CreateVfModuleRequest) ModelInfoGenericVnf(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) ModelInfoGenericVnf(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) OrchestrationContext(org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) Test(org.junit.Test)

Example 27 with ModelInfoVfModule

use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule in project so by onap.

the class VnfAdapterVfModuleObjectMapperPayloadTest method createVfModuleRequestMapperDhcpDisabledTest.

@Test
public void createVfModuleRequestMapperDhcpDisabledTest() throws Exception {
    // prepare and set service instance
    ServiceInstance serviceInstance = new ServiceInstance();
    serviceInstance.setServiceInstanceId("serviceInstanceId");
    ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
    modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid");
    modelInfoServiceInstance.setModelName("serviceModelName");
    modelInfoServiceInstance.setModelUuid("serviceModelUuid");
    modelInfoServiceInstance.setModelVersion("serviceModelVersion");
    modelInfoServiceInstance.setEnvironmentContext("environmentContext");
    modelInfoServiceInstance.setWorkloadContext("workloadContext");
    serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
    RequestContext requestContext = new RequestContext();
    Map<String, Object> userParams = new HashMap<>();
    userParams.put("key1", "value1");
    requestContext.setMsoRequestId("requestId");
    requestContext.setUserParams(userParams);
    requestContext.setProductFamilyId("productFamilyId");
    GenericVnf vnf = new GenericVnf();
    vnf.setVnfId("vnfId");
    vnf.setVnfType("vnfType");
    vnf.setVnfName("vnfName");
    ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
    modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid");
    modelInfoGenericVnf.setModelName("vnfModelName");
    modelInfoGenericVnf.setModelVersion("vnfModelVersion");
    modelInfoGenericVnf.setModelUuid("vnfModelUuid");
    modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid");
    vnf.setModelInfoGenericVnf(modelInfoGenericVnf);
    Integer vfModuleIndex = 1;
    VfModule vfModule = new VfModule();
    vfModule.setVfModuleId("vfModuleId");
    vfModule.setVfModuleName("vfModuleName");
    vfModule.setModuleIndex(vfModuleIndex);
    ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
    modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid");
    modelInfoVfModule.setModelName("vfModuleModelName");
    modelInfoVfModule.setModelVersion("vfModuleModelVersion");
    modelInfoVfModule.setModelUUID("vfModuleModelUuid");
    modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid");
    vfModule.setModelInfoVfModule(modelInfoVfModule);
    CloudRegion cloudRegion = new CloudRegion();
    cloudRegion.setLcpCloudRegionId("cloudRegionId");
    cloudRegion.setTenantId("tenantId");
    OrchestrationContext orchestrationContext = new OrchestrationContext();
    orchestrationContext.setIsRollbackEnabled(false);
    String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json")));
    String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json")));
    CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
    String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestDhcpDisabled.json")));
    CreateVfModuleRequest reqMapper1 = omapper.readValue(jsonToCompare, CreateVfModuleRequest.class);
    assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
}
Also used : CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) ModelInfoGenericVnf(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) HashMap(java.util.HashMap) ModelInfoGenericVnf(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) OrchestrationContext(org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) CreateVfModuleRequest(org.onap.so.adapters.vnfrest.CreateVfModuleRequest) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) Test(org.junit.Test)

Example 28 with ModelInfoVfModule

use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule in project so by onap.

the class BBInputSetupTest method testMapCatalogVolumeGroup.

@Test
public void testMapCatalogVolumeGroup() {
    VolumeGroup volumeGroup = new VolumeGroup();
    RequestDetails requestDetails = new RequestDetails();
    ModelInfo modelInfo = new ModelInfo();
    modelInfo.setModelCustomizationUuid("modelCustomizationUUID");
    requestDetails.setModelInfo(modelInfo);
    Service service = new Service();
    VnfResourceCustomization resourceCust = new VnfResourceCustomization();
    resourceCust.setModelCustomizationUUID("vnfModelCustomizationUUID");
    service.getVnfCustomizations().add(resourceCust);
    VfModuleCustomization vfResourceCust = new VfModuleCustomization();
    vfResourceCust.setModelCustomizationUUID("modelCustomizationUUID");
    ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
    resourceCust.getVfModuleCustomizations().add(vfResourceCust);
    doReturn(modelInfoVfModule).when(bbInputSetupMapperLayer).mapCatalogVfModuleToVfModule(vfResourceCust);
    SPY_bbInputSetup.mapCatalogVolumeGroup(volumeGroup, modelInfo, service, "vnfModelCustomizationUUID");
    assertEquals(modelInfoVfModule, volumeGroup.getModelInfoVfModule());
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) VolumeGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup) Service(org.onap.so.db.catalog.beans.Service) VfModuleCustomization(org.onap.so.db.catalog.beans.VfModuleCustomization) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) VnfResourceCustomization(org.onap.so.db.catalog.beans.VnfResourceCustomization) Test(org.junit.Test)

Example 29 with ModelInfoVfModule

use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule 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 30 with ModelInfoVfModule

use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule in project so by onap.

the class BBInputSetupMapperLayerTest method testMapCatalogVfModuleToVfModule.

@Test
public void testMapCatalogVfModuleToVfModule() throws JsonParseException, JsonMappingException, IOException {
    VfModuleCustomization vfResourceCustomization = mapper.readValue(new File(RESOURCE_PATH + "VfModuleCustomizationInput.json"), VfModuleCustomization.class);
    ModelInfoVfModule expectedModelInfoVfModule = mapper.readValue(new File(RESOURCE_PATH + "ModelInfoVfModuleExpected.json"), ModelInfoVfModule.class);
    ModelInfoVfModule actualModelInfoVfModule = bbInputSetupMapperLayer.mapCatalogVfModuleToVfModule(vfResourceCustomization);
    assertThat(actualModelInfoVfModule, sameBeanAs(expectedModelInfoVfModule));
}
Also used : ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) VfModuleCustomization(org.onap.so.db.catalog.beans.VfModuleCustomization) File(java.io.File) Test(org.junit.Test)

Aggregations

ModelInfoVfModule (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule)33 Test (org.junit.Test)27 VfModule (org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)25 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)20 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)18 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)18 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)17 HashMap (java.util.HashMap)16 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)16 ModelInfoGenericVnf (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf)16 OrchestrationContext (org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext)13 CreateVfModuleRequest (org.onap.so.adapters.vnfrest.CreateVfModuleRequest)10 VolumeGroup (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup)8 RequestParameters (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters)4 Service (org.onap.so.db.catalog.beans.Service)4 VfModuleCustomization (org.onap.so.db.catalog.beans.VfModuleCustomization)4 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 URI (java.net.URI)3 ArrayList (java.util.ArrayList)3