use of org.openkilda.pce.model.FindPathResult in project open-kilda by telstra.
the class InMemoryPathComputer method getPath.
private GetPathsResult getPath(AvailableNetwork network, Flow flow, PathComputationStrategy strategy) throws UnroutableFlowException {
if (flow.isOneSwitchFlow()) {
log.info("No path computation for one-switch flow");
SwitchId singleSwitchId = flow.getSrcSwitchId();
return GetPathsResult.builder().forward(convertToPath(singleSwitchId, singleSwitchId, emptyList())).reverse(convertToPath(singleSwitchId, singleSwitchId, emptyList())).backUpPathComputationWayUsed(false).build();
}
WeightFunction weightFunction = getWeightFunctionByStrategy(strategy);
FindPathResult findPathResult;
try {
findPathResult = findPathInNetwork(flow, network, weightFunction, strategy);
} catch (UnroutableFlowException e) {
String message = format("Failed to find path with requested bandwidth=%s: %s", flow.isIgnoreBandwidth() ? " ignored" : flow.getBandwidth(), e.getMessage());
throw new UnroutableFlowException(message, e, flow.getFlowId(), flow.isIgnoreBandwidth());
}
return convertToGetPathsResult(flow.getSrcSwitchId(), flow.getDestSwitchId(), findPathResult, strategy, flow.getPathComputationStrategy());
}
Aggregations