Search in sources :

Example 21 with IslRoundTripLatency

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()));
}
Also used : IslRoundTripLatency(org.openkilda.messaging.info.event.IslRoundTripLatency) Values(org.apache.storm.tuple.Values) SwitchId(org.openkilda.model.SwitchId)

Example 22 with IslRoundTripLatency

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);
    }
}
Also used : Endpoint(org.openkilda.wfm.share.model.Endpoint) IslRoundTripLatency(org.openkilda.messaging.info.event.IslRoundTripLatency) InfoData(org.openkilda.messaging.info.InfoData) IslOneWayLatency(org.openkilda.messaging.info.event.IslOneWayLatency)

Example 23 with IslRoundTripLatency

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);
}
Also used : IslRoundTripLatency(org.openkilda.messaging.info.event.IslRoundTripLatency) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Aggregations

IslRoundTripLatency (org.openkilda.messaging.info.event.IslRoundTripLatency)23 Test (org.junit.Test)11 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)10 IslOneWayLatency (org.openkilda.messaging.info.event.IslOneWayLatency)7 Endpoint (org.openkilda.wfm.share.model.Endpoint)6 InfoData (org.openkilda.messaging.info.InfoData)4 IslChangedInfoData (org.openkilda.messaging.info.event.IslChangedInfoData)4 SwitchId (org.openkilda.model.SwitchId)4 Duration (java.time.Duration)2 Instant (java.time.Instant)2 Values (org.apache.storm.tuple.Values)2 IslStatusUpdateNotification (org.openkilda.messaging.info.event.IslStatusUpdateNotification)2 Link (org.openkilda.wfm.topology.flowmonitoring.model.Link)2 Clock (java.time.Clock)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 Slf4j (lombok.extern.slf4j.Slf4j)1 Message (org.openkilda.messaging.Message)1