blob: 4fd99d49baf0eef7e94505897344e7c3ecd96b13 [file] [log] [blame]
Jonathan Hart7d7e2f52016-03-29 16:22:49 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
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 Hartfd176612016-04-11 10:42:10 -070024import java.util.Set;
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070025
26/**
Jonathan Hartbfc5c482016-04-05 18:57:00 -070027 * Unicast IP route service.
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070028 */
29public interface RouteService extends ListenerService<RouteEvent, RouteListener> {
30
31 /**
Jonathan Hartbfc5c482016-04-05 18:57:00 -070032 * Returns all routes for all route tables in the system.
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070033 *
Jonathan Hartbfc5c482016-04-05 18:57:00 -070034 * @return map of route table name to routes in that table
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070035 */
Jonathan Hartbfc5c482016-04-05 18:57:00 -070036 Map<RouteTableId, Collection<Route>> getAllRoutes();
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070037
38 /**
Jonathan Hartbfc5c482016-04-05 18:57:00 -070039 * 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 Hart7d7e2f52016-03-29 16:22:49 -070042 *
Jonathan Hartbfc5c482016-04-05 18:57:00 -070043 * @param ip IP address
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070044 * @return longest prefix matched route
45 */
46 Route longestPrefixMatch(IpAddress ip);
47
Jonathan Hartfd176612016-04-11 10:42:10 -070048 /**
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 Hart7d7e2f52016-03-29 16:22:49 -070063}