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;
}
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);
}
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());
}
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"));
}
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"));
}
Aggregations