Search in sources :

Example 6 with Link

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);
}
Also used : FlowEndpoint(org.openkilda.model.FlowEndpoint) Link(org.openkilda.wfm.topology.flowmonitoring.model.Link) Flow(org.openkilda.model.Flow) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 7 with Link

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);
}
Also used : UpdateFlowCommand(org.openkilda.messaging.info.flow.UpdateFlowCommand) PathNodePayload(org.openkilda.messaging.payload.flow.PathNodePayload) Link(org.openkilda.wfm.topology.flowmonitoring.model.Link) Flow(org.openkilda.model.Flow) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Aggregations

Link (org.openkilda.wfm.topology.flowmonitoring.model.Link)7 Duration (java.time.Duration)3 Test (org.junit.Test)3 Flow (org.openkilda.model.Flow)3 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)3 Instant (java.time.Instant)2 Values (org.apache.storm.tuple.Values)2 IslChangedInfoData (org.openkilda.messaging.info.event.IslChangedInfoData)2 IslOneWayLatency (org.openkilda.messaging.info.event.IslOneWayLatency)2 IslRoundTripLatency (org.openkilda.messaging.info.event.IslRoundTripLatency)2 UpdateFlowCommand (org.openkilda.messaging.info.flow.UpdateFlowCommand)2 FlowRttStatsData (org.openkilda.messaging.info.stats.FlowRttStatsData)2 LinkState (org.openkilda.wfm.topology.flowmonitoring.model.LinkState)2 Clock (java.time.Clock)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 Slf4j (lombok.extern.slf4j.Slf4j)1 InfoData (org.openkilda.messaging.info.InfoData)1