Search in sources :

Example 6 with RerouteQueue

use of org.openkilda.wfm.topology.reroute.model.RerouteQueue 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();
}
Also used : FlowThrottlingData(org.openkilda.wfm.topology.reroute.model.FlowThrottlingData) RerouteQueue(org.openkilda.wfm.topology.reroute.model.RerouteQueue) RerouteResultInfoData(org.openkilda.messaging.info.reroute.RerouteResultInfoData) RerouteInProgressError(org.openkilda.messaging.info.reroute.error.RerouteInProgressError) Test(org.junit.Test)

Example 7 with RerouteQueue

use of org.openkilda.wfm.topology.reroute.model.RerouteQueue 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();
}
Also used : FlowThrottlingData(org.openkilda.wfm.topology.reroute.model.FlowThrottlingData) RerouteQueue(org.openkilda.wfm.topology.reroute.model.RerouteQueue) Test(org.junit.Test)

Example 8 with RerouteQueue

use of org.openkilda.wfm.topology.reroute.model.RerouteQueue in project open-kilda by telstra.

the class RerouteQueueServiceTest method shouldSendThrottledRequestOnFlushWindowEvent.

@Test
public void shouldSendThrottledRequestOnFlushWindowEvent() {
    FlowThrottlingData throttling = getFlowThrottlingData(flow, CORRELATION_ID).build();
    RerouteQueue rerouteQueue = RerouteQueue.builder().throttling(throttling).build();
    rerouteQueueService.getReroutes().put(FLOW_ID, rerouteQueue);
    rerouteQueueService.flushThrottling();
    assertEquals(throttling, rerouteQueue.getInProgress());
    assertNull(rerouteQueue.getPending());
    assertNull(rerouteQueue.getThrottling());
    FlowRerouteRequest expectedRequest = getFlowRerouteRequest(FLOW_ID, throttling);
    verify(carrier).sendRerouteRequest(any(String.class), eq(expectedRequest));
}
Also used : FlowThrottlingData(org.openkilda.wfm.topology.reroute.model.FlowThrottlingData) RerouteQueue(org.openkilda.wfm.topology.reroute.model.RerouteQueue) FlowRerouteRequest(org.openkilda.messaging.command.flow.FlowRerouteRequest) YFlowRerouteRequest(org.openkilda.messaging.command.yflow.YFlowRerouteRequest) Test(org.junit.Test)

Example 9 with RerouteQueue

use of org.openkilda.wfm.topology.reroute.model.RerouteQueue in project open-kilda by telstra.

the class RerouteQueueServiceTest method shouldNotInjectRetryWhenRetryCountIsExceeded.

@Test
public void shouldNotInjectRetryWhenRetryCountIsExceeded() {
    FlowThrottlingData inProgress = getFlowThrottlingData(flow, CORRELATION_ID).build();
    inProgress.setRetryCounter(4);
    RerouteQueue rerouteQueue = RerouteQueue.builder().inProgress(inProgress).build();
    rerouteQueueService.getReroutes().put(FLOW_ID, rerouteQueue);
    rerouteQueueService.handleTimeout(CORRELATION_ID);
    assertNull(rerouteQueue.getInProgress());
    assertNull(rerouteQueue.getPending());
    assertNull(rerouteQueue.getThrottling());
}
Also used : FlowThrottlingData(org.openkilda.wfm.topology.reroute.model.FlowThrottlingData) RerouteQueue(org.openkilda.wfm.topology.reroute.model.RerouteQueue) Test(org.junit.Test)

Example 10 with RerouteQueue

use of org.openkilda.wfm.topology.reroute.model.RerouteQueue in project open-kilda by telstra.

the class RerouteQueueServiceTest method shouldSendCorrectErrorMessageForManualRerouteRequestWhenAnotherRerouteIsInProgress.

@Test
public void shouldSendCorrectErrorMessageForManualRerouteRequestWhenAnotherRerouteIsInProgress() {
    FlowThrottlingData inProgress = getFlowThrottlingData(flow, "another one").build();
    RerouteQueue rerouteQueue = RerouteQueue.builder().inProgress(inProgress).build();
    rerouteQueueService.getReroutes().put(FLOW_ID, rerouteQueue);
    FlowThrottlingData actual = getFlowThrottlingData(flow, CORRELATION_ID).build();
    rerouteQueueService.processManualRequest(FLOW_ID, actual);
    verify(carrier).emitFlowRerouteError(argThat(rerouteIsInProgressErrorData(FLOW_ID)));
}
Also used : FlowThrottlingData(org.openkilda.wfm.topology.reroute.model.FlowThrottlingData) RerouteQueue(org.openkilda.wfm.topology.reroute.model.RerouteQueue) Test(org.junit.Test)

Aggregations

RerouteQueue (org.openkilda.wfm.topology.reroute.model.RerouteQueue)19 FlowThrottlingData (org.openkilda.wfm.topology.reroute.model.FlowThrottlingData)17 Test (org.junit.Test)15 YFlowRerouteRequest (org.openkilda.messaging.command.yflow.YFlowRerouteRequest)7 RerouteResultInfoData (org.openkilda.messaging.info.reroute.RerouteResultInfoData)6 FlowRerouteRequest (org.openkilda.messaging.command.flow.FlowRerouteRequest)5 SpeakerRequestError (org.openkilda.messaging.info.reroute.error.SpeakerRequestError)4 IslEndpoint (org.openkilda.model.IslEndpoint)4 Flow (org.openkilda.model.Flow)3 YFlow (org.openkilda.model.YFlow)3 YSubFlow (org.openkilda.model.YSubFlow)3 ErrorData (org.openkilda.messaging.error.ErrorData)2 NoPathFoundError (org.openkilda.messaging.info.reroute.error.NoPathFoundError)2 RerouteError (org.openkilda.messaging.info.reroute.error.RerouteError)2 RerouteInProgressError (org.openkilda.messaging.info.reroute.error.RerouteInProgressError)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 String.format (java.lang.String.format)1 Instant (java.time.Instant)1 Comparator (java.util.Comparator)1 HashMap (java.util.HashMap)1