Search in sources :

Example 1 with NoPathFoundError

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

the class RerouteQueueService method processRerouteResult.

/**
 * Process reroute result. Check fail reason, decide if retry is needed and schedule it if yes.
 *
 * @param rerouteResultInfoData reroute result
 * @param correlationId correlation id
 */
public void processRerouteResult(RerouteResultInfoData rerouteResultInfoData, String correlationId) {
    String flowId = rerouteResultInfoData.getFlowId();
    RerouteQueue rerouteQueue = getRerouteQueue(flowId);
    FlowThrottlingData inProgress = rerouteQueue.getInProgress();
    if (inProgress == null || !Objects.equals(inProgress.getCorrelationId(), correlationId)) {
        log.error("Skipped unexpected reroute result for flow {} with correlation id {}.", flowId, correlationId);
        return;
    }
    carrier.cancelTimeout(correlationId);
    if (rerouteResultInfoData.isSuccess()) {
        FlowThrottlingData toSend = rerouteQueue.processPending();
        sendRerouteRequest(flowId, toSend);
    } else {
        RerouteError rerouteError = rerouteResultInfoData.getRerouteError();
        if (isRetryRequired(flowId, rerouteError, rerouteResultInfoData.isYFlow())) {
            injectRetry(flowId, rerouteQueue, rerouteError instanceof NoPathFoundError);
        } else {
            FlowThrottlingData toSend = rerouteQueue.processPending();
            sendRerouteRequest(flowId, toSend);
        }
    }
}
Also used : NoPathFoundError(org.openkilda.messaging.info.reroute.error.NoPathFoundError) FlowThrottlingData(org.openkilda.wfm.topology.reroute.model.FlowThrottlingData) RerouteQueue(org.openkilda.wfm.topology.reroute.model.RerouteQueue) RerouteError(org.openkilda.messaging.info.reroute.error.RerouteError)

Example 2 with NoPathFoundError

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

the class AllocatePrimaryResourcesAction method onFailure.

@Override
protected void onFailure(FlowRerouteFsm stateMachine) {
    stateMachine.setNewPrimaryResources(null);
    stateMachine.setNewPrimaryForwardPath(null);
    stateMachine.setNewPrimaryReversePath(null);
    if (!stateMachine.isIgnoreBandwidth()) {
        stateMachine.setRerouteError(new NoPathFoundError());
    }
}
Also used : NoPathFoundError(org.openkilda.messaging.info.reroute.error.NoPathFoundError)

Example 3 with NoPathFoundError

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

the class RerouteQueueService method isRetryRequired.

private boolean isRetryRequired(String flowId, RerouteError rerouteError, boolean isYFlow) {
    if (rerouteError instanceof NoPathFoundError) {
        log.info("Received no path found error for flow {}", flowId);
        return true;
    } else if (rerouteError instanceof RerouteInProgressError) {
        log.info("Received reroute in progress error for flow {}", flowId);
        return true;
    } else if (rerouteError instanceof SpeakerRequestError) {
        if (isYFlow) {
            log.info("Received speaker request error for y-flow {}", flowId);
            YFlow yFlow = yFlowRepository.findById(flowId).orElse(null);
            if (yFlow == null) {
                log.error("Y-flow {} not found", flowId);
                return false;
            }
            Set<SwitchId> yFlowSwitchIds = yFlow.getSubFlows().stream().map(YSubFlow::getEndpointSwitchId).collect(Collectors.toSet());
            yFlowSwitchIds.add(yFlow.getSharedEndpoint().getSwitchId());
            boolean isRetryRequired = true;
            SpeakerRequestError ruleFailedError = (SpeakerRequestError) rerouteError;
            for (SwitchId switchId : yFlowSwitchIds) {
                isRetryRequired &= !ruleFailedError.getSwitches().contains(switchId);
            }
            return isRetryRequired;
        } else {
            log.info("Received speaker request error for flow {}", flowId);
            Flow flow = flowRepository.findById(flowId).orElse(null);
            if (flow == null) {
                log.error("Flow {} not found", flowId);
                return false;
            }
            SpeakerRequestError ruleFailedError = (SpeakerRequestError) rerouteError;
            return !ruleFailedError.getSwitches().contains(flow.getSrcSwitchId()) && !ruleFailedError.getSwitches().contains(flow.getDestSwitchId());
        }
    }
    return false;
}
Also used : YFlow(org.openkilda.model.YFlow) NoPathFoundError(org.openkilda.messaging.info.reroute.error.NoPathFoundError) SwitchId(org.openkilda.model.SwitchId) SpeakerRequestError(org.openkilda.messaging.info.reroute.error.SpeakerRequestError) RerouteInProgressError(org.openkilda.messaging.info.reroute.error.RerouteInProgressError) Flow(org.openkilda.model.Flow) YFlow(org.openkilda.model.YFlow) YSubFlow(org.openkilda.model.YSubFlow)

Aggregations

NoPathFoundError (org.openkilda.messaging.info.reroute.error.NoPathFoundError)3 RerouteError (org.openkilda.messaging.info.reroute.error.RerouteError)1 RerouteInProgressError (org.openkilda.messaging.info.reroute.error.RerouteInProgressError)1 SpeakerRequestError (org.openkilda.messaging.info.reroute.error.SpeakerRequestError)1 Flow (org.openkilda.model.Flow)1 SwitchId (org.openkilda.model.SwitchId)1 YFlow (org.openkilda.model.YFlow)1 YSubFlow (org.openkilda.model.YSubFlow)1 FlowThrottlingData (org.openkilda.wfm.topology.reroute.model.FlowThrottlingData)1 RerouteQueue (org.openkilda.wfm.topology.reroute.model.RerouteQueue)1