use of org.openkilda.messaging.info.event.IslRoundTripLatency in project open-kilda by telstra.
the class IslLatencyTopologyTest method checkTopologyMetricAndDatabaseUpdateTest.
@Test
public void checkTopologyMetricAndDatabaseUpdateTest() throws IslNotFoundException, JsonProcessingException {
// It's hard to split this test on several tests because IslStatsBolts and IslLatencyBolt has internal states
long latency1 = 1;
long latency2 = 2;
long latency3 = 3;
long latency4 = 4;
long latency5 = 5;
IslOneWayLatency firstOneWayLatency = createForwardIslOneWayLatency(latency1);
IslOneWayLatency secondOneWayLatency = createForwardIslOneWayLatency(latency3);
IslOneWayLatency reverseOneWayLatency = createReverseIslOneWayLatency(latency5);
IslRoundTripLatency firstRoundTripLatency = new IslRoundTripLatency(SWITCH_ID_1, PORT_1, latency2, PACKET_ID);
IslRoundTripLatency secondRoundTripLatency = new IslRoundTripLatency(SWITCH_ID_1, PORT_1, latency4, PACKET_ID);
// we have no round trip latency so we have to use one way latency for the database, but not for OpenTSDB
pushMessage(firstOneWayLatency);
assertTrue(otsdbConsumer.isEmpty());
assertEquals(latency1 * ONE_WAY_LATENCY_MULTIPLIER, getIslLatency(FORWARD_ISL));
// we got round trip latency so we will use it for metric and database
long timestamp2 = pushMessage(firstRoundTripLatency);
assertMetric(FORWARD_ISL, latency2, timestamp2);
assertEquals(latency2, getIslLatency(FORWARD_ISL));
// we got one way latency but bolts already has data with RTL latency. one way latency will be ignored
pushMessage(secondOneWayLatency);
assertTrue(otsdbConsumer.isEmpty());
assertEquals(latency2, getIslLatency(FORWARD_ISL));
// we got new round trip latency and it will be used for metric
long timestamp4 = pushMessage(secondRoundTripLatency);
assertMetric(FORWARD_ISL, latency4, timestamp4);
// but not for database, because of big update time interval
assertEquals(latency2, getIslLatency(FORWARD_ISL));
// we got one way latency for reverse isl, but we already has RTL for forward ISL and we can use it
long timestamp5 = pushMessage(reverseOneWayLatency);
assertMetric(REVERSE_ISL, latency4, timestamp5);
assertEquals((latency2 + latency4) / 2, getIslLatency(REVERSE_ISL));
}
use of org.openkilda.messaging.info.event.IslRoundTripLatency in project open-kilda by telstra.
the class CacheServiceTest method handleGetDataFromCacheNonExistentIslTest.
@Test()
public void handleGetDataFromCacheNonExistentIslTest() {
IslRoundTripLatency nonExistent = new IslRoundTripLatency(SWITCH_ID_1, 999, 1, 0L);
checkHandleGetDataFromCacheDidNotCallEmitCacheData(nonExistent);
}
use of org.openkilda.messaging.info.event.IslRoundTripLatency in project open-kilda by telstra.
the class CacheServiceTest method handleGetDataFromCacheNonExistentSwitchTest.
@Test()
public void handleGetDataFromCacheNonExistentSwitchTest() {
IslRoundTripLatency nonExistent = new IslRoundTripLatency(new SwitchId(999), PORT_1, 1, 0L);
checkHandleGetDataFromCacheDidNotCallEmitCacheData(nonExistent);
}
use of org.openkilda.messaging.info.event.IslRoundTripLatency in project open-kilda by telstra.
the class CacheServiceTest method handleGetDataFromCacheTest.
@Test()
public void handleGetDataFromCacheTest() {
IslRoundTripLatency forward = new IslRoundTripLatency(SWITCH_ID_1, PORT_1, 1, 0L);
IslRoundTripLatency reverse = new IslRoundTripLatency(SWITCH_ID_2, PORT_2, 1, 0L);
checkHandleGetDataFromCache(forward, SWITCH_ID_2, PORT_2);
checkHandleGetDataFromCache(reverse, SWITCH_ID_1, PORT_1);
}
use of org.openkilda.messaging.info.event.IslRoundTripLatency in project open-kilda by telstra.
the class CacheServiceTest method testGetDataFromCacheNotFromInitCache.
private void testGetDataFromCacheNotFromInitCache(IslStatus islStatus) {
int srcPort = 5;
int dstPort = 6;
// isl is not in init cache yet
createIsl(switchRepository.findById(SWITCH_ID_1).get(), srcPort, switchRepository.findById(SWITCH_ID_2).get(), dstPort, 10, islStatus);
IslRoundTripLatency forward = new IslRoundTripLatency(SWITCH_ID_1, srcPort, 1, 0L);
IslRoundTripLatency reverse = new IslRoundTripLatency(SWITCH_ID_2, dstPort, 1, 0L);
checkHandleGetDataFromCache(forward, SWITCH_ID_2, dstPort);
checkHandleGetDataFromCache(reverse, SWITCH_ID_1, srcPort);
}
Aggregations