blob: cacee1094d0144b2287a5adcfab6d655dcf6e340 [file] [log] [blame]
Jonathan Hart7d7e2f52016-03-29 16:22:49 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -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
Ray Milkey69ec8712017-08-08 13:00:43 -070017package org.onosproject.routeservice;
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070018
19import org.onlab.packet.IpAddress;
Andrea Campanellacc2424a2018-03-07 14:27:54 -080020import org.onlab.packet.IpPrefix;
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070021import org.onosproject.event.ListenerService;
22
23import java.util.Collection;
Jonathan Hart96c146b2017-02-24 16:32:00 -080024import java.util.Optional;
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 Hart96c146b2017-02-24 16:32:00 -080032 * Returns information about all routes in the given route table.
33 *
34 * @param id route table ID
35 * @return collection of route information
36 */
37 Collection<RouteInfo> getRoutes(RouteTableId id);
38
39 /**
40 * Returns the set of route tables in the system.
41 *
42 * @return collection of route table IDs.
43 */
44 Collection<RouteTableId> getRouteTables();
45
46 /**
Jonathan Hart89ef1582017-06-19 11:12:23 -070047 * Performs a longest prefix lookup on the given IP address.
48 *
49 * @param ip IP address to look up
50 * @return most specific matching route, if one exists
51 */
52 Optional<ResolvedRoute> longestPrefixLookup(IpAddress ip);
53
54 /**
Andrea Campanellacc2424a2018-03-07 14:27:54 -080055 * Returns all resolved routes stored for the given prefix, including the
56 * best selected route.
57 *
58 * @param prefix IP prefix to look up routes for
59 * @return all stored resolved routes for this prefix
60 */
61 Collection<ResolvedRoute> getAllResolvedRoutes(IpPrefix prefix);
62
63 /**
Jonathan Hartbfc5c482016-04-05 18:57:00 -070064 * Performs a longest prefix match on the given IP address. The call will
65 * return the route with the most specific prefix that contains the given
66 * IP address.
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070067 *
Jonathan Hartbfc5c482016-04-05 18:57:00 -070068 * @param ip IP address
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070069 * @return longest prefix matched route
Jonathan Hart96c146b2017-02-24 16:32:00 -080070 * @deprecated in Kingfisher release. Use {{@link #longestPrefixLookup(IpAddress)}}
71 * instead.
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070072 */
Jonathan Hart96c146b2017-02-24 16:32:00 -080073 @Deprecated
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070074 Route longestPrefixMatch(IpAddress ip);
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070075}