use of org.openkilda.pce.PathComputer in project open-kilda by telstra.
the class MaxLatencyPathComputationStrategyBaseTest method maxLatencyIssueTest.
@Test
public void maxLatencyIssueTest() throws Exception {
createMaxLatencyIssueTopo();
Flow flow = Flow.builder().flowId("test flow").srcSwitch(getSwitchById("00:01")).srcPort(15).destSwitch(getSwitchById("00:04")).destPort(15).bandwidth(500).encapsulationType(FlowEncapsulationType.TRANSIT_VLAN).pathComputationStrategy(PathComputationStrategy.MAX_LATENCY).maxLatency(30L).build();
PathComputer pathComputer = pathComputerFactory.getPathComputer();
GetPathsResult path = pathComputer.getPath(flow);
assertNotNull(path);
assertEquals(path.getForward().getSegments().size(), 3);
}
use of org.openkilda.pce.PathComputer in project open-kilda by telstra.
the class MaxLatencyPathComputationStrategyBaseTest method shouldUseSlowLinkInsidePath.
@Test
public void shouldUseSlowLinkInsidePath() throws Exception {
createTwoLinksInsidePathTopo();
Flow flow = Flow.builder().flowId("test flow").srcSwitch(getSwitchById("00:01")).srcPort(15).destSwitch(getSwitchById("00:06")).destPort(15).bandwidth(500).encapsulationType(FlowEncapsulationType.TRANSIT_VLAN).pathComputationStrategy(PathComputationStrategy.MAX_LATENCY).maxLatency(30L).build();
PathComputer pathComputer = pathComputerFactory.getPathComputer();
GetPathsResult path = pathComputer.getPath(flow);
assertNotNull(path);
assertEquals(path.getForward().getSegments().size(), 5);
assertEquals(path.getForward().getLatency(), 14);
}
use of org.openkilda.pce.PathComputer in project open-kilda by telstra.
the class MaxLatencyPathComputationStrategyBaseTest method maxLatencyStratWithZeroLatency.
/**
* Special case: flow with MAX_LATENCY strategy and 'max-latency' set to 0 should pick path with least latency.
*/
@Test
public void maxLatencyStratWithZeroLatency() throws RecoverableException, UnroutableFlowException {
// 1 - 2 - 4
// + 3 +
// path 1>2>4 has less latency than 1>3>4
createDiamond(IslStatus.ACTIVE, IslStatus.ACTIVE, 100, 100, "00:", 1, 100, 101);
// when: request a flow with MAX_LATENCY strategy and 'max-latency' set to 0
Flow flow = Flow.builder().flowId("test flow").srcSwitch(getSwitchById("00:01")).srcPort(15).destSwitch(getSwitchById("00:04")).destPort(15).bandwidth(500).encapsulationType(FlowEncapsulationType.TRANSIT_VLAN).pathComputationStrategy(PathComputationStrategy.MAX_LATENCY).maxLatency(0L).build();
PathComputer pathComputer = new InMemoryPathComputer(availableNetworkFactory, new BestWeightAndShortestPathFinder(5), config);
GetPathsResult pathsResult = pathComputer.getPath(flow);
// then: system returns a path with least weight
assertFalse(pathsResult.isBackUpPathComputationWayUsed());
assertThat(pathsResult.getForward().getSegments().get(1).getSrcSwitchId(), equalTo(new SwitchId("00:02")));
assertThat(pathsResult.getReverse().getSegments().get(1).getSrcSwitchId(), equalTo(new SwitchId("00:02")));
}
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 FlowRerouteHubBolt 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 FlowRerouteService(this, persistenceManager, pathComputer, resourcesManager, config.getPathAllocationRetriesLimit(), config.getPathAllocationRetryDelay(), config.getResourceAllocationRetriesLimit(), config.getSpeakerCommandRetriesLimit());
}
Aggregations