Search in sources :

Example 51 with ServiceInstance

use of org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance 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 52 with ServiceInstance

use of org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance in project so by onap.

the class AAICreateTasksTest method connectNetworkToNullNetworkCollectionInstanceGroupTest.

@Test
public void connectNetworkToNullNetworkCollectionInstanceGroupTest() throws Exception {
    // reset test data to have no network collection instance group
    ServiceInstance serviceInstance = new ServiceInstance();
    serviceInstance.setServiceInstanceId("testServiceInstanceId");
    L3Network network = new L3Network();
    network.setNetworkId("testNetworkId");
    serviceInstance.getNetworks().add(network);
    lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId());
    gBBInput.setServiceInstance(serviceInstance);
    lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstance.getServiceInstanceId());
    when(extractPojosForBBMock.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
    when(extractPojosForBBMock.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(serviceInstance);
    // verify connection call was not executednetwork
    exception.expect(BpmnError.class);
    aaiCreateTasks.connectNetworkToNetworkCollectionInstanceGroup(execution);
    verify(aaiNetworkResources, never()).connectNetworkToNetworkCollectionInstanceGroup(network, null);
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) Test(org.junit.Test)

Example 53 with ServiceInstance

use of org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance in project so by onap.

the class VnfAdapterCreateTasksTest method test_createVfModule.

@Test
public void test_createVfModule() throws Exception {
    RequestContext requestContext = setRequestContext();
    ServiceInstance serviceInstance = setServiceInstance();
    GenericVnf genericVnf = setGenericVnf();
    VfModule vfModule = setVfModule();
    CloudRegion cloudRegion = setCloudRegion();
    OrchestrationContext orchestrationContext = setOrchestrationContext();
    orchestrationContext.setIsRollbackEnabled(true);
    CreateVfModuleRequest modRequest = new CreateVfModuleRequest();
    modRequest.setVfModuleId(vfModule.getVfModuleId());
    modRequest.setBaseVfModuleStackId("baseVfModuleStackId");
    modRequest.setVfModuleName(vfModule.getVfModuleName());
    CreateVfModuleRequest createVfModuleRequest = modRequest;
    String sdncVfModuleQueryResponse = "{someJson}";
    execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), sdncVfModuleQueryResponse);
    String sdncVnfQueryResponse = "{someJson}";
    execution.setVariable("SDNCQueryResponse_" + genericVnf.getVnfId(), sdncVnfQueryResponse);
    when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
    when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
    doReturn(createVfModuleRequest).when(vnfAdapterVfModuleResources).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
    vnfAdapterCreateTasks.createVfModule(execution);
    verify(vnfAdapterVfModuleResources, times(1)).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
    assertEquals(execution.getVariable("VNFREST_Request"), createVfModuleRequest.toXmlString());
}
Also used : CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) CreateVfModuleRequest(org.onap.so.adapters.vnfrest.CreateVfModuleRequest) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) OrchestrationContext(org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext) Test(org.junit.Test)

Example 54 with ServiceInstance

use of org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance in project so by onap.

the class VnfAdapterCreateTasksTest method test_createVolumeGroupRequest.

@Test
public void test_createVolumeGroupRequest() throws Exception {
    RequestContext requestContext = setRequestContext();
    ServiceInstance serviceInstance = setServiceInstance();
    GenericVnf genericVnf = setGenericVnf();
    VfModule vfModule = setVfModule();
    vfModule.setSelflink("vfModuleSelfLink");
    VolumeGroup volumeGroup = setVolumeGroup();
    volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
    CloudRegion cloudRegion = setCloudRegion();
    OrchestrationContext orchestrationContext = setOrchestrationContext();
    orchestrationContext.setIsRollbackEnabled(true);
    String sdncVnfQueryResponse = "SDNCVnfQueryResponse";
    execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), sdncVnfQueryResponse);
    CreateVolumeGroupRequest request = new CreateVolumeGroupRequest();
    request.setVolumeGroupId("volumeGroupStackId");
    when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
    when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup);
    when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
    doReturn(request).when(vnfAdapterVolumeGroupResources).createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVnfQueryResponse);
    vnfAdapterCreateTasks.createVolumeGroupRequest(execution);
    verify(vnfAdapterVolumeGroupResources, times(1)).createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVnfQueryResponse);
    assertEquals(request.toXmlString(), execution.getVariable("VNFREST_Request"));
}
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) VolumeGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) OrchestrationContext(org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext) Test(org.junit.Test)

Example 55 with ServiceInstance

use of org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance in project so by onap.

the class NetworkAdapterUpdateTasksTest method updateNetworkTest.

@Test
public void updateNetworkTest() {
    String cloudRegionPo = "cloudRegionPo";
    UpdateNetworkRequest updateNetworkRequest = new UpdateNetworkRequest();
    execution.setVariable("cloudRegionPo", cloudRegionPo);
    doReturn(updateNetworkRequest).when(networkAdapterObjectMapper).createNetworkUpdateRequestMapper(isA(RequestContext.class), isA(CloudRegion.class), isA(OrchestrationContext.class), isA(ServiceInstance.class), isA(L3Network.class), isA(Map.class), isA(Customer.class));
    networkAdapterUpdateTasks.updateNetwork(execution);
    verify(networkAdapterObjectMapper, times(1)).createNetworkUpdateRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, customer);
    assertEquals(updateNetworkRequest.toXmlString(), execution.getVariable("networkAdapterRequest"));
}
Also used : CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) UpdateNetworkRequest(org.onap.so.adapters.nwrest.UpdateNetworkRequest) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) Map(java.util.Map) OrchestrationContext(org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext) Test(org.junit.Test)

Aggregations

ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)228 Test (org.junit.Test)118 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)110 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)84 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)70 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)61 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)54 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)53 VfModule (org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)51 HashMap (java.util.HashMap)50 Service (org.onap.so.db.catalog.beans.Service)46 BBObjectNotFoundException (org.onap.so.client.exception.BBObjectNotFoundException)40 L3Network (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network)38 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)37 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)35 ModelInfoGenericVnf (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf)33 ModelInfoVfModule (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule)33 File (java.io.File)31 OrchestrationContext (org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext)25 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)24