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);
}
}
}
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());
}
}
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;
}
Aggregations