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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations