use of org.openkilda.wfm.topology.reroute.model.FlowThrottlingData in project open-kilda by telstra.
the class RerouteQueueServiceTest method shouldPrioritizeLowBandwidthFlowWithCostAndAvailableBandwidthPathComputationStrategy.
@Test
public void shouldPrioritizeLowBandwidthFlowWithCostAndAvailableBandwidthPathComputationStrategy() {
FlowThrottlingData first = getFlowThrottlingData(flow, CORRELATION_ID).priority(100).build();
FlowThrottlingData second = getFlowThrottlingData(flow, CORRELATION_ID).pathComputationStrategy(PathComputationStrategy.COST_AND_AVAILABLE_BANDWIDTH).bandwidth(100).build();
FlowThrottlingData third = getFlowThrottlingData(flow, CORRELATION_ID).pathComputationStrategy(PathComputationStrategy.COST_AND_AVAILABLE_BANDWIDTH).bandwidth(1000).build();
RerouteQueue firstQueue = RerouteQueue.builder().throttling(first).build();
RerouteQueue secondQueue = RerouteQueue.builder().throttling(second).build();
RerouteQueue thirdQueue = RerouteQueue.builder().throttling(third).build();
rerouteQueueService.getReroutes().put("third flow", thirdQueue);
rerouteQueueService.getReroutes().put("second flow", secondQueue);
rerouteQueueService.getReroutes().put("first flow", firstQueue);
rerouteQueueService.flushThrottling();
verify(carrier).sendRerouteRequest(any(String.class), eq(getFlowRerouteRequest("first flow", first)));
verify(carrier).sendRerouteRequest(any(String.class), eq(getFlowRerouteRequest("second flow", second)));
verify(carrier).sendRerouteRequest(any(String.class), eq(getFlowRerouteRequest("third flow", third)));
}
use of org.openkilda.wfm.topology.reroute.model.FlowThrottlingData in project open-kilda by telstra.
the class RerouteQueueServiceTest method shouldMergeRequestsInThrottling.
@Test
public void shouldMergeRequestsInThrottling() {
FlowThrottlingData first = FlowThrottlingData.builder().correlationId("another").priority(1).timeCreate(Instant.now().plus(1, MINUTES)).affectedIsl(Collections.singleton(new IslEndpoint(SWITCH_ID_A, 1))).force(false).effectivelyDown(false).reason("another reason").build();
rerouteQueueService.getReroutes().put(FLOW_ID, RerouteQueue.builder().throttling(first).build());
FlowThrottlingData actual = getFlowThrottlingData(flow, CORRELATION_ID).build();
rerouteQueueService.processAutomaticRequest(FLOW_ID, actual);
assertEquals(1, rerouteQueueService.getReroutes().size());
assertNotNull(rerouteQueueService.getReroutes().get(FLOW_ID));
RerouteQueue rerouteQueue = rerouteQueueService.getReroutes().get(FLOW_ID);
assertNull(rerouteQueue.getInProgress());
assertNull(rerouteQueue.getPending());
actual.setReason(first.getReason());
assertEquals(actual, rerouteQueue.getThrottling());
verify(carrier).sendExtendTimeWindowEvent();
}
use of org.openkilda.wfm.topology.reroute.model.FlowThrottlingData in project open-kilda by telstra.
the class RerouteQueueServiceTest method shouldMovePendingToInProcessWhenReceivedSuccessfulResult.
@Test
public void shouldMovePendingToInProcessWhenReceivedSuccessfulResult() {
String pendingCorrelationId = "pending";
FlowThrottlingData inProgress = getFlowThrottlingData(flow, CORRELATION_ID).build();
FlowThrottlingData pending = getFlowThrottlingData(flow, pendingCorrelationId).build();
RerouteQueue rerouteQueue = RerouteQueue.builder().inProgress(inProgress).pending(pending).build();
rerouteQueueService.getReroutes().put(FLOW_ID, rerouteQueue);
RerouteResultInfoData rerouteResultInfoData = RerouteResultInfoData.builder().flowId(FLOW_ID).success(true).build();
rerouteQueueService.processRerouteResult(rerouteResultInfoData, CORRELATION_ID);
assertNull(rerouteQueue.getPending());
assertNull(rerouteQueue.getThrottling());
FlowRerouteRequest expected = getFlowRerouteRequest(FLOW_ID, pending);
verify(carrier).sendRerouteRequest(eq(pendingCorrelationId), eq(expected));
}
use of org.openkilda.wfm.topology.reroute.model.FlowThrottlingData in project open-kilda by telstra.
the class RerouteQueueServiceTest method shouldSendManualRerouteRequestWithoutThrottlingForYFlow.
@Test
public void shouldSendManualRerouteRequestWithoutThrottlingForYFlow() {
FlowThrottlingData throttling = getFlowThrottlingData(yFlow, "another one").build();
RerouteQueue rerouteQueue = RerouteQueue.builder().throttling(throttling).build();
rerouteQueueService.getReroutes().put(YFLOW_ID, rerouteQueue);
FlowThrottlingData actual = getFlowThrottlingData(yFlow, CORRELATION_ID).build();
rerouteQueueService.processManualRequest(YFLOW_ID, actual);
assertEquals(1, rerouteQueueService.getReroutes().size());
assertEquals(actual, rerouteQueue.getInProgress());
assertNull(rerouteQueue.getPending());
assertEquals(throttling, rerouteQueue.getThrottling());
YFlowRerouteRequest expected = getYFlowRerouteRequest(YFLOW_ID, actual);
verify(carrier).sendRerouteRequest(eq(CORRELATION_ID), eq(expected));
}
use of org.openkilda.wfm.topology.reroute.model.FlowThrottlingData in project open-kilda by telstra.
the class RerouteQueueServiceTest method shouldMergeThrottledAndPendingRequestOnFlushWindowEvent.
@Test
public void shouldMergeThrottledAndPendingRequestOnFlushWindowEvent() {
FlowThrottlingData inProgress = FlowThrottlingData.builder().correlationId("in progress").priority(flow.getPriority()).timeCreate(flow.getTimeCreate()).affectedIsl(Collections.emptySet()).force(false).effectivelyDown(false).reason("first reason").build();
FlowThrottlingData pending = FlowThrottlingData.builder().correlationId("pending").priority(flow.getPriority()).timeCreate(flow.getTimeCreate()).affectedIsl(Collections.singleton(new IslEndpoint(SWITCH_ID_B, 1))).force(false).effectivelyDown(true).reason("second reason").build();
FlowThrottlingData throttling = FlowThrottlingData.builder().correlationId(CORRELATION_ID).priority(7).timeCreate(Instant.now().plus(1, MINUTES)).affectedIsl(Collections.singleton(new IslEndpoint(SWITCH_ID_A, 1))).force(true).effectivelyDown(false).reason("third reason").build();
RerouteQueue rerouteQueue = RerouteQueue.builder().inProgress(inProgress).pending(pending).throttling(throttling).build();
rerouteQueueService.getReroutes().put(FLOW_ID, rerouteQueue);
rerouteQueueService.flushThrottling();
assertNotNull(rerouteQueue.getInProgress());
FlowThrottlingData expected = FlowThrottlingData.builder().correlationId(rerouteQueue.getPending().getCorrelationId()).priority(throttling.getPriority()).timeCreate(throttling.getTimeCreate()).affectedIsl(Sets.newHashSet(new IslEndpoint(SWITCH_ID_A, 1), new IslEndpoint(SWITCH_ID_B, 1))).force(true).effectivelyDown(true).reason(pending.getReason()).build();
assertEquals(expected, rerouteQueue.getPending());
assertNull(rerouteQueue.getThrottling());
}
Aggregations