blob: c123dc307f2c41924bca1f49d8493b2cb908c6aa [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 Hart96c146b2017-02-24 16:32:00 -080023import java.util.Optional;
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070024
25/**
Jonathan Hartbfc5c482016-04-05 18:57:00 -070026 * Unicast IP route service.
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070027 */
28public interface RouteService extends ListenerService<RouteEvent, RouteListener> {
29
30 /**
Jonathan Hart96c146b2017-02-24 16:32:00 -080031 * Returns information about all routes in the given route table.
32 *
33 * @param id route table ID
34 * @return collection of route information
35 */
36 Collection<RouteInfo> getRoutes(RouteTableId id);
37
38 /**
39 * Returns the set of route tables in the system.
40 *
41 * @return collection of route table IDs.
42 */
43 Collection<RouteTableId> getRouteTables();
44
45 /**
Jonathan Hart89ef1582017-06-19 11:12:23 -070046 * Performs a longest prefix lookup on the given IP address.
47 *
48 * @param ip IP address to look up
49 * @return most specific matching route, if one exists
50 */
51 Optional<ResolvedRoute> longestPrefixLookup(IpAddress ip);
52
53 /**
Jonathan Hartbfc5c482016-04-05 18:57:00 -070054 * Performs a longest prefix match on the given IP address. The call will
55 * return the route with the most specific prefix that contains the given
56 * IP address.
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070057 *
Jonathan Hartbfc5c482016-04-05 18:57:00 -070058 * @param ip IP address
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070059 * @return longest prefix matched route
Jonathan Hart96c146b2017-02-24 16:32:00 -080060 * @deprecated in Kingfisher release. Use {{@link #longestPrefixLookup(IpAddress)}}
61 * instead.
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070062 */
Jonathan Hart96c146b2017-02-24 16:32:00 -080063 @Deprecated
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070064 Route longestPrefixMatch(IpAddress ip);
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070065}