Search in sources :

Example 1 with ModelInfoServiceInstance

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

the class BuildingBlockTestDataSetup method buildServiceInstance.

public ServiceInstance buildServiceInstance() {
    serviceInstanceCounter++;
    ServiceInstance serviceInstance = new ServiceInstance();
    serviceInstance.setServiceInstanceId("testServiceInstanceId" + serviceInstanceCounter);
    serviceInstance.setServiceInstanceName("testServiceInstanceName" + serviceInstanceCounter);
    ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
    modelInfoServiceInstance.setModelInvariantUuid("testModelInvariantUUID" + serviceInstanceCounter);
    modelInfoServiceInstance.setModelUuid("testModelUUID" + serviceInstanceCounter);
    modelInfoServiceInstance.setModelVersion("testModelVersion" + serviceInstanceCounter);
    modelInfoServiceInstance.setModelName("testModelName" + serviceInstanceCounter);
    modelInfoServiceInstance.setServiceType("testServiceType" + serviceInstanceCounter);
    serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
    serviceInstance.setProject(buildProject());
    serviceInstance.setOwningEntity(buildOwningEntity());
    serviceInstance.setCollection(buildCollection());
    serviceInstance.getConfigurations().add(buildConfiguration());
    return serviceInstance;
}
Also used : ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)

Example 2 with ModelInfoServiceInstance

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

the class ConfigAssignVnfTest method createServiceInstance.

private ServiceInstance createServiceInstance() {
    ServiceInstance serviceInstance = new ServiceInstance();
    serviceInstance.setServiceInstanceId(SERVICE_INSTANCE_ID);
    ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
    modelInfoServiceInstance.setModelUuid(SERVICE_MODEL_UUID);
    serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
    return serviceInstance;
}
Also used : ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)

Example 3 with ModelInfoServiceInstance

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

the class VnfAdapterObjectMapperTest method test_createVolumeGroupRequestMapper_for_alaCarte_flow.

@Test
public void test_createVolumeGroupRequestMapper_for_alaCarte_flow() throws Exception {
    RequestContext requestContext = new RequestContext();
    requestContext.setMsoRequestId("msoRequestId");
    ServiceInstance serviceInstance = new ServiceInstance();
    serviceInstance.setServiceInstanceId("serviceInstanceId");
    ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
    modelInfoServiceInstance.setModelVersion("modelVersion");
    serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
    GenericVnf genericVnf = new GenericVnf();
    genericVnf.setVnfId("vnfId");
    genericVnf.setVnfName("vnfName");
    genericVnf.setVnfType("vnfType");
    serviceInstance.getVnfs().add(genericVnf);
    ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
    modelInfoVfModule.setModelName("modelName");
    modelInfoVfModule.setModelCustomizationUUID("modelCustomizationUUID");
    VolumeGroup volumeGroup = new VolumeGroup();
    volumeGroup.setVolumeGroupId("volumeGroupId");
    volumeGroup.setVolumeGroupName("volumeGroupName");
    volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
    volumeGroup.setModelInfoVfModule(modelInfoVfModule);
    serviceInstance.getVnfs().get(0).getVolumeGroups().add(volumeGroup);
    CloudRegion cloudRegion = new CloudRegion();
    cloudRegion.setLcpCloudRegionId("lcpCloudRegionId");
    cloudRegion.setTenantId("tenantId");
    OrchestrationContext orchestrationContext = new OrchestrationContext();
    orchestrationContext.setIsRollbackEnabled(true);
    CreateVolumeGroupRequest expectedCreateVolumeGroupRequest = new CreateVolumeGroupRequest();
    expectedCreateVolumeGroupRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
    expectedCreateVolumeGroupRequest.setTenantId(cloudRegion.getTenantId());
    expectedCreateVolumeGroupRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId());
    expectedCreateVolumeGroupRequest.setVolumeGroupName(volumeGroup.getVolumeGroupName());
    expectedCreateVolumeGroupRequest.setVnfType(genericVnf.getVnfType());
    expectedCreateVolumeGroupRequest.setVnfVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion());
    expectedCreateVolumeGroupRequest.setVfModuleType(volumeGroup.getModelInfoVfModule().getModelName());
    expectedCreateVolumeGroupRequest.setModelCustomizationUuid(volumeGroup.getModelInfoVfModule().getModelCustomizationUUID());
    Map<String, Object> volumeGroupParams = new HashMap<>();
    volumeGroupParams.put("vnf_id", genericVnf.getVnfId());
    volumeGroupParams.put("vnf_name", genericVnf.getVnfName());
    volumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId());
    volumeGroupParams.put("vf_module_name", volumeGroup.getVolumeGroupName());
    expectedCreateVolumeGroupRequest.setVolumeGroupParams(volumeGroupParams);
    expectedCreateVolumeGroupRequest.setSkipAAI(true);
    expectedCreateVolumeGroupRequest.setSuppressBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled()));
    expectedCreateVolumeGroupRequest.setFailIfExists(false);
    MsoRequest msoRequest = new MsoRequest();
    msoRequest.setRequestId(requestContext.getMsoRequestId());
    msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId());
    expectedCreateVolumeGroupRequest.setMsoRequest(msoRequest);
    expectedCreateVolumeGroupRequest.setMessageId("messageId");
    expectedCreateVolumeGroupRequest.setNotificationUrl("endpoint/VNFAResponse/messageId");
    doReturn("endpoint/").when(vnfAdapterObjectMapper).getProperty(isA(String.class));
    doReturn("messageId").when(vnfAdapterObjectMapper).getRandomUuid();
    CreateVolumeGroupRequest actualCreateVolumeGroupRequest = vnfAdapterObjectMapper.createVolumeGroupRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, null);
    assertThat(actualCreateVolumeGroupRequest, sameBeanAs(expectedCreateVolumeGroupRequest));
}
Also used : CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) CreateVolumeGroupRequest(org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) HashMap(java.util.HashMap) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) OrchestrationContext(org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) VolumeGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup) MsoRequest(org.onap.so.entity.MsoRequest) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) Test(org.junit.Test)

Example 4 with ModelInfoServiceInstance

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

the class VnfAdapterVfModuleObjectMapperPayloadTest method createVfModuleAddonRequestMapperTest.

@Test
public void createVfModuleAddonRequestMapperTest() 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);
    VfModule baseVfModule = new VfModule();
    baseVfModule.setVfModuleId("baseVfModuleId");
    baseVfModule.setHeatStackId("baseVfModuleStackId");
    ModelInfoVfModule baseModelInfoVfModule = new ModelInfoVfModule();
    baseModelInfoVfModule.setIsBaseBoolean(true);
    baseVfModule.setModelInfoVfModule(baseModelInfoVfModule);
    vnf.getVfModules().add(baseVfModule);
    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 + "vnfAdapterCreateVfModuleAddonRequest.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 5 with ModelInfoServiceInstance

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

the class VnfAdapterVfModuleObjectMapperPayloadTest method createVfModuleRequestMapperWithCloudResourcesTest.

@Test
public void createVfModuleRequestMapperWithCloudResourcesTest() 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 + "genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json")));
    String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.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 + "vnfAdapterCreateVfModuleRequestWithCloudResources.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

ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)37 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)32 Test (org.junit.Test)27 HashMap (java.util.HashMap)22 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)21 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)19 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)19 ModelInfoVfModule (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule)17 ModelInfoGenericVnf (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf)16 VfModule (org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)15 OrchestrationContext (org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext)13 CreateVfModuleRequest (org.onap.so.adapters.vnfrest.CreateVfModuleRequest)10 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)10 ServiceSubscription (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription)8 URI (java.net.URI)5 Service (org.onap.so.db.catalog.beans.Service)5 File (java.io.File)4 ArrayList (java.util.ArrayList)4 VolumeGroup (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup)4 GenericResourceApiVfModuleOperationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation)3