Search in sources :

Example 1 with RerouteResultInfoData

use of org.openkilda.messaging.info.reroute.RerouteResultInfoData in project open-kilda by telstra.

the class YFlowRerouteHubBolt method sendYFlowRerouteResultStatus.

@Override
public void sendYFlowRerouteResultStatus(String flowId, RerouteError rerouteError, String correlationId) {
    RerouteResultInfoData rerouteResult = RerouteResultInfoData.builder().flowId(flowId).success(rerouteError == null).rerouteError(rerouteError).build();
    Message message = new InfoMessage(rerouteResult, System.currentTimeMillis(), correlationId);
    emitWithContext(Stream.HUB_TO_REROUTE_RESPONSE_SENDER.name(), getCurrentTuple(), new Values(currentKey, message));
}
Also used : InfoMessage(org.openkilda.messaging.info.InfoMessage) CommandMessage(org.openkilda.messaging.command.CommandMessage) Message(org.openkilda.messaging.Message) InfoMessage(org.openkilda.messaging.info.InfoMessage) Values(org.apache.storm.tuple.Values) RerouteResultInfoData(org.openkilda.messaging.info.reroute.RerouteResultInfoData)

Example 2 with RerouteResultInfoData

use of org.openkilda.messaging.info.reroute.RerouteResultInfoData in project open-kilda by telstra.

the class FlowRerouteServiceTest method shouldSuccessfullyRerouteFlow.

@Test
public void shouldSuccessfullyRerouteFlow() throws RecoverableException, UnroutableFlowException, UnknownKeyException {
    Flow origin = makeFlow();
    origin.setStatus(FlowStatus.DOWN);
    transactionManager.doInTransaction(() -> repositoryFactory.createFlowRepository().updateStatus(origin.getFlowId(), FlowStatus.DOWN));
    preparePathComputation(origin.getFlowId(), make3SwitchesPathPair());
    FlowRerouteService service = makeService();
    FlowRerouteRequest request = new FlowRerouteRequest(origin.getFlowId(), false, false, false, Collections.emptySet(), null, false);
    service.handleRequest(currentRequestKey, request, commandContext);
    verifyFlowStatus(origin.getFlowId(), FlowStatus.IN_PROGRESS);
    verifyNorthboundSuccessResponse(carrier);
    FlowSegmentRequest speakerRequest;
    while ((speakerRequest = requests.poll()) != null) {
        produceAsyncResponse(service, speakerRequest);
    }
    Flow result = verifyFlowStatus(origin.getFlowId(), FlowStatus.UP);
    verifyPathReplace(origin, result);
    RerouteResultInfoData expected = RerouteResultInfoData.builder().flowId(origin.getFlowId()).success(true).build();
    verify(carrier).sendRerouteResultStatus(eq(origin.getFlowId()), isNull(), any(String.class));
}
Also used : FlowSegmentRequest(org.openkilda.floodlight.api.request.FlowSegmentRequest) FlowRerouteRequest(org.openkilda.messaging.command.flow.FlowRerouteRequest) RerouteResultInfoData(org.openkilda.messaging.info.reroute.RerouteResultInfoData) Flow(org.openkilda.model.Flow) Test(org.junit.Test)

Example 3 with RerouteResultInfoData

use of org.openkilda.messaging.info.reroute.RerouteResultInfoData 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 4 with RerouteResultInfoData

use of org.openkilda.messaging.info.reroute.RerouteResultInfoData in project open-kilda by telstra.

the class RerouteQueueServiceTest method shouldNotInjectRetryWhenReceivedFailedRuleInstallResponseOnTerminatingSwitch.

@Test
public void shouldNotInjectRetryWhenReceivedFailedRuleInstallResponseOnTerminatingSwitch() {
    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 SpeakerRequestError("Failed to install rules", Collections.singleton(SWITCH_B.getSwitchId()))).build();
    rerouteQueueService.processRerouteResult(rerouteResultInfoData, 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) RerouteResultInfoData(org.openkilda.messaging.info.reroute.RerouteResultInfoData) SpeakerRequestError(org.openkilda.messaging.info.reroute.error.SpeakerRequestError) Test(org.junit.Test)

Example 5 with RerouteResultInfoData

use of org.openkilda.messaging.info.reroute.RerouteResultInfoData in project open-kilda by telstra.

the class RerouteQueueServiceTest method shouldMergeAndSendRetryWithPendingRequestWhenReceivedFailedRuleInstallResponseOnTransitSwitch.

@Test
public void shouldMergeAndSendRetryWithPendingRequestWhenReceivedFailedRuleInstallResponseOnTransitSwitch() {
    FlowThrottlingData inProgress = getFlowThrottlingData(flow, CORRELATION_ID).build();
    FlowThrottlingData pending = FlowThrottlingData.builder().correlationId("pending").priority(7).timeCreate(flow.getTimeCreate()).affectedIsl(Collections.singleton(new IslEndpoint(SWITCH_ID_A, 1))).force(false).effectivelyDown(true).reason("another reason").build();
    RerouteQueue rerouteQueue = RerouteQueue.builder().inProgress(inProgress).pending(pending).build();
    rerouteQueueService.getReroutes().put(FLOW_ID, rerouteQueue);
    RerouteResultInfoData rerouteResultInfoData = RerouteResultInfoData.builder().flowId(FLOW_ID).success(false).rerouteError(new SpeakerRequestError("Failed to install rules", Collections.singleton(SWITCH_C.getSwitchId()))).build();
    rerouteQueueService.processRerouteResult(rerouteResultInfoData, CORRELATION_ID);
    String retryCorrelationId = CORRELATION_ID + " : retry #1 ignore_bw false";
    FlowThrottlingData expected = getFlowThrottlingData(flow, retryCorrelationId).build();
    expected.setPriority(pending.getPriority());
    expected.setReason(pending.getReason());
    assertEquals(expected, rerouteQueue.getInProgress());
    assertNull(rerouteQueue.getPending());
    assertNull(rerouteQueue.getThrottling());
    FlowRerouteRequest expectedRequest = getFlowRerouteRequest(FLOW_ID, expected);
    verify(carrier).sendRerouteRequest(eq(retryCorrelationId), eq(expectedRequest));
}
Also used : IslEndpoint(org.openkilda.model.IslEndpoint) 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) RerouteResultInfoData(org.openkilda.messaging.info.reroute.RerouteResultInfoData) SpeakerRequestError(org.openkilda.messaging.info.reroute.error.SpeakerRequestError) Test(org.junit.Test)

Aggregations

RerouteResultInfoData (org.openkilda.messaging.info.reroute.RerouteResultInfoData)11 Test (org.junit.Test)6 FlowThrottlingData (org.openkilda.wfm.topology.reroute.model.FlowThrottlingData)5 RerouteQueue (org.openkilda.wfm.topology.reroute.model.RerouteQueue)5 FlowRerouteRequest (org.openkilda.messaging.command.flow.FlowRerouteRequest)4 YFlowRerouteRequest (org.openkilda.messaging.command.yflow.YFlowRerouteRequest)4 Values (org.apache.storm.tuple.Values)3 InfoMessage (org.openkilda.messaging.info.InfoMessage)3 SpeakerRequestError (org.openkilda.messaging.info.reroute.error.SpeakerRequestError)3 Message (org.openkilda.messaging.Message)2 CommandMessage (org.openkilda.messaging.command.CommandMessage)2 PathSwapResult (org.openkilda.messaging.info.reroute.PathSwapResult)2 IslEndpoint (org.openkilda.model.IslEndpoint)2 FlowSegmentRequest (org.openkilda.floodlight.api.request.FlowSegmentRequest)1 MessageData (org.openkilda.messaging.MessageData)1 FlowPathSwapRequest (org.openkilda.messaging.command.flow.FlowPathSwapRequest)1 InfoData (org.openkilda.messaging.info.InfoData)1 SwitchStateChanged (org.openkilda.messaging.info.reroute.SwitchStateChanged)1 RerouteInProgressError (org.openkilda.messaging.info.reroute.error.RerouteInProgressError)1 Flow (org.openkilda.model.Flow)1