Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
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 | fd17661 | 2016-04-11 10:42:10 -0700 | [diff] [blame^] | 24 | import java.util.Set; |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 25 | |
| 26 | /** |
Jonathan Hart | bfc5c48 | 2016-04-05 18:57:00 -0700 | [diff] [blame] | 27 | * Unicast IP route service. |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 28 | */ |
| 29 | public interface RouteService extends ListenerService<RouteEvent, RouteListener> { |
| 30 | |
| 31 | /** |
Jonathan Hart | bfc5c48 | 2016-04-05 18:57:00 -0700 | [diff] [blame] | 32 | * Returns all routes for all route tables in the system. |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 33 | * |
Jonathan Hart | bfc5c48 | 2016-04-05 18:57:00 -0700 | [diff] [blame] | 34 | * @return map of route table name to routes in that table |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 35 | */ |
Jonathan Hart | bfc5c48 | 2016-04-05 18:57:00 -0700 | [diff] [blame] | 36 | Map<RouteTableId, Collection<Route>> getAllRoutes(); |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 37 | |
| 38 | /** |
Jonathan Hart | bfc5c48 | 2016-04-05 18:57:00 -0700 | [diff] [blame] | 39 | * Performs a longest prefix match on the given IP address. The call will |
| 40 | * return the route with the most specific prefix that contains the given |
| 41 | * IP address. |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 42 | * |
Jonathan Hart | bfc5c48 | 2016-04-05 18:57:00 -0700 | [diff] [blame] | 43 | * @param ip IP address |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 44 | * @return longest prefix matched route |
| 45 | */ |
| 46 | Route longestPrefixMatch(IpAddress ip); |
| 47 | |
Jonathan Hart | fd17661 | 2016-04-11 10:42:10 -0700 | [diff] [blame^] | 48 | /** |
| 49 | * Returns the routes for the given next hop. |
| 50 | * |
| 51 | * @param nextHop next hop IP address |
| 52 | * @return routes for this next hop |
| 53 | */ |
| 54 | Collection<Route> getRoutesForNextHop(IpAddress nextHop); |
| 55 | |
| 56 | /** |
| 57 | * Returns all next hops in the route store. |
| 58 | * |
| 59 | * @return set of next hops |
| 60 | */ |
| 61 | Set<NextHop> getNextHops(); |
| 62 | |
Jonathan Hart | 7d7e2f5 | 2016-03-29 16:22:49 -0700 | [diff] [blame] | 63 | } |