use of org.openkilda.wfm.topology.reroute.model.FlowThrottlingData in project open-kilda by telstra.
the class RerouteService method processRerouteRequest.
/**
* Process manual reroute request.
*/
public void processRerouteRequest(MessageSender sender, String correlationId, FlowRerouteRequest request) {
Optional<Flow> flow = flowRepository.findById(request.getFlowId());
FlowThrottlingData flowThrottlingData = getFlowThrottlingDataBuilder(flow.orElse(null)).correlationId(correlationId).affectedIsl(request.getAffectedIsl()).force(request.isForce()).effectivelyDown(request.isEffectivelyDown()).reason(request.getReason()).build();
if (request.isManual()) {
sender.emitManualRerouteCommand(request.getFlowId(), flowThrottlingData);
} else {
sender.emitRerouteCommand(request.getFlowId(), flowThrottlingData);
}
}
use of org.openkilda.wfm.topology.reroute.model.FlowThrottlingData in project open-kilda by telstra.
the class RerouteQueueServiceTest method shouldSendManualRerouteRequestWithoutThrottling.
@Test
public void shouldSendManualRerouteRequestWithoutThrottling() {
FlowThrottlingData throttling = getFlowThrottlingData(flow, "another one").build();
RerouteQueue rerouteQueue = RerouteQueue.builder().throttling(throttling).build();
rerouteQueueService.getReroutes().put(FLOW_ID, rerouteQueue);
FlowThrottlingData actual = getFlowThrottlingData(flow, CORRELATION_ID).build();
rerouteQueueService.processManualRequest(FLOW_ID, actual);
assertEquals(1, rerouteQueueService.getReroutes().size());
assertEquals(actual, rerouteQueue.getInProgress());
assertNull(rerouteQueue.getPending());
assertEquals(throttling, rerouteQueue.getThrottling());
FlowRerouteRequest expected = getFlowRerouteRequest(FLOW_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 shouldSendExtendTimeWindowEventForRerouteRequestInThrottling.
@Test
public void shouldSendExtendTimeWindowEventForRerouteRequestInThrottling() {
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());
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 shouldInjectRetryToThrottlingWhenReceivedFailedRerouteResult.
@Test
public void shouldInjectRetryToThrottlingWhenReceivedFailedRerouteResult() {
FlowThrottlingData inProgress = getFlowThrottlingData(flow, CORRELATION_ID).build();
RerouteQueue rerouteQueue = RerouteQueue.builder().inProgress(inProgress).build();
rerouteQueueService.getReroutes().put(FLOW_ID, rerouteQueue);
RerouteResultInfoData rerouteResultInfoData = RerouteResultInfoData.builder().flowId(FLOW_ID).success(false).rerouteError(new RerouteInProgressError()).build();
rerouteQueueService.processRerouteResult(rerouteResultInfoData, CORRELATION_ID);
assertNull(rerouteQueue.getInProgress());
assertNull(rerouteQueue.getPending());
FlowThrottlingData expected = getFlowThrottlingData(flow, CORRELATION_ID + " : retry #1 ignore_bw false").build();
expected.setRetryCounter(1);
assertEquals(expected, rerouteQueue.getThrottling());
verify(carrier).sendExtendTimeWindowEvent();
}
use of org.openkilda.wfm.topology.reroute.model.FlowThrottlingData in project open-kilda by telstra.
the class RerouteQueueServiceTest method shouldInjectRetryToThrottlingWhenReceivedTimeout.
@Test
public void shouldInjectRetryToThrottlingWhenReceivedTimeout() {
FlowThrottlingData inProgress = getFlowThrottlingData(flow, CORRELATION_ID).build();
RerouteQueue rerouteQueue = RerouteQueue.builder().inProgress(inProgress).build();
rerouteQueueService.getReroutes().put(FLOW_ID, rerouteQueue);
rerouteQueueService.handleTimeout(CORRELATION_ID);
assertNull(rerouteQueue.getInProgress());
assertNull(rerouteQueue.getPending());
FlowThrottlingData expected = getFlowThrottlingData(flow, CORRELATION_ID + " : retry #1 ignore_bw false").build();
expected.setRetryCounter(1);
assertEquals(expected, rerouteQueue.getThrottling());
verify(carrier).sendExtendTimeWindowEvent();
}
Aggregations