blob: 2a9720a4efbf204b3d02519b3c2c8ef58911be5c [file] [log] [blame]
Jonathan Hart7d7e2f52016-03-29 16:22:49 -07001/*
Brian O'Connorce2a03d2017-08-03 19:21:03 -07002 * Copyright 2016-present Open Networking Foundation
Jonathan Hart7d7e2f52016-03-29 16:22:49 -07003 *
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
17package org.onosproject.incubator.net.routing;
18
19import org.onlab.packet.IpAddress;
20import org.onosproject.event.ListenerService;
21
22import java.util.Collection;
Jonathan Hartbfc5c482016-04-05 18:57:00 -070023import java.util.Map;
Jonathan Hart96c146b2017-02-24 16:32:00 -080024import java.util.Optional;
Jonathan Hartfd176612016-04-11 10:42:10 -070025import java.util.Set;
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070026
27/**
Jonathan Hartbfc5c482016-04-05 18:57:00 -070028 * Unicast IP route service.
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070029 */
30public interface RouteService extends ListenerService<RouteEvent, RouteListener> {
31
32 /**
Jonathan Hartbfc5c482016-04-05 18:57:00 -070033 * Returns all routes for all route tables in the system.
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070034 *
Jonathan Hartbfc5c482016-04-05 18:57:00 -070035 * @return map of route table name to routes in that table
Jonathan Hart96c146b2017-02-24 16:32:00 -080036 * @deprecated in Kingfisher release. Use {@link #getRoutes(RouteTableId)}
37 * instead.
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070038 */
Jonathan Hart96c146b2017-02-24 16:32:00 -080039 @Deprecated
Jonathan Hartbfc5c482016-04-05 18:57:00 -070040 Map<RouteTableId, Collection<Route>> getAllRoutes();
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070041
42 /**
Jonathan Hart96c146b2017-02-24 16:32:00 -080043 * 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 Hartbfc5c482016-04-05 18:57:00 -070058 * 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 Hart7d7e2f52016-03-29 16:22:49 -070061 *
Jonathan Hartbfc5c482016-04-05 18:57:00 -070062 * @param ip IP address
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070063 * @return longest prefix matched route
Jonathan Hart96c146b2017-02-24 16:32:00 -080064 * @deprecated in Kingfisher release. Use {{@link #longestPrefixLookup(IpAddress)}}
65 * instead.
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070066 */
Jonathan Hart96c146b2017-02-24 16:32:00 -080067 @Deprecated
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070068 Route longestPrefixMatch(IpAddress ip);
69
Jonathan Hartfd176612016-04-11 10:42:10 -070070 /**
Jonathan Hart96c146b2017-02-24 16:32:00 -080071 * 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 Hartfd176612016-04-11 10:42:10 -070079 * 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 Hart96c146b2017-02-24 16:32:00 -080084 @Deprecated
Jonathan Hartfd176612016-04-11 10:42:10 -070085 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 Hart96c146b2017-02-24 16:32:00 -080092 @Deprecated
Jonathan Hartfd176612016-04-11 10:42:10 -070093 Set<NextHop> getNextHops();
94
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070095}