use of org.openkilda.wfm.error.IslNotFoundException in project open-kilda by telstra.
the class CacheService method handleGetDataFromCache.
/**
* Get data about specified ISL from cache.
*
* @param roundTripLatency round trip latency info data with source endpoint
*/
public void handleGetDataFromCache(IslRoundTripLatency roundTripLatency) {
Endpoint source = Endpoint.of(roundTripLatency.getSrcSwitchId(), roundTripLatency.getSrcPortNo());
Endpoint destination = cache.get(source);
try {
if (destination == null) {
destination = updateCache(source);
}
carrier.emitCachedData(roundTripLatency, destination);
} catch (IslNotFoundException e) {
log.debug(String.format("Could not update ISL cache: %s", e.getMessage()), e);
} catch (IllegalIslStateException e) {
log.error(String.format("Could not update ISL cache: %s", e.getMessage()), e);
}
}
use of org.openkilda.wfm.error.IslNotFoundException in project open-kilda by telstra.
the class LinkOperationsBolt method bfdPropertiesRead.
private BfdPropertiesResponse bfdPropertiesRead(BfdPropertiesReadRequest request) {
Endpoint source = new Endpoint(request.getSource());
Endpoint destination = new Endpoint(request.getDestination());
try {
return linkOperationsService.readBfdProperties(source, destination);
} catch (IslNotFoundException e) {
throw new MessageException(ErrorType.NOT_FOUND, e.getMessage(), "ISL was not found.");
}
}
use of org.openkilda.wfm.error.IslNotFoundException in project open-kilda by telstra.
the class LinkOperationsBolt method updateLinkUnderMaintenanceFlag.
private List<IslInfoData> updateLinkUnderMaintenanceFlag(UpdateLinkUnderMaintenanceRequest request) {
SwitchId srcSwitch = request.getSource().getDatapath();
Integer srcPort = request.getSource().getPortNumber();
SwitchId dstSwitch = request.getDestination().getDatapath();
Integer dstPort = request.getDestination().getPortNumber();
boolean underMaintenance = request.isUnderMaintenance();
boolean evacuate = request.isEvacuate();
List<Isl> isl;
try {
isl = linkOperationsService.updateLinkUnderMaintenanceFlag(srcSwitch, srcPort, dstSwitch, dstPort, underMaintenance);
if (underMaintenance && evacuate) {
Set<IslEndpoint> affectedIslEndpoints = new HashSet<>();
affectedIslEndpoints.add(new IslEndpoint(srcSwitch, srcPort));
affectedIslEndpoints.add(new IslEndpoint(dstSwitch, dstPort));
String reason = format("evacuated due to link maintenance %s_%d - %s_%d", srcSwitch, srcPort, dstSwitch, dstPort);
Collection<FlowPath> targetPaths = flowOperationsService.getFlowPathsForLink(srcSwitch, srcPort, dstSwitch, dstPort);
for (FlowRerouteRequest reroute : flowOperationsService.makeRerouteRequests(targetPaths, affectedIslEndpoints, reason)) {
CommandContext forkedContext = getCommandContext().fork(reroute.getFlowId());
getOutput().emit(StreamType.REROUTE.toString(), getCurrentTuple(), new Values(reroute, forkedContext.getCorrelationId()));
}
}
} catch (IslNotFoundException e) {
throw new MessageException(ErrorType.NOT_FOUND, e.getMessage(), "ISL was not found.");
}
return isl.stream().map(IslMapper.INSTANCE::map).collect(Collectors.toList());
}
use of org.openkilda.wfm.error.IslNotFoundException in project open-kilda by telstra.
the class FlowOperationsBolt method processGetFlowsForLinkRequest.
@TimedExecution("get_flows_for_link")
private List<FlowResponse> processGetFlowsForLinkRequest(GetFlowsForIslRequest request) {
SwitchId srcSwitch = request.getSource().getDatapath();
Integer srcPort = request.getSource().getPortNumber();
SwitchId dstSwitch = request.getDestination().getDatapath();
Integer dstPort = request.getDestination().getPortNumber();
try {
return flowOperationsService.getFlowPathsForLink(srcSwitch, srcPort, dstSwitch, dstPort).stream().filter(flowPath -> flowPath.getFlow().isActualPathId(flowPath.getPathId())).map(FlowPath::getFlow).distinct().map(flowOperationsService::buildFlowResponse).collect(Collectors.toList());
} catch (IslNotFoundException e) {
throw new MessageException(ErrorType.NOT_FOUND, e.getMessage(), "ISL was not found.");
}
}
use of org.openkilda.wfm.error.IslNotFoundException in project open-kilda by telstra.
the class FlowOperationsBolt method processRerouteFlowsForLinkRequest.
@TimedExecution("reroute_flows_for_link")
private List<FlowsResponse> processRerouteFlowsForLinkRequest(RerouteFlowsForIslRequest message) {
SwitchId srcSwitch = message.getSource().getDatapath();
Integer srcPort = message.getSource().getPortNumber();
SwitchId dstSwitch = message.getDestination().getDatapath();
Integer dstPort = message.getDestination().getPortNumber();
Collection<FlowPath> paths;
try {
paths = flowOperationsService.getFlowPathsForLink(srcSwitch, srcPort, dstSwitch, dstPort);
} catch (IslNotFoundException e) {
throw new MessageException(ErrorType.NOT_FOUND, e.getMessage(), "ISL was not found.");
}
Set<IslEndpoint> affectedIslEndpoints = new HashSet<>();
affectedIslEndpoints.add(new IslEndpoint(srcSwitch, srcPort));
affectedIslEndpoints.add(new IslEndpoint(dstSwitch, dstPort));
sendRerouteRequest(paths, affectedIslEndpoints, format("initiated via Northbound, reroute all flows that go over the link %s_%d - %s_%d", srcSwitch, srcPort, dstSwitch, dstPort));
List<String> flowIds = paths.stream().map(FlowPath::getFlow).map(Flow::getFlowId).distinct().collect(Collectors.toList());
return Collections.singletonList(new FlowsResponse(flowIds));
}
Aggregations