use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network in project so by onap.
the class BBInputSetupTest method test_getGBBMacroNoUserParamsExistingService_forActivateVnfBB.
@Test
public void test_getGBBMacroNoUserParamsExistingService_forActivateVnfBB() throws Exception {
// given
String requestAction = "unassignInstance";
GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), GeneralBuildingBlock.class);
L3Network network = new L3Network();
network.setNetworkId("networkId");
gBB.getServiceInstance().getNetworks().add(network);
ServiceInstance serviceInstance = gBB.getServiceInstance();
ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), ExecuteBuildingBlock.class);
RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class);
requestDetails.getRequestParameters().setUserParams(null);
Map<ResourceKey, String> lookupKeyMap = prepareLookupKeyMap();
Service service = Mockito.mock(Service.class);
CloudConfiguration cloudConfiguration = new CloudConfiguration();
cloudConfiguration.setLcpCloudRegionId("cloudRegionId");
org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance();
org.onap.aai.domain.yang.L3Network aaiNetwork = new org.onap.aai.domain.yang.L3Network();
aaiNetwork.setModelCustomizationId("modelCustId");
GenericVnf vnf = new GenericVnf();
vnf.setVnfId("vnfId");
gBB.getServiceInstance().getVnfs().add(vnf);
org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf();
aaiVnf.setModelCustomizationId("modelCustId");
ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName("ActivateVnfBB").setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
aaiServiceInstance.setModelVersionId("modelVersionId");
doReturn(service).when(SPY_bbInputSetupUtils).getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById(lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance);
doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(any(BBInputSetupParameter.class));
doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId());
doNothing().when(SPY_bbInputSetup).mapCatalogVnf(any(GenericVnf.class), any(ModelInfo.class), any(Service.class));
// when
SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap, executeBB.getBuildingBlock().getBpmnFlowName(), requestAction, cloudConfiguration);
// then
verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(any(GenericVnf.class), any(ModelInfo.class), any(Service.class));
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network in project so by onap.
the class NetworkAdapterCreateTasksTest method createNetworkTest.
@Test
public void createNetworkTest() {
String cloudRegionPo = "cloudRegionPo";
CreateNetworkRequest createNetworkRequest = new CreateNetworkRequest();
execution.setVariable("cloudRegionPo", cloudRegionPo);
doReturn(createNetworkRequest).when(networkAdapterObjectMapper).createNetworkRequestMapper(isA(RequestContext.class), isA(CloudRegion.class), isA(OrchestrationContext.class), isA(ServiceInstance.class), isA(L3Network.class), isA(Map.class), isA(String.class), isA(Customer.class));
networkAdapterCreateTasks.createNetwork(execution);
verify(networkAdapterObjectMapper, times(1)).createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer);
assertEquals(createNetworkRequest.toXmlString(), execution.getVariable("networkAdapterRequest"));
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network in project so by onap.
the class TestDataSetup method setL3Network.
public L3Network setL3Network() {
L3Network network = buildL3Network();
ServiceInstance serviceInstance = null;
try {
serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
} catch (BBObjectNotFoundException e) {
serviceInstance = setServiceInstance();
}
serviceInstance.getNetworks().add(network);
lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId());
return network;
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network in project so by onap.
the class TestDataSetup method buildL3Network.
public L3Network buildL3Network() {
l3NetworkCounter++;
L3Network network = new L3Network();
network.setNetworkId("testNetworkId" + l3NetworkCounter);
network.setNetworkName("testNetworkName" + l3NetworkCounter);
network.setNetworkType("testNetworkType" + l3NetworkCounter);
ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
modelInfoNetwork.setModelInvariantUUID("testModelInvariantUUID" + l3NetworkCounter);
modelInfoNetwork.setModelName("testModelName" + l3NetworkCounter);
modelInfoNetwork.setModelVersion("testModelVersion" + l3NetworkCounter);
modelInfoNetwork.setModelUUID("testModelUUID" + l3NetworkCounter);
network.setModelInfoNetwork(modelInfoNetwork);
Platform platform = new Platform();
platform.setPlatformName(" testPlatformName, testPlatformName2 , testPlatformName3 , testPlatformName4");
network.setPlatform(platform);
return network;
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network in project so by onap.
the class BuildingBlockTestDataSetup method setL3Network.
public L3Network setL3Network() {
L3Network network = buildL3Network();
ServiceInstance serviceInstance = null;
try {
serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
} catch (BBObjectNotFoundException e) {
serviceInstance = setServiceInstance();
}
serviceInstance.getNetworks().add(network);
lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId());
return network;
}
Aggregations