Search in sources :

Example 1 with PathSwapResult

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

the class FlowPathSwapHubBolt method sendPathSwapResultStatus.

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

Example 2 with PathSwapResult

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

use of org.openkilda.messaging.info.reroute.PathSwapResult 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)

Aggregations

PathSwapResult (org.openkilda.messaging.info.reroute.PathSwapResult)3 Values (org.apache.storm.tuple.Values)2 InfoMessage (org.openkilda.messaging.info.InfoMessage)2 RerouteResultInfoData (org.openkilda.messaging.info.reroute.RerouteResultInfoData)2 Message (org.openkilda.messaging.Message)1 MessageData (org.openkilda.messaging.MessageData)1 CommandMessage (org.openkilda.messaging.command.CommandMessage)1 FlowPathSwapRequest (org.openkilda.messaging.command.flow.FlowPathSwapRequest)1 FlowRerouteRequest (org.openkilda.messaging.command.flow.FlowRerouteRequest)1 YFlowRerouteRequest (org.openkilda.messaging.command.yflow.YFlowRerouteRequest)1 InfoData (org.openkilda.messaging.info.InfoData)1 SwitchStateChanged (org.openkilda.messaging.info.reroute.SwitchStateChanged)1 CommandContext (org.openkilda.wfm.CommandContext)1