Search in sources :

Example 6 with IslStatusUpdateNotification

use of org.openkilda.messaging.info.event.IslStatusUpdateNotification in project open-kilda by telstra.

the class IslStatsBolt method handleStatusUpdate.

private void handleStatusUpdate(Tuple tuple) throws PipelineException {
    IslStatusUpdateNotification notification = pullValue(tuple, ISL_STATUS_FIELD, IslStatusUpdateNotification.class);
    islStatsService.handleIstStatusUpdateNotification(notification);
}
Also used : IslStatusUpdateNotification(org.openkilda.messaging.info.event.IslStatusUpdateNotification)

Example 7 with IslStatusUpdateNotification

use of org.openkilda.messaging.info.event.IslStatusUpdateNotification in project open-kilda by telstra.

the class IslStatsServiceTest method handleOneWayLatencyEmitOnFirstIslDownTest.

@Test
public void handleOneWayLatencyEmitOnFirstIslDownTest() throws InterruptedException {
    // RTL:      ............................
    // OneWay:   ..X.X.X.X........X.X.X.X....
    // Timeout:  ...|_________|...|_________|
    // ISL down: .........^..................
    List<LatencyRecord> buffer = new ArrayList<>();
    Instant time = Instant.now().minusSeconds(LATENCY_TIMEOUT).minusMillis(500);
    for (int i = 0; i < 4; i++) {
        sendForwardOneWayLatency(i, time);
        // waiting for timeout and collecting one way records
        verifyNoMoreInteractions(carrier);
        buffer.add(new LatencyRecord(i, time.toEpochMilli()));
        time = time.plusSeconds(1);
    }
    buffer.remove(0);
    islStatsService.handleIstStatusUpdateNotification(new IslStatusUpdateNotification(SWITCH_ID_1, PORT_1, SWITCH_ID_2, PORT_2, INACTIVE));
    time = Instant.now();
    int secondPartOfPacketsSize = 4;
    for (int i = 0; i < secondPartOfPacketsSize; i++) {
        sendForwardOneWayLatency(i + secondPartOfPacketsSize, time);
        // we do not add this record into buffer because we must not emit it
        time = time.plusMillis(500);
        // need to real shift of system clock
        sleep(50);
    }
    assertEmitLatency(buffer);
}
Also used : IslStatusUpdateNotification(org.openkilda.messaging.info.event.IslStatusUpdateNotification) LatencyRecord(org.openkilda.wfm.topology.isllatency.model.LatencyRecord) Instant(java.time.Instant) ArrayList(java.util.ArrayList) Endpoint(org.openkilda.wfm.share.model.Endpoint) Test(org.junit.Test)

Example 8 with IslStatusUpdateNotification

use of org.openkilda.messaging.info.event.IslStatusUpdateNotification in project open-kilda by telstra.

the class IslStatsServiceTest method handleOneWayLatencyIslMovedTest.

@Test
public void handleOneWayLatencyIslMovedTest() {
    // RTL:       ...........................
    // OneWay:    ..X.X.X.X..................
    // Timeout:   ...|____________|..........
    // ISL moved: .........^.................
    Instant time = Instant.now().minusSeconds(LATENCY_TIMEOUT).minusMillis(500);
    for (int i = 0; i < 4; i++) {
        sendForwardOneWayLatency(i, time);
        // waiting for timeout and collecting one way records
        verifyNoMoreInteractions(carrier);
        time = time.plusSeconds(1);
    }
    islStatsService.handleIstStatusUpdateNotification(new IslStatusUpdateNotification(SWITCH_ID_1, PORT_1, SWITCH_ID_2, PORT_2, MOVED));
    verifyNoMoreInteractions(carrier);
}
Also used : IslStatusUpdateNotification(org.openkilda.messaging.info.event.IslStatusUpdateNotification) Instant(java.time.Instant) Endpoint(org.openkilda.wfm.share.model.Endpoint) Test(org.junit.Test)

Example 9 with IslStatusUpdateNotification

use of org.openkilda.messaging.info.event.IslStatusUpdateNotification in project open-kilda by telstra.

the class IslStatsServiceTest method handleOneWayLatencyEmitOnIslDownTest.

@Test
public void handleOneWayLatencyEmitOnIslDownTest() {
    // RTL:      ...........................
    // OneWay:   ..X.X.X.X..................
    // Timeout:  ...|____________|..........
    // ISL down: .........^.................
    List<LatencyRecord> buffer = new ArrayList<>();
    Instant time = Instant.now().minusSeconds(LATENCY_TIMEOUT).minusMillis(500);
    for (int i = 0; i < 4; i++) {
        sendForwardOneWayLatency(i, time);
        // waiting for timeout and collecting one way records
        verifyNoMoreInteractions(carrier);
        buffer.add(new LatencyRecord(i, time.toEpochMilli()));
        time = time.plusSeconds(1);
    }
    // first record is outdated and we must not emit it
    buffer.remove(0);
    islStatsService.handleIstStatusUpdateNotification(new IslStatusUpdateNotification(SWITCH_ID_1, PORT_1, SWITCH_ID_2, PORT_2, INACTIVE));
    assertEmitLatency(buffer);
}
Also used : IslStatusUpdateNotification(org.openkilda.messaging.info.event.IslStatusUpdateNotification) LatencyRecord(org.openkilda.wfm.topology.isllatency.model.LatencyRecord) Instant(java.time.Instant) ArrayList(java.util.ArrayList) Endpoint(org.openkilda.wfm.share.model.Endpoint) Test(org.junit.Test)

Example 10 with IslStatusUpdateNotification

use of org.openkilda.messaging.info.event.IslStatusUpdateNotification in project open-kilda by telstra.

the class IslFsm method sendIslStatusUpdateNotification.

private void sendIslStatusUpdateNotification(IslFsmContext context, IslStatus status) {
    IslStatusUpdateNotification trigger = new IslStatusUpdateNotification(reference.getSource().getDatapath(), reference.getSource().getPortNumber(), reference.getDest().getDatapath(), reference.getDest().getPortNumber(), status);
    context.getOutput().islStatusUpdateNotification(trigger);
}
Also used : IslStatusUpdateNotification(org.openkilda.messaging.info.event.IslStatusUpdateNotification)

Aggregations

IslStatusUpdateNotification (org.openkilda.messaging.info.event.IslStatusUpdateNotification)12 Test (org.junit.Test)8 Instant (java.time.Instant)6 Endpoint (org.openkilda.wfm.share.model.Endpoint)6 ArrayList (java.util.ArrayList)3 LatencyRecord (org.openkilda.wfm.topology.isllatency.model.LatencyRecord)3 RerouteAffectedFlows (org.openkilda.messaging.command.reroute.RerouteAffectedFlows)2 IslRoundTripLatency (org.openkilda.messaging.info.event.IslRoundTripLatency)2 Isl (org.openkilda.model.Isl)2 IslReference (org.openkilda.wfm.share.model.IslReference)2 RoundTripStatus (org.openkilda.wfm.topology.network.model.RoundTripStatus)2 Duration (java.time.Duration)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Optional (java.util.Optional)1 AllArgsConstructor (lombok.AllArgsConstructor)1 EqualsAndHashCode (lombok.EqualsAndHashCode)1