Search in sources :

Example 11 with OrchestrationContext

use of org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext in project so by onap.

the class VnfAdapterVfModuleObjectMapperPayloadTest method createVfModuleRequestWithNoEnvironmentAndWorkloadContextMapperTest.

@Test
public void createVfModuleRequestWithNoEnvironmentAndWorkloadContextMapperTest() 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(null);
    serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
    RequestContext requestContext = new RequestContext();
    Map<String, Object> userParams = new HashMap<>();
    userParams.put("key1", "value2");
    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 + "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 + "vnfAdapterCreateVfModuleWithNoEnvironmentAndWorkloadContextRequest.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 12 with OrchestrationContext

use of org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext in project so by onap.

the class VnfAdapterVfModuleObjectMapperPayloadTest method createVfModuleWithVolumeGroupRequestMapperTest.

@Test
public void createVfModuleWithVolumeGroupRequestMapperTest() 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", "value2");
    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);
    VolumeGroup volumeGroup = new VolumeGroup();
    volumeGroup.setVolumeGroupId("volumeGroupId");
    volumeGroup.setHeatStackId("volumeGroupStackId");
    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, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
    String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleWithVolumeGroupRequest.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) VolumeGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) Test(org.junit.Test)

Example 13 with OrchestrationContext

use of org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext in project so by onap.

the class VnfAdapterVfModuleObjectMapperPayloadTest method DeleteVfModuleRequestMapperTest.

@Test
public void DeleteVfModuleRequestMapperTest() throws Exception {
    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);
    VfModule vfModule = new VfModule();
    vfModule.setVfModuleId("vfModuleId");
    vfModule.setVfModuleName("vfModuleName");
    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);
    DeleteVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.deleteVfModuleRequestMapper(requestContext, cloudRegion, serviceInstance, vnf, vfModule);
    String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterDeleteVfModuleRequest.json")));
    DeleteVfModuleRequest reqMapper1 = omapper.readValue(jsonToCompare, DeleteVfModuleRequest.class);
    assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl").ignoring("vfModuleStackId"));
}
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) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) DeleteVfModuleRequest(org.onap.so.adapters.vnfrest.DeleteVfModuleRequest) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) Test(org.junit.Test)

Example 14 with OrchestrationContext

use of org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext in project so by onap.

the class VnfAdapterVfModuleObjectMapperPayloadTest method createVfModuleRequestMapperTest.

@Test
public void createVfModuleRequestMapperTest() 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", "value2");
    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);
    HashMap<String, String> cloudParams = new HashMap<String, String>();
    cloudParams.put("key3", "value3");
    vfModule.setCloudParams(cloudParams);
    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")));
    VnfAdapterVfModuleObjectMapper spyMapper = Mockito.spy(vfModuleObjectMapper);
    doReturn("false").when(spyMapper).getProperty("mso.bridgeEnabled");
    CreateVfModuleRequest vfModuleVNFAdapterRequest = spyMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
    String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequest.json")));
    CreateVfModuleRequest reqMapper1 = omapper.readValue(jsonToCompare, CreateVfModuleRequest.class);
    assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
    doReturn("true").when(spyMapper).getProperty("mso.bridgeEnabled");
    vfModuleVNFAdapterRequest = spyMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
    jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestBridgeEnabled.json")));
    reqMapper1 = omapper.readValue(jsonToCompare, CreateVfModuleRequest.class);
    assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
    doReturn(null).when(spyMapper).getProperty("mso.bridgeEnabled");
    vfModuleVNFAdapterRequest = spyMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
    jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestBridgeEnabled.json")));
    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 15 with OrchestrationContext

use of org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext in project so by onap.

the class VnfAdapterVfModuleObjectMapperPayloadTest method createVfModuleRequestMapperMultipleDhcpTest.

@Test
public void createVfModuleRequestMapperMultipleDhcpTest() 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 + "genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.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 + "vnfAdapterCreateVfModuleRequestMultipleDhcp.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)

Aggregations

OrchestrationContext (org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext)29 Test (org.junit.Test)25 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)25 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)25 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)24 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)18 VfModule (org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)16 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)14 HashMap (java.util.HashMap)13 CreateVfModuleRequest (org.onap.so.adapters.vnfrest.CreateVfModuleRequest)13 ModelInfoVfModule (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule)13 ModelInfoGenericVnf (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf)11 VolumeGroup (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup)7 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)6 Map (java.util.Map)5 L3Network (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network)5 CreateVolumeGroupRequest (org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest)4 File (java.io.File)3 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)3 MsoRequest (org.onap.so.entity.MsoRequest)3