use of org.openkilda.wfm.topology.flowmonitoring.model.LinkState in project open-kilda by telstra.
the class IslCacheService method handleOneWayLatency.
/**
* Update one way latency for ISL.
*/
public void handleOneWayLatency(IslOneWayLatency data) {
Link link = Link.builder().srcSwitchId(data.getSrcSwitchId()).srcPort(data.getSrcPortNo()).destSwitchId(data.getDstSwitchId()).destPort(data.getDstPortNo()).build();
LinkState linkState = linkStates.get(link);
if (linkState == null) {
linkStates.put(link, LinkState.builder().oneWayLatency(data.getLatency()).build());
} else {
linkState.setOneWayLatency(data.getLatency());
}
}
use of org.openkilda.wfm.topology.flowmonitoring.model.LinkState in project open-kilda by telstra.
the class IslCacheService method handleRoundTripLatency.
/**
* Update RTT latency for ISL.
*/
public void handleRoundTripLatency(IslRoundTripLatency data) {
List<Link> links = linkStates.keySet().stream().filter(link -> link.srcEquals(data.getSrcSwitchId(), data.getSrcPortNo())).collect(Collectors.toList());
Instant instant = clock.instant();
links.forEach(link -> {
LinkState linkState = linkStates.get(link);
if (linkState == null) {
linkStates.put(link, LinkState.builder().rttLatency(data.getLatency()).rttTimestamp(instant).build());
} else {
linkState.setRttLatency(data.getLatency());
linkState.setRttTimestamp(instant);
}
});
}
use of org.openkilda.wfm.topology.flowmonitoring.model.LinkState in project open-kilda by telstra.
the class IslCacheService method getLatencyForLink.
/**
* Get latency for link.
*/
public Duration getLatencyForLink(Link link) {
log.debug("Request for link latency {}", link);
LinkState linkState = linkStates.get(link);
if (linkState == null) {
log.warn("Link not found in ISL cache {}", link);
return Duration.ZERO;
} else {
return linkState.getLatency(clock.instant(), islRttLatencyExpiration);
}
}
Aggregations