Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | ce2a03d | 2017-08-03 19:21:03 -0700 | [diff] [blame^] | 2 | * Copyright 2016-present Open Networking Foundation |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package org.onosproject.incubator.net.routing; |
| 18 | |
| 19 | import org.onlab.packet.IpAddress; |
| 20 | import org.onosproject.event.ListenerService; |
| 21 | |
| 22 | import java.util.Collection; |
Jonathan Hart | bfc5c48 | 2016-04-05 18:57:00 -0700 | [diff] [blame] | 23 | import java.util.Map; |
Jonathan Hart | 96c146b | 2017-02-24 16:32:00 -0800 | [diff] [blame] | 24 | import java.util.Optional; |
Jonathan Hart | fd17661 | 2016-04-11 10:42:10 -0700 | [diff] [blame] | 25 | import java.util.Set; |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 26 | |
| 27 | /** |
Jonathan Hart | bfc5c48 | 2016-04-05 18:57:00 -0700 | [diff] [blame] | 28 | * Unicast IP route service. |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 29 | */ |
| 30 | public interface RouteService extends ListenerService<RouteEvent, RouteListener> { |
| 31 | |
| 32 | /** |
Jonathan Hart | bfc5c48 | 2016-04-05 18:57:00 -0700 | [diff] [blame] | 33 | * Returns all routes for all route tables in the system. |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 34 | * |
Jonathan Hart | bfc5c48 | 2016-04-05 18:57:00 -0700 | [diff] [blame] | 35 | * @return map of route table name to routes in that table |
Jonathan Hart | 96c146b | 2017-02-24 16:32:00 -0800 | [diff] [blame] | 36 | * @deprecated in Kingfisher release. Use {@link #getRoutes(RouteTableId)} |
| 37 | * instead. |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 38 | */ |
Jonathan Hart | 96c146b | 2017-02-24 16:32:00 -0800 | [diff] [blame] | 39 | @Deprecated |
Jonathan Hart | bfc5c48 | 2016-04-05 18:57:00 -0700 | [diff] [blame] | 40 | Map<RouteTableId, Collection<Route>> getAllRoutes(); |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 41 | |
| 42 | /** |
Jonathan Hart | 96c146b | 2017-02-24 16:32:00 -0800 | [diff] [blame] | 43 | * Returns information about all routes in the given route table. |
| 44 | * |
| 45 | * @param id route table ID |
| 46 | * @return collection of route information |
| 47 | */ |
| 48 | Collection<RouteInfo> getRoutes(RouteTableId id); |
| 49 | |
| 50 | /** |
| 51 | * Returns the set of route tables in the system. |
| 52 | * |
| 53 | * @return collection of route table IDs. |
| 54 | */ |
| 55 | Collection<RouteTableId> getRouteTables(); |
| 56 | |
| 57 | /** |
Jonathan Hart | bfc5c48 | 2016-04-05 18:57:00 -0700 | [diff] [blame] | 58 | * Performs a longest prefix match on the given IP address. The call will |
| 59 | * return the route with the most specific prefix that contains the given |
| 60 | * IP address. |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 61 | * |
Jonathan Hart | bfc5c48 | 2016-04-05 18:57:00 -0700 | [diff] [blame] | 62 | * @param ip IP address |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 63 | * @return longest prefix matched route |
Jonathan Hart | 96c146b | 2017-02-24 16:32:00 -0800 | [diff] [blame] | 64 | * @deprecated in Kingfisher release. Use {{@link #longestPrefixLookup(IpAddress)}} |
| 65 | * instead. |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 66 | */ |
Jonathan Hart | 96c146b | 2017-02-24 16:32:00 -0800 | [diff] [blame] | 67 | @Deprecated |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 68 | Route longestPrefixMatch(IpAddress ip); |
| 69 | |
Jonathan Hart | fd17661 | 2016-04-11 10:42:10 -0700 | [diff] [blame] | 70 | /** |
Jonathan Hart | 96c146b | 2017-02-24 16:32:00 -0800 | [diff] [blame] | 71 | * Performs a longest prefix lookup on the given IP address. |
| 72 | * |
| 73 | * @param ip IP address to look up |
| 74 | * @return most specific matching route, if one exists |
| 75 | */ |
| 76 | Optional<ResolvedRoute> longestPrefixLookup(IpAddress ip); |
| 77 | |
| 78 | /** |
Jonathan Hart | fd17661 | 2016-04-11 10:42:10 -0700 | [diff] [blame] | 79 | * Returns the routes for the given next hop. |
| 80 | * |
| 81 | * @param nextHop next hop IP address |
| 82 | * @return routes for this next hop |
| 83 | */ |
Jonathan Hart | 96c146b | 2017-02-24 16:32:00 -0800 | [diff] [blame] | 84 | @Deprecated |
Jonathan Hart | fd17661 | 2016-04-11 10:42:10 -0700 | [diff] [blame] | 85 | Collection<Route> getRoutesForNextHop(IpAddress nextHop); |
| 86 | |
| 87 | /** |
| 88 | * Returns all next hops in the route store. |
| 89 | * |
| 90 | * @return set of next hops |
| 91 | */ |
Jonathan Hart | 96c146b | 2017-02-24 16:32:00 -0800 | [diff] [blame] | 92 | @Deprecated |
Jonathan Hart | fd17661 | 2016-04-11 10:42:10 -0700 | [diff] [blame] | 93 | Set<NextHop> getNextHops(); |
| 94 | |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 95 | } |