use of org.openkilda.wfm.topology.flowmonitoring.model.Link in project open-kilda by telstra.
the class FlowCacheServiceTest method shouldSendCheckLatencyRequests.
@Test
public void shouldSendCheckLatencyRequests() {
when(clock.instant()).thenReturn(Instant.now());
dummyFactory.makeFlow(new FlowEndpoint(SRC_SWITCH, 8), new FlowEndpoint(SRC_SWITCH, 9));
Flow flow = createFlow();
service = new FlowCacheService(persistenceManager, clock, FLOW_RTT_STATS_EXPIRATION_TIME, carrier);
service.processFlowLatencyCheck(flow.getFlowId());
List<Link> expectedForwardPath = getLinks(SRC_SWITCH, ISL_SRC_PORT, DST_SWITCH, ISL_DST_PORT);
verify(carrier).emitCalculateFlowLatencyRequest(flow.getFlowId(), FlowDirection.FORWARD, expectedForwardPath);
List<Link> expectedReversePath = reverse(expectedForwardPath);
verify(carrier).emitCalculateFlowLatencyRequest(flow.getFlowId(), FlowDirection.REVERSE, expectedReversePath);
verifyNoMoreInteractions(carrier);
}
use of org.openkilda.wfm.topology.flowmonitoring.model.Link in project open-kilda by telstra.
the class FlowCacheServiceTest method shouldChangeFlowPathInCache.
@Test
public void shouldChangeFlowPathInCache() {
Flow flow = createFlow();
when(clock.instant()).thenReturn(Instant.now());
service = new FlowCacheService(persistenceManager, clock, FLOW_RTT_STATS_EXPIRATION_TIME, carrier);
Long maxLatency = 100L;
Long maxLatencyTier2 = 200L;
UpdateFlowCommand updateFlowCommand = new UpdateFlowCommand(flow.getFlowId(), FlowPathDto.builder().id(flow.getFlowId()).forwardPath(Arrays.asList(new PathNodePayload(SRC_SWITCH, IN_PORT, ISL_SRC_PORT_2), new PathNodePayload(DST_SWITCH, ISL_DST_PORT_2, OUT_PORT))).reversePath(Arrays.asList(new PathNodePayload(DST_SWITCH, OUT_PORT, ISL_DST_PORT_2), new PathNodePayload(SRC_SWITCH, ISL_SRC_PORT_2, IN_PORT))).build(), maxLatency, maxLatencyTier2);
service.updateFlowInfo(updateFlowCommand);
service.processFlowLatencyCheck(flow.getFlowId());
List<Link> expectedForwardPath = getLinks(SRC_SWITCH, ISL_SRC_PORT_2, DST_SWITCH, ISL_DST_PORT_2);
verify(carrier).emitCalculateFlowLatencyRequest(flow.getFlowId(), FlowDirection.FORWARD, expectedForwardPath);
List<Link> expectedReversePath = reverse(expectedForwardPath);
verify(carrier).emitCalculateFlowLatencyRequest(flow.getFlowId(), FlowDirection.REVERSE, expectedReversePath);
verifyNoMoreInteractions(carrier);
}
Aggregations