use of org.openkilda.messaging.info.event.IslStatusUpdateNotification in project open-kilda by telstra.
the class CacheServiceTest method handleUpdateCacheInactiveTest.
@Test()
public void handleUpdateCacheInactiveTest() {
IslStatusUpdateNotification notification = new IslStatusUpdateNotification(SWITCH_ID_1, PORT_1, SWITCH_ID_2, PORT_2, INACTIVE);
updateIslStatus(SWITCH_ID_1, PORT_1, SWITCH_ID_2, PORT_2, INACTIVE);
updateIslStatus(SWITCH_ID_2, PORT_2, SWITCH_ID_1, PORT_1, INACTIVE);
cacheService.handleUpdateCache(notification);
IslRoundTripLatency forward = new IslRoundTripLatency(SWITCH_ID_1, PORT_1, 1, 0L);
checkHandleGetDataFromCache(forward, SWITCH_ID_2, PORT_2);
IslRoundTripLatency reverse = new IslRoundTripLatency(SWITCH_ID_2, PORT_2, 1, 0L);
checkHandleGetDataFromCache(reverse, SWITCH_ID_1, PORT_1);
}
use of org.openkilda.messaging.info.event.IslStatusUpdateNotification 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.IslStatusUpdateNotification in project open-kilda by telstra.
the class IslStatsServiceTest method handleOneWayLatencyEmitOnEachIslDownTest.
@Test
public void handleOneWayLatencyEmitOnEachIslDownTest() 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);
buffer.add(new LatencyRecord(i + secondPartOfPacketsSize, time.toEpochMilli()));
time = time.plusMillis(500);
// need to real shift of system clock
sleep(50);
}
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 IslStatsServiceTest method handleOneWayLatencyNoEmitOnEachIslMoveTest.
@Test
public void handleOneWayLatencyNoEmitOnEachIslMoveTest() throws InterruptedException {
// RTL: ............................
// OneWay: ..X.X.X.X........X.X.X.X....
// Timeout: ...|_________|...|_________|
// ISL move: .........^..............^...
Instant time = Instant.now().minusSeconds(LATENCY_TIMEOUT - 1);
for (int i = 0; i < 4; i++) {
sendForwardOneWayLatency(i, time);
// waiting for timeout and collecting one way records
time = time.plusSeconds(1);
}
islStatsService.handleIstStatusUpdateNotification(new IslStatusUpdateNotification(SWITCH_ID_1, PORT_1, SWITCH_ID_2, PORT_2, MOVED));
time = time.plusSeconds(LATENCY_TIMEOUT + 1);
int secondPartOfPacketsSize = 4;
for (int i = 0; i < secondPartOfPacketsSize; i++) {
sendForwardOneWayLatency(i + secondPartOfPacketsSize, time);
time = time.plusMillis(50);
// need to real shift of system clock
sleep(50);
}
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 CacheBolt method handleStatusUpdate.
private void handleStatusUpdate(Tuple tuple) throws PipelineException {
IslStatusUpdateNotification notification = pullValue(tuple, ISL_STATUS_FIELD, IslStatusUpdateNotification.class);
cacheService.handleUpdateCache(notification);
}
Aggregations