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);
}
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);
}
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;
}
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());
}
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;
}
Aggregations