Search in sources :

Example 1 with Isl

use of org.openkilda.model.Isl in project open-kilda by telstra.

the class IslCacheServiceTest method createIsl.

private void createIsl(Switch srcSwitch, int srcPort, Switch dstSwitch, int dstPort) {
    Isl isl = Isl.builder().srcSwitch(srcSwitch).srcPort(srcPort).destSwitch(dstSwitch).destPort(dstPort).status(ACTIVE).latency(100).build();
    islRepository.add(isl);
}
Also used : Isl(org.openkilda.model.Isl)

Example 2 with Isl

use of org.openkilda.model.Isl in project open-kilda by telstra.

the class IslLatencyTopologyTest method createIsl.

@PersistenceContextRequired
private void createIsl(Switch srcSwitch, int srcPort, Switch dstSwitch, int dstPort, int latency) {
    Isl isl = Isl.builder().srcSwitch(srcSwitch).srcPort(srcPort).destSwitch(dstSwitch).destPort(dstPort).actualStatus(IslStatus.ACTIVE).status(IslStatus.ACTIVE).latency(latency).build();
    islRepository.add(isl);
}
Also used : Isl(org.openkilda.model.Isl) PersistenceContextRequired(org.openkilda.persistence.context.PersistenceContextRequired)

Example 3 with Isl

use of org.openkilda.model.Isl in project open-kilda by telstra.

the class CacheService method updateCache.

private Endpoint updateCache(Endpoint source) throws IslNotFoundException, IllegalIslStateException {
    Isl isl = getNotMovedIsl(source);
    Endpoint destination = Endpoint.of(isl.getDestSwitchId(), isl.getDestPort());
    cache.put(source, destination);
    cache.put(destination, source);
    return destination;
}
Also used : Isl(org.openkilda.model.Isl) Endpoint(org.openkilda.wfm.share.model.Endpoint)

Example 4 with Isl

use of org.openkilda.model.Isl in project open-kilda by telstra.

the class LatencyPathComputationStrategyBaseTest method shouldFindPathOverDiamondWithOneIslUnderMaintenanceByLatency.

@Test
public void shouldFindPathOverDiamondWithOneIslUnderMaintenanceByLatency() throws UnroutableFlowException, RecoverableException {
    createDiamond(IslStatus.ACTIVE, IslStatus.ACTIVE, 100L, 1000L);
    Switch srcSwitch = getSwitchById("00:01");
    Switch destSwitch = getSwitchById("00:04");
    Isl linkAB = islRepository.findBySrcSwitch(srcSwitch.getSwitchId()).stream().filter(isl -> isl.getDestSwitchId().equals(new SwitchId("00:02"))).findAny().orElseThrow(() -> new IllegalStateException("Link A-B not found"));
    linkAB.setUnderMaintenance(true);
    Flow flow = new TestFlowBuilder().srcSwitch(srcSwitch).destSwitch(destSwitch).bandwidth(100).pathComputationStrategy(PathComputationStrategy.LATENCY).build();
    PathComputer pathComputer = pathComputerFactory.getPathComputer();
    GetPathsResult path = pathComputer.getPath(flow);
    assertNotNull(path);
    assertThat(path.getForward().getSegments(), Matchers.hasSize(2));
    // should now have C as first hop since A - B link is under maintenance
    assertEquals(new SwitchId("00:03"), path.getForward().getSegments().get(0).getDestSwitchId());
}
Also used : Isl(org.openkilda.model.Isl) PathComputer(org.openkilda.pce.PathComputer) Switch(org.openkilda.model.Switch) SwitchId(org.openkilda.model.SwitchId) Flow(org.openkilda.model.Flow) GetPathsResult(org.openkilda.pce.GetPathsResult) Test(org.junit.Test)

Example 5 with Isl

use of org.openkilda.model.Isl in project open-kilda by telstra.

the class FermaIslRepository method findByEndpoint.

@Override
public Collection<Isl> findByEndpoint(SwitchId switchId, int port) {
    List<Isl> result = new ArrayList<>();
    framedGraph().traverse(g -> g.E().hasLabel(IslFrame.FRAME_LABEL).has(IslFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId)).has(IslFrame.SRC_PORT_PROPERTY, port)).frameExplicit(IslFrame.class).forEachRemaining(frame -> result.add(addIslConfigToIsl(new Isl(frame))));
    framedGraph().traverse(g -> g.E().hasLabel(IslFrame.FRAME_LABEL).has(IslFrame.DST_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId)).has(IslFrame.DST_PORT_PROPERTY, port)).frameExplicit(IslFrame.class).forEachRemaining(frame -> result.add(addIslConfigToIsl(new Isl(frame))));
    return result;
}
Also used : Isl(org.openkilda.model.Isl) IslFrame(org.openkilda.persistence.ferma.frames.IslFrame) ArrayList(java.util.ArrayList)

Aggregations

Isl (org.openkilda.model.Isl)83 Test (org.junit.Test)49 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)25 Endpoint (org.openkilda.wfm.share.model.Endpoint)18 Switch (org.openkilda.model.Switch)17 IslReference (org.openkilda.wfm.share.model.IslReference)11 SwitchId (org.openkilda.model.SwitchId)10 IslInfoData (org.openkilda.messaging.info.event.IslInfoData)9 IslDataHolder (org.openkilda.wfm.topology.network.model.IslDataHolder)8 ArrayList (java.util.ArrayList)6 PathId (org.openkilda.model.PathId)6 Flow (org.openkilda.model.Flow)5 IslRepository (org.openkilda.persistence.repositories.IslRepository)5 Collection (java.util.Collection)4 HashMap (java.util.HashMap)4 List (java.util.List)4 Map (java.util.Map)4 FlowPath (org.openkilda.model.FlowPath)4 PersistenceException (org.openkilda.persistence.exceptions.PersistenceException)4 IslFrame (org.openkilda.persistence.ferma.frames.IslFrame)4