Search in sources :

Example 6 with IslRoundTripLatency

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);
}
Also used : IslStatusUpdateNotification(org.openkilda.messaging.info.event.IslStatusUpdateNotification) IslRoundTripLatency(org.openkilda.messaging.info.event.IslRoundTripLatency)

Example 7 with IslRoundTripLatency

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);
        }
    }
}
Also used : InfoMessage(org.openkilda.messaging.info.InfoMessage) Message(org.openkilda.messaging.Message) IslRoundTripLatency(org.openkilda.messaging.info.event.IslRoundTripLatency) InfoMessage(org.openkilda.messaging.info.InfoMessage) InfoData(org.openkilda.messaging.info.InfoData) IslRttStatsData(org.openkilda.messaging.info.stats.IslRttStatsData) IslOneWayLatency(org.openkilda.messaging.info.event.IslOneWayLatency)

Example 8 with IslRoundTripLatency

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));
}
Also used : IslKey(org.openkilda.wfm.topology.isllatency.model.IslKey) IslRoundTripLatency(org.openkilda.messaging.info.event.IslRoundTripLatency) Endpoint(org.openkilda.wfm.share.model.Endpoint) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 9 with IslRoundTripLatency

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

Example 10 with IslRoundTripLatency

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);
}
Also used : IslRoundTripLatency(org.openkilda.messaging.info.event.IslRoundTripLatency) OFPacketIn(org.projectfloodlight.openflow.protocol.OFPacketIn) SwitchId(org.openkilda.model.SwitchId)

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