use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network in project so by onap.
the class NetworkAdapterDeleteTasks method deleteNetwork.
public void deleteNetwork(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
DeleteNetworkRequest deleteNetworkRequest = networkAdapterObjectMapper.deleteNetworkRequestMapper(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, l3Network);
execution.setVariable("networkAdapterRequest", deleteNetworkRequest.toXmlString());
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network in project so by onap.
the class NetworkAdapterCreateTasks method createNetwork.
public void createNetwork(BuildingBlockExecution execution) {
execution.setVariable("networkAdapterCreateRollback", false);
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
Map<String, String> userInput = gBBInput.getUserInput();
String cloudRegionPo = execution.getVariable("cloudRegionPo");
CreateNetworkRequest createNetworkRequest = networkAdapterObjectMapper.createNetworkRequestMapper(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance, l3Network, userInput, cloudRegionPo, gBBInput.getCustomer());
execution.setVariable("networkAdapterRequest", createNetworkRequest.toXmlString());
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network in project so by onap.
the class AAICreateTasks method connectNetworkToCloudRegion.
/**
* BPMN access method to establish relationships in AAI
*
* @param execution
* @throws Exception
*/
public void connectNetworkToCloudRegion(BuildingBlockExecution execution) {
try {
L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
aaiNetworkResources.connectNetworkToCloudRegion(l3network, execution.getGeneralBuildingBlock().getCloudRegion());
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network in project so by onap.
the class AAICreateTasks method connectNetworkToTenant.
/**
* BPMN access method to establish relationships in AAI
*
* @param execution
* @throws Exception
*/
public void connectNetworkToTenant(BuildingBlockExecution execution) {
try {
L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
aaiNetworkResources.connectNetworkToTenant(l3network, execution.getGeneralBuildingBlock().getCloudRegion());
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network in project so by onap.
the class NetworkAdapterResourcesTest method createNetworTest.
@Test
public void createNetworTest() throws Exception {
String cloudRegionPo = "cloudRegionPo";
CreateNetworkRequest expectedCreateNetworkRequest = new CreateNetworkRequest();
expectedCreateNetworkRequest.setCloudSiteId(cloudRegionPo);
expectedCreateNetworkRequest.setTenantId(cloudRegion.getTenantId());
expectedCreateNetworkRequest.setNetworkId(l3Network.getNetworkId());
expectedCreateNetworkRequest.setNetworkName(l3Network.getNetworkName());
expectedCreateNetworkRequest.setBackout(false);
expectedCreateNetworkRequest.setFailIfExists(true);
MsoRequest msoRequest = new MsoRequest();
msoRequest.setRequestId(requestContext.getMsoRequestId());
msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId());
expectedCreateNetworkRequest.setMsoRequest(msoRequest);
expectedCreateNetworkRequest.setSkipAAI(true);
Subnet openstackSubnet = new Subnet();
HostRoute hostRoute = new HostRoute();
hostRoute.setHostRouteId("hostRouteId");
hostRoute.setNextHop("nextHop");
hostRoute.setRoutePrefix("routePrefix");
openstackSubnet.getHostRoutes().add(hostRoute);
List<Subnet> subnetList = new ArrayList<Subnet>();
subnetList.add(openstackSubnet);
l3Network.getSubnets().add(openstackSubnet);
l3Network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
CreateNetworkRequest createNetworkRequest = new CreateNetworkRequest();
createNetworkRequest.setCloudSiteId("cloudSiteId");
CreateNetworkResponse expectedCreateNetworkResponse = new CreateNetworkResponse();
expectedCreateNetworkResponse.setNetworkStackId("networkStackId");
expectedCreateNetworkResponse.setNetworkCreated(true);
doReturn(expectedCreateNetworkResponse).when(MOCK_networkAdapterClient).createNetwork(isA(CreateNetworkRequest.class));
doReturn(createNetworkRequest).when(MOCK_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));
CreateNetworkResponse actualCreateNetwrokResponse = (networkAdapterResources.createNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer)).get();
verify(MOCK_networkAdapterClient, times(1)).createNetwork(createNetworkRequest);
verify(MOCK_networkAdapterObjectMapper, times(1)).createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer);
assertThat(expectedCreateNetworkResponse, Matchers.sameBeanAs(actualCreateNetwrokResponse));
}
Aggregations