use of org.openkilda.pce.PathComputer in project open-kilda by telstra.
the class FlowUpdateHubBolt method init.
@Override
protected void init() {
AvailableNetworkFactory availableNetworkFactory = new AvailableNetworkFactory(pathComputerConfig, persistenceManager.getRepositoryFactory());
PathComputer pathComputer = new PathComputerFactory(pathComputerConfig, availableNetworkFactory).getPathComputer();
FlowResourcesManager resourcesManager = new FlowResourcesManager(persistenceManager, flowResourcesConfig);
service = new FlowUpdateService(this, persistenceManager, pathComputer, resourcesManager, config.getPathAllocationRetriesLimit(), config.getPathAllocationRetryDelay(), config.getResourceAllocationRetriesLimit(), config.getSpeakerCommandRetriesLimit());
}
use of org.openkilda.pce.PathComputer in project open-kilda by telstra.
the class FlowMirrorPointCreateHubBolt method init.
@Override
protected void init() {
AvailableNetworkFactory availableNetworkFactory = new AvailableNetworkFactory(pathComputerConfig, persistenceManager.getRepositoryFactory());
PathComputer pathComputer = new PathComputerFactory(pathComputerConfig, availableNetworkFactory).getPathComputer();
FlowResourcesManager resourcesManager = new FlowResourcesManager(persistenceManager, flowResourcesConfig);
service = new FlowMirrorPointCreateService(this, persistenceManager, pathComputer, resourcesManager, config.getPathAllocationRetriesLimit(), config.getPathAllocationRetryDelay(), config.getResourceAllocationRetriesLimit(), config.getSpeakerCommandRetriesLimit());
}
use of org.openkilda.pce.PathComputer in project open-kilda by telstra.
the class InMemoryPathComputerBaseTest method shouldGetYPoint2FlowPaths.
@Test
public void shouldGetYPoint2FlowPaths() {
FlowPath flowPathA = buildFlowPath("flow_path_a", 1, 2, 3);
FlowPath flowPathB = buildFlowPath("flow_path_b", 1, 2, 4);
PathComputer pathComputer = pathComputerFactory.getPathComputer();
SwitchId result = pathComputer.getIntersectionPoint(SWITCH_1, flowPathA, flowPathB);
assertEquals(new SwitchId(2), result);
}
use of org.openkilda.pce.PathComputer in project open-kilda by telstra.
the class InMemoryPathComputerBaseTest method shouldFindOverLargeIslands.
/**
* See how it works with a large network. It takes a while to create the network .. therefore @Ignore so that it
* doesn't slow down unit tests.
*/
@Test
@Ignore
public void shouldFindOverLargeIslands() throws RecoverableException, UnroutableFlowException {
createDiamond(IslStatus.ACTIVE, IslStatus.ACTIVE, 10, 20, "08:", 1);
for (int i = 0; i < 50; i++) {
createDiamond(IslStatus.ACTIVE, IslStatus.ACTIVE, 10, 20, "10:", 4 * i + 1);
createDiamond(IslStatus.ACTIVE, IslStatus.ACTIVE, 10, 20, "11:", 4 * i + 1);
createDiamond(IslStatus.ACTIVE, IslStatus.ACTIVE, 10, 20, "12:", 4 * i + 1);
createDiamond(IslStatus.ACTIVE, IslStatus.ACTIVE, 10, 20, "13:", 4 * i + 1);
}
for (int i = 0; i < 49; i++) {
String prev = format("%02X", 4 * i + 4);
String next = format("%02X", 4 * i + 5);
connectDiamonds(new SwitchId("10:" + prev), new SwitchId("10:" + next), IslStatus.ACTIVE, 20, 50);
connectDiamonds(new SwitchId("11:" + prev), new SwitchId("11:" + next), IslStatus.ACTIVE, 20, 50);
connectDiamonds(new SwitchId("12:" + prev), new SwitchId("12:" + next), IslStatus.ACTIVE, 20, 50);
connectDiamonds(new SwitchId("13:" + prev), new SwitchId("13:" + next), IslStatus.ACTIVE, 20, 50);
}
connectDiamonds(new SwitchId("10:99"), new SwitchId("11:22"), IslStatus.ACTIVE, 20, 50);
connectDiamonds(new SwitchId("11:99"), new SwitchId("12:22"), IslStatus.ACTIVE, 20, 50);
connectDiamonds(new SwitchId("12:99"), new SwitchId("13:22"), IslStatus.ACTIVE, 20, 50);
connectDiamonds(new SwitchId("13:99"), new SwitchId("10:22"), IslStatus.ACTIVE, 20, 50);
Switch srcSwitch1 = getSwitchById("10:01");
Switch destSwitch1 = getSwitchById("11:03");
// THIS ONE SHOULD WORK
Flow f1 = new TestFlowBuilder().srcSwitch(srcSwitch1).destSwitch(destSwitch1).bandwidth(0).ignoreBandwidth(false).build();
PathComputer pathComputer = new InMemoryPathComputer(availableNetworkFactory, new BestWeightAndShortestPathFinder(200), config);
GetPathsResult path = pathComputer.getPath(f1);
assertNotNull(path);
assertThat(path.getForward().getSegments(), Matchers.hasSize(278));
Switch srcSwitch2 = getSwitchById("08:01");
Switch destSwitch2 = getSwitchById("11:04");
// THIS ONE SHOULD FAIL
Flow f2 = new TestFlowBuilder().srcSwitch(srcSwitch2).destSwitch(destSwitch2).bandwidth(0).ignoreBandwidth(false).build();
thrown.expect(UnroutableFlowException.class);
pathComputer.getPath(f2);
}
use of org.openkilda.pce.PathComputer in project open-kilda by telstra.
the class InMemoryPathComputerBaseTest method affinityPathShouldSplitAsCloseAsPossibleToDestination.
void affinityPathShouldSplitAsCloseAsPossibleToDestination(PathComputationStrategy pathComputationStrategy) throws Exception {
createTestTopologyForAffinityTesting();
Flow flow = Flow.builder().flowId("new-flow").affinityGroupId(TEST_FLOW_ID).bandwidth(10).srcSwitch(getSwitchById("00:0A")).destSwitch(getSwitchById("00:03")).encapsulationType(FlowEncapsulationType.TRANSIT_VLAN).pathComputationStrategy(pathComputationStrategy).build();
PathComputer pathComputer = pathComputerFactory.getPathComputer();
GetPathsResult affinityPath = pathComputer.getPath(flow);
List<Segment> segments = affinityPath.getForward().getSegments();
assertEquals(3, segments.size());
assertEquals(new SwitchId("00:0A"), segments.get(0).getSrcSwitchId());
assertEquals(new SwitchId("00:0B"), segments.get(1).getSrcSwitchId());
assertEquals(new SwitchId("00:0C"), segments.get(2).getSrcSwitchId());
assertEquals(new SwitchId("00:0B"), segments.get(0).getDestSwitchId());
assertEquals(new SwitchId("00:0C"), segments.get(1).getDestSwitchId());
assertEquals(new SwitchId("00:03"), segments.get(2).getDestSwitchId());
}
Aggregations