@Test public void handleRoundTripIslLatencyTest() { assertTrue(islLatencyService.isUpdateRequired(FORWARD_ISL_KEY)); islLatencyService.handleRoundTripIslLatency( createForwardRoundTripLatency(5), FORWARD_DESTINATION, System.currentTimeMillis()); assertForwardLatency(5); assertFalse(islLatencyService.isUpdateRequired(FORWARD_ISL_KEY)); islLatencyService.handleRoundTripIslLatency( createForwardRoundTripLatency(50000), FORWARD_DESTINATION, System.currentTimeMillis()); assertForwardLatency(5); assertFalse(islLatencyService.isUpdateRequired(FORWARD_ISL_KEY)); }
public void handleRoundTripIslLatency(IslRoundTripLatency data, Endpoint destination, long timestamp) { if (data.getLatency() < 0) { log.warn("Received invalid round trip latency {} for ISL {}_{} ===> {}_{}. Packet Id: {}", data.getLatency(), data.getSrcSwitchId(), data.getSrcPortNo(), destination.getDatapath(), destination.getPortNumber(), data.getPacketId()); return; } log.debug("Received round trip latency {} for ISL {}_{} ===> {}_{}. Packet Id: {}", data.getLatency(), data.getSrcSwitchId(), data.getSrcPortNo(), destination.getDatapath(), destination.getPortNumber(), data.getPacketId()); IslKey islKey = new IslKey(data, destination); roundTripLatencyStorage.putIfAbsent(islKey, new LinkedList<>()); roundTripLatencyStorage.get(islKey).add(new LatencyRecord(data.getLatency(), timestamp)); if (isUpdateRequired(islKey) || !roundTripLatencyIsSet.contains(islKey)) { updateRoundTripLatency(data, destination, islKey); } }
IslLatencyService { public void handleRoundTripIslLatency(IslRoundTripLatency data, Endpoint destination, long timestamp) { if (data.getLatency() < 0) { log.warn("Received invalid round trip latency {} for ISL {}_{} ===> {}_{}. Packet Id: {}", data.getLatency(), data.getSrcSwitchId(), data.getSrcPortNo(), destination.getDatapath(), destination.getPortNumber(), data.getPacketId()); return; } log.debug("Received round trip latency {} for ISL {}_{} ===> {}_{}. Packet Id: {}", data.getLatency(), data.getSrcSwitchId(), data.getSrcPortNo(), destination.getDatapath(), destination.getPortNumber(), data.getPacketId()); IslKey islKey = new IslKey(data, destination); roundTripLatencyStorage.putIfAbsent(islKey, new LinkedList<>()); roundTripLatencyStorage.get(islKey).add(new LatencyRecord(data.getLatency(), timestamp)); if (isUpdateRequired(islKey) || !roundTripLatencyIsSet.contains(islKey)) { updateRoundTripLatency(data, destination, islKey); } } }
IslLatencyService { public void handleRoundTripIslLatency(IslRoundTripLatency data, Endpoint destination, long timestamp) { if (data.getLatency() < 0) { log.warn("Received invalid round trip latency {} for ISL {}_{} ===> {}_{}. Packet Id: {}", data.getLatency(), data.getSrcSwitchId(), data.getSrcPortNo(), destination.getDatapath(), destination.getPortNumber(), data.getPacketId()); return; } log.debug("Received round trip latency {} for ISL {}_{} ===> {}_{}. Packet Id: {}", data.getLatency(), data.getSrcSwitchId(), data.getSrcPortNo(), destination.getDatapath(), destination.getPortNumber(), data.getPacketId()); IslKey islKey = new IslKey(data, destination); roundTripLatencyStorage.putIfAbsent(islKey, new LinkedList<>()); roundTripLatencyStorage.get(islKey).add(new LatencyRecord(data.getLatency(), timestamp)); if (isUpdateRequired(islKey) || !roundTripLatencyIsSet.contains(islKey)) { updateRoundTripLatency(data, destination, islKey); } } IslLatencyService(TransactionManager transactionManager,
                             RepositoryFactory repositoryFactory, long latencyUpdateInterval,
                             long latencyUpdateTimeRange); }
IslLatencyService { public void handleRoundTripIslLatency(IslRoundTripLatency data, Endpoint destination, long timestamp) { if (data.getLatency() < 0) { log.warn("Received invalid round trip latency {} for ISL {}_{} ===> {}_{}. Packet Id: {}", data.getLatency(), data.getSrcSwitchId(), data.getSrcPortNo(), destination.getDatapath(), destination.getPortNumber(), data.getPacketId()); return; } log.debug("Received round trip latency {} for ISL {}_{} ===> {}_{}. Packet Id: {}", data.getLatency(), data.getSrcSwitchId(), data.getSrcPortNo(), destination.getDatapath(), destination.getPortNumber(), data.getPacketId()); IslKey islKey = new IslKey(data, destination); roundTripLatencyStorage.putIfAbsent(islKey, new LinkedList<>()); roundTripLatencyStorage.get(islKey).add(new LatencyRecord(data.getLatency(), timestamp)); if (isUpdateRequired(islKey) || !roundTripLatencyIsSet.contains(islKey)) { updateRoundTripLatency(data, destination, islKey); } } IslLatencyService(TransactionManager transactionManager,
                             RepositoryFactory repositoryFactory, long latencyUpdateInterval,
                             long latencyUpdateTimeRange); void handleRoundTripIslLatency(IslRoundTripLatency data, Endpoint destination, long timestamp); void handleOneWayIslLatency(IslOneWayLatency data, long timestamp); }
IslLatencyService { public void handleRoundTripIslLatency(IslRoundTripLatency data, Endpoint destination, long timestamp) { if (data.getLatency() < 0) { log.warn("Received invalid round trip latency {} for ISL {}_{} ===> {}_{}. Packet Id: {}", data.getLatency(), data.getSrcSwitchId(), data.getSrcPortNo(), destination.getDatapath(), destination.getPortNumber(), data.getPacketId()); return; } log.debug("Received round trip latency {} for ISL {}_{} ===> {}_{}. Packet Id: {}", data.getLatency(), data.getSrcSwitchId(), data.getSrcPortNo(), destination.getDatapath(), destination.getPortNumber(), data.getPacketId()); IslKey islKey = new IslKey(data, destination); roundTripLatencyStorage.putIfAbsent(islKey, new LinkedList<>()); roundTripLatencyStorage.get(islKey).add(new LatencyRecord(data.getLatency(), timestamp)); if (isUpdateRequired(islKey) || !roundTripLatencyIsSet.contains(islKey)) { updateRoundTripLatency(data, destination, islKey); } } IslLatencyService(TransactionManager transactionManager,
                             RepositoryFactory repositoryFactory, long latencyUpdateInterval,
                             long latencyUpdateTimeRange); void handleRoundTripIslLatency(IslRoundTripLatency data, Endpoint destination, long timestamp); void handleOneWayIslLatency(IslOneWayLatency data, long timestamp); static final String ONE_WAY_LATENCY; static final String ROUND_TRIP_LATENCY; }