use of org.openkilda.messaging.info.event.IslRoundTripLatency in project open-kilda by telstra.
the class RouterBolt method handleRoundTripLatency.
private void handleRoundTripLatency(Tuple input, IslRttStatsData data) {
// IslRttStatsData comes from Server42 and holds timestamps in the noviflow format.
long t0 = noviflowTimestamp(data.getT0());
long t1 = noviflowTimestamp(data.getT1());
IslRoundTripLatency roundTripLatency = new IslRoundTripLatency(new SwitchId(data.getSwitchId()), data.getPort(), t1 - t0, null, data.getOrigin());
getOutput().emit(StreamType.CACHE.toString(), input, new Values(data.getSwitchId(), roundTripLatency, getCommandContext()));
}
use of org.openkilda.messaging.info.event.IslRoundTripLatency in project open-kilda by telstra.
the class IslStatsBolt method handleLatencyData.
private void handleLatencyData(Tuple input) throws PipelineException {
InfoData data = pullValue(input, LATENCY_DATA_FIELD, InfoData.class);
long timestamp = getCommandContext().getCreateTime();
if (data instanceof IslRoundTripLatency) {
Endpoint destination = pullValue(input, CACHE_DATA_FIELD, Endpoint.class);
islStatsService.handleRoundTripLatencyMetric(timestamp, (IslRoundTripLatency) data, destination);
} else if (data instanceof IslOneWayLatency) {
islStatsService.handleOneWayLatencyMetric(timestamp, (IslOneWayLatency) data);
} else {
unhandledInput(input);
}
}
use of org.openkilda.messaging.info.event.IslRoundTripLatency in project open-kilda by telstra.
the class IslCacheServiceTest method shouldGetLatencyForLinkByRttLatency.
@Test
public void shouldGetLatencyForLinkByRttLatency() {
long latency = 100L;
IslRoundTripLatency islRoundTripLatency = new IslRoundTripLatency(FIRST_SWITCH, ISL_SRC_PORT, latency, 1L);
when(clock.instant()).thenReturn(Instant.now());
service.handleRoundTripLatency(islRoundTripLatency);
long actual = service.getLatencyForLink(LINK).getNano();
assertEquals(latency, actual);
}
Aggregations