Search in sources :

Example 6 with RerouteResultInfoData

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

the class FlowRerouteQueueBolt method handleOperationQueueBoltMessage.

private void handleOperationQueueBoltMessage(Tuple tuple) throws PipelineException {
    RerouteResultInfoData rerouteResultInfoData = pullValue(tuple, FIELD_ID_PAYLOAD, RerouteResultInfoData.class);
    rerouteQueueService.processRerouteResult(rerouteResultInfoData, getCommandContext().getCorrelationId());
}
Also used : RerouteResultInfoData(org.openkilda.messaging.info.reroute.RerouteResultInfoData)

Example 7 with RerouteResultInfoData

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

the class OperationQueueBolt method handleInput.

@Override
protected void handleInput(Tuple tuple) throws PipelineException {
    CommandContext context = pullContext(tuple);
    MessageData data = pullValue(tuple, FIELD_ID_PAYLOAD, MessageData.class);
    if (data instanceof FlowPathSwapRequest) {
        FlowPathSwapRequest flowPathSwapRequest = (FlowPathSwapRequest) data;
        service.addFirst(flowPathSwapRequest.getFlowId(), context.getCorrelationId(), flowPathSwapRequest);
    } else if (data instanceof FlowRerouteRequest) {
        FlowRerouteRequest flowRerouteRequest = (FlowRerouteRequest) data;
        service.addLast(flowRerouteRequest.getFlowId(), context.getCorrelationId(), flowRerouteRequest);
    } else if (data instanceof YFlowRerouteRequest) {
        YFlowRerouteRequest yFlowRerouteRequest = (YFlowRerouteRequest) data;
        service.addLast(yFlowRerouteRequest.getYFlowId(), context.getCorrelationId(), yFlowRerouteRequest);
    } else if (data instanceof RerouteResultInfoData) {
        RerouteResultInfoData rerouteResultInfoData = (RerouteResultInfoData) data;
        service.operationCompleted(rerouteResultInfoData.getFlowId(), rerouteResultInfoData);
        emitRerouteResponse(rerouteResultInfoData);
    } else if (data instanceof PathSwapResult) {
        PathSwapResult pathSwapResult = (PathSwapResult) data;
        service.operationCompleted(pathSwapResult.getFlowId(), pathSwapResult);
    } else {
        unhandledInput(tuple);
    }
}
Also used : CommandContext(org.openkilda.wfm.CommandContext) MessageData(org.openkilda.messaging.MessageData) FlowPathSwapRequest(org.openkilda.messaging.command.flow.FlowPathSwapRequest) YFlowRerouteRequest(org.openkilda.messaging.command.yflow.YFlowRerouteRequest) FlowRerouteRequest(org.openkilda.messaging.command.flow.FlowRerouteRequest) YFlowRerouteRequest(org.openkilda.messaging.command.yflow.YFlowRerouteRequest) RerouteResultInfoData(org.openkilda.messaging.info.reroute.RerouteResultInfoData) PathSwapResult(org.openkilda.messaging.info.reroute.PathSwapResult)

Example 8 with RerouteResultInfoData

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

the class RerouteQueueServiceTest method shouldMergeAndSendRetryWithPendingRequestWhenReceivedFailedRuleInstallResponseOnTransitSwitchYFlow.

@Test
public void shouldMergeAndSendRetryWithPendingRequestWhenReceivedFailedRuleInstallResponseOnTransitSwitchYFlow() {
    FlowThrottlingData inProgress = getFlowThrottlingData(yFlow, CORRELATION_ID).build();
    FlowThrottlingData pending = FlowThrottlingData.builder().correlationId("pending").priority(7).timeCreate(yFlow.getTimeCreate()).affectedIsl(Collections.singleton(new IslEndpoint(SWITCH_ID_A, 1))).force(false).effectivelyDown(true).reason("another reason").yFlow(true).build();
    RerouteQueue rerouteQueue = RerouteQueue.builder().inProgress(inProgress).pending(pending).build();
    rerouteQueueService.getReroutes().put(YFLOW_ID, rerouteQueue);
    RerouteResultInfoData rerouteResultInfoData = RerouteResultInfoData.builder().flowId(YFLOW_ID).success(false).rerouteError(new SpeakerRequestError("Failed to install rules", Collections.singleton(SWITCH_C.getSwitchId()))).yFlow(true).build();
    rerouteQueueService.processRerouteResult(rerouteResultInfoData, CORRELATION_ID);
    String retryCorrelationId = CORRELATION_ID + " : retry #1 ignore_bw false";
    FlowThrottlingData expected = getFlowThrottlingData(yFlow, retryCorrelationId).build();
    expected.setPriority(pending.getPriority());
    expected.setReason(pending.getReason());
    assertEquals(expected, rerouteQueue.getInProgress());
    assertNull(rerouteQueue.getPending());
    assertNull(rerouteQueue.getThrottling());
    YFlowRerouteRequest expectedRequest = getYFlowRerouteRequest(YFLOW_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) 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)

Example 9 with RerouteResultInfoData

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

the class RerouteBolt method handleInfoMessage.

private void handleInfoMessage(Message message) {
    if (message instanceof InfoMessage) {
        InfoData infoData = ((InfoMessage) message).getData();
        if (infoData instanceof RerouteResultInfoData) {
            RerouteResultInfoData rerouteResultInfoData = (RerouteResultInfoData) infoData;
            emitWithContext(STREAM_OPERATION_QUEUE_ID, getCurrentTuple(), new Values(rerouteResultInfoData.getFlowId(), rerouteResultInfoData));
        } else if (infoData instanceof PathSwapResult) {
            PathSwapResult pathSwapResult = (PathSwapResult) infoData;
            emitWithContext(STREAM_OPERATION_QUEUE_ID, getCurrentTuple(), new Values(pathSwapResult.getFlowId(), pathSwapResult));
        } else if (infoData instanceof SwitchStateChanged) {
            if (active) {
                rerouteService.processSingleSwitchFlowStatusUpdate((SwitchStateChanged) infoData);
            }
        } else {
            unhandledInput(getCurrentTuple());
        }
    } else {
        unhandledInput(getCurrentTuple());
    }
}
Also used : InfoMessage(org.openkilda.messaging.info.InfoMessage) RerouteResultInfoData(org.openkilda.messaging.info.reroute.RerouteResultInfoData) InfoData(org.openkilda.messaging.info.InfoData) Values(org.apache.storm.tuple.Values) RerouteResultInfoData(org.openkilda.messaging.info.reroute.RerouteResultInfoData) SwitchStateChanged(org.openkilda.messaging.info.reroute.SwitchStateChanged) PathSwapResult(org.openkilda.messaging.info.reroute.PathSwapResult)

Example 10 with RerouteResultInfoData

use of org.openkilda.messaging.info.reroute.RerouteResultInfoData 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));
}
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) RerouteResultInfoData(org.openkilda.messaging.info.reroute.RerouteResultInfoData) 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