Search in sources :

Example 26 with PathComputer

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());
}
Also used : PathComputer(org.openkilda.pce.PathComputer) AvailableNetworkFactory(org.openkilda.pce.AvailableNetworkFactory) PathComputerFactory(org.openkilda.pce.PathComputerFactory) FlowResourcesManager(org.openkilda.wfm.share.flow.resources.FlowResourcesManager) FlowUpdateService(org.openkilda.wfm.topology.flowhs.service.FlowUpdateService)

Example 27 with PathComputer

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());
}
Also used : PathComputer(org.openkilda.pce.PathComputer) AvailableNetworkFactory(org.openkilda.pce.AvailableNetworkFactory) FlowMirrorPointCreateService(org.openkilda.wfm.topology.flowhs.service.FlowMirrorPointCreateService) PathComputerFactory(org.openkilda.pce.PathComputerFactory) FlowResourcesManager(org.openkilda.wfm.share.flow.resources.FlowResourcesManager)

Example 28 with PathComputer

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);
}
Also used : PathComputer(org.openkilda.pce.PathComputer) SwitchId(org.openkilda.model.SwitchId) FlowPath(org.openkilda.model.FlowPath) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 29 with PathComputer

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);
}
Also used : PathComputer(org.openkilda.pce.PathComputer) Switch(org.openkilda.model.Switch) BestWeightAndShortestPathFinder(org.openkilda.pce.finder.BestWeightAndShortestPathFinder) SwitchId(org.openkilda.model.SwitchId) Flow(org.openkilda.model.Flow) GetPathsResult(org.openkilda.pce.GetPathsResult) Ignore(org.junit.Ignore) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 30 with PathComputer

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());
}
Also used : PathComputer(org.openkilda.pce.PathComputer) SwitchId(org.openkilda.model.SwitchId) Segment(org.openkilda.pce.Path.Segment) PathSegment(org.openkilda.model.PathSegment) Flow(org.openkilda.model.Flow) GetPathsResult(org.openkilda.pce.GetPathsResult)

Aggregations

PathComputer (org.openkilda.pce.PathComputer)56 Test (org.junit.Test)46 Flow (org.openkilda.model.Flow)45 GetPathsResult (org.openkilda.pce.GetPathsResult)39 SwitchId (org.openkilda.model.SwitchId)33 Switch (org.openkilda.model.Switch)27 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)8 FlowPath (org.openkilda.model.FlowPath)7 AvailableNetworkFactory (org.openkilda.pce.AvailableNetworkFactory)7 PathComputerFactory (org.openkilda.pce.PathComputerFactory)7 FlowResourcesManager (org.openkilda.wfm.share.flow.resources.FlowResourcesManager)7 BestWeightAndShortestPathFinder (org.openkilda.pce.finder.BestWeightAndShortestPathFinder)6 PathSegment (org.openkilda.model.PathSegment)4 Segment (org.openkilda.pce.Path.Segment)4 PathId (org.openkilda.model.PathId)3 RuleManager (org.openkilda.rulemanager.RuleManager)3 RuleManagerImpl (org.openkilda.rulemanager.RuleManagerImpl)3 Isl (org.openkilda.model.Isl)2 FlowCreateService (org.openkilda.wfm.topology.flowhs.service.FlowCreateService)2 FlowRerouteService (org.openkilda.wfm.topology.flowhs.service.FlowRerouteService)2