use of org.openkilda.messaging.info.event.IslRoundTripLatency in project open-kilda by telstra.
the class CacheServiceTest method testHandleUpdateCache.
private void testHandleUpdateCache(IslStatus islStatus) {
IslStatusUpdateNotification notification = new IslStatusUpdateNotification(SWITCH_ID_1, PORT_1, SWITCH_ID_2, PORT_2, islStatus);
updateIslStatus(SWITCH_ID_1, PORT_1, SWITCH_ID_2, PORT_2, islStatus);
updateIslStatus(SWITCH_ID_2, PORT_2, SWITCH_ID_1, PORT_1, islStatus);
cacheService.handleUpdateCache(notification);
IslRoundTripLatency forward = new IslRoundTripLatency(SWITCH_ID_1, PORT_1, 1, 0L);
checkHandleGetDataFromCacheDidNotCallEmitCacheData(forward);
IslRoundTripLatency reverse = new IslRoundTripLatency(SWITCH_ID_2, PORT_2, 1, 0L);
checkHandleGetDataFromCacheDidNotCallEmitCacheData(reverse);
}
use of org.openkilda.messaging.info.event.IslRoundTripLatency in project open-kilda by telstra.
the class RouterBolt method handleInput.
@Override
protected void handleInput(Tuple input) throws PipelineException {
Message message = pullValue(input, FIELD_ID_PAYLOAD, Message.class);
if (active) {
if (message instanceof InfoMessage) {
log.debug("Received info message {}", message);
InfoData data = ((InfoMessage) message).getData();
if (data instanceof IslOneWayLatency) {
handleOneWayLatency(input, (IslOneWayLatency) data);
} else if (data instanceof IslRoundTripLatency) {
handleRoundTripLatency(input, (IslRoundTripLatency) data);
} else if (data instanceof IslRttStatsData) {
handleRoundTripLatency(input, (IslRttStatsData) data);
} else {
unhandledInput(input);
}
} else {
unhandledInput(input);
}
}
}
use of org.openkilda.messaging.info.event.IslRoundTripLatency in project open-kilda by telstra.
the class IslLatencyServiceTest method handleRoundTripIslLatencyNonExistentIslTest.
@Test
public void handleRoundTripIslLatencyNonExistentIslTest() {
int fakePort = 998;
IslKey islKey = new IslKey(SWITCH_ID_1, fakePort, SWITCH_ID_2, fakePort);
assertTrue(islLatencyService.isUpdateRequired(islKey));
IslRoundTripLatency nonExistent = new IslRoundTripLatency(SWITCH_ID_1, fakePort, 4, PACKET_ID);
islLatencyService.handleRoundTripIslLatency(nonExistent, Endpoint.of(SWITCH_ID_2, fakePort), System.currentTimeMillis());
assertTrue(islLatencyService.isUpdateRequired(islKey));
}
use of org.openkilda.messaging.info.event.IslRoundTripLatency in project open-kilda by telstra.
the class IslLatencyServiceTest method isUpdateRequiredTest.
@Test
public void isUpdateRequiredTest() {
assertTrue(islLatencyService.isUpdateRequired(FORWARD_ISL_KEY));
IslRoundTripLatency data = new IslRoundTripLatency(SWITCH_ID_1, PORT_1, 1L, 0L);
Endpoint destination = Endpoint.of(SWITCH_ID_2, PORT_2);
islLatencyService.handleRoundTripIslLatency(data, destination, System.currentTimeMillis());
assertFalse(islLatencyService.isUpdateRequired(FORWARD_ISL_KEY));
}
use of org.openkilda.messaging.info.event.IslRoundTripLatency in project open-kilda by telstra.
the class PathVerificationService method handleRoundTripLatency.
private void handleRoundTripLatency(DiscoveryPacketData packetData, OfInput input) {
SwitchId switchId = new SwitchId(input.getDpId().getLong());
int port = OFMessageUtils.getInPort((OFPacketIn) input.getMessage()).getPortNumber();
logIsl.debug("got round trip packet: {}_{}, T0: {}, T1: {}, id:{}", switchId, port, packetData.getSwitchT0(), packetData.getSwitchT1(), packetData.getPacketId());
SwitchId switchIdFromPacket = new SwitchId(packetData.getRemoteSwitchId().getLong());
int portFromPacket = packetData.getRemotePort().getPortNumber();
if (!Objects.equals(switchId, switchIdFromPacket) || port != portFromPacket) {
logger.warn("Endpoint from round trip latency package and endpoint from which the package was received " + "are different. Endpoint from package: {}-{}. " + "Endpoint from which package was received: {}-{}", switchIdFromPacket, portFromPacket, switchId, port);
return;
}
long roundTripLatency = calculateRoundTripLatency(switchId, port, packetData.getSwitchT0(), packetData.getSwitchT1());
IslRoundTripLatency latency = new IslRoundTripLatency(switchId, port, roundTripLatency, packetData.getPacketId(), "floodlight");
logger.debug("Round trip latency packet processed for endpoint {}_{}. " + "t0 timestamp {}, t1 timestamp {}, latency {}.", switchId, port, packetData.getSwitchT0(), packetData.getSwitchT1(), roundTripLatency);
sendLatency(latency, switchId);
sendRoundTripDiscovery(latency);
}
Aggregations