use of org.openkilda.wfm.topology.isllatency.model.IslKey in project open-kilda by telstra.
the class IslStatsService method handleRoundTripLatencyMetric.
/**
* Handle round trip latency metric.
*
* @param timestamp timestamp of metric
* @param data round trip latency info data
* @param destination isl destination endpoint
*/
public void handleRoundTripLatencyMetric(long timestamp, IslRoundTripLatency data, Endpoint destination) {
if (data.getLatency() < 0) {
log.warn("Received invalid round trip latency {} for ISL {}_{} ===> {}_{}. Packet Id: {}. Origin: {}", data.getLatency(), data.getSrcSwitchId(), data.getSrcPortNo(), destination.getDatapath(), destination.getPortNumber(), data.getPacketId(), data.getOrigin());
return;
}
log.debug("Received round trip latency {} for ISL {}_{} ===> {}_{}. Packet Id: {}. Origin: {}", data.getLatency(), data.getSrcSwitchId(), data.getSrcPortNo(), destination.getDatapath(), destination.getPortNumber(), data.getPacketId(), data.getOrigin());
IslKey islKey = new IslKey(data, destination);
roundTripLatencyStorage.put(islKey, new LatencyRecord(data.getLatency(), timestamp));
oneWayLatencyEmitTimeoutMap.remove(islKey);
oneWayLatencyEmitTimeoutMap.remove(islKey.getReverse());
clearOneWayRecords(islKey);
clearOneWayRecords(islKey.getReverse());
carrier.emitLatency(data.getSrcSwitchId(), data.getSrcPortNo(), destination.getDatapath(), destination.getPortNumber(), data.getLatency(), timestamp, data.getOrigin());
}
use of org.openkilda.wfm.topology.isllatency.model.IslKey in project open-kilda by telstra.
the class IslLatencyService method handleRoundTripIslLatency.
/**
* Handle round trip latency.
*
* @param data round trip latency info data
* @param destination isl destination endpoint
* @param timestamp latency timestamp
*/
public void handleRoundTripIslLatency(IslRoundTripLatency data, Endpoint destination, long timestamp) {
if (data.getLatency() < 0) {
log.warn("Received invalid round trip latency {} for ISL {}_{} ===> {}_{}. Packet Id: {}. Origin: {}", data.getLatency(), data.getSrcSwitchId(), data.getSrcPortNo(), destination.getDatapath(), destination.getPortNumber(), data.getPacketId(), data.getOrigin());
return;
}
log.debug("Received round trip latency {} for ISL {}_{} ===> {}_{}. Packet Id: {}. Origin: {}", data.getLatency(), data.getSrcSwitchId(), data.getSrcPortNo(), destination.getDatapath(), destination.getPortNumber(), data.getPacketId(), data.getOrigin());
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);
}
}
use of org.openkilda.wfm.topology.isllatency.model.IslKey in project open-kilda by telstra.
the class IslLatencyServiceTest method handleOneWayIslLatencyNonExistentIslTest.
@Test
public void handleOneWayIslLatencyNonExistentIslTest() {
int fakePort = 999;
IslKey islKey = new IslKey(SWITCH_ID_1, fakePort, SWITCH_ID_2, fakePort);
assertTrue(islLatencyService.isUpdateRequired(islKey));
IslOneWayLatency nonExistent = new IslOneWayLatency(SWITCH_ID_1, fakePort, SWITCH_ID_2, fakePort, 3, PACKET_ID);
islLatencyService.handleOneWayIslLatency(nonExistent, System.currentTimeMillis());
assertTrue(islLatencyService.isUpdateRequired(islKey));
}
Aggregations