blob: 81bbb54e06602ad74a23703b6b0f674ffd5aae67 [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 Campanellaea2a7ad2018-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 /**
Charles Chand31a0eb2019-05-03 13:19:49 -070040 * Returns all resolved routes in the given route table.
41 *
42 * @param id route table ID
43 * @return collection of resolved route
44 */
45 Collection<ResolvedRoute> getResolvedRoutes(RouteTableId id);
46
47 /**
Jonathan Hart96c146b2017-02-24 16:32:00 -080048 * Returns the set of route tables in the system.
49 *
50 * @return collection of route table IDs.
51 */
52 Collection<RouteTableId> getRouteTables();
53
54 /**
Jonathan Hart89ef1582017-06-19 11:12:23 -070055 * Performs a longest prefix lookup on the given IP address.
56 *
57 * @param ip IP address to look up
58 * @return most specific matching route, if one exists
59 */
60 Optional<ResolvedRoute> longestPrefixLookup(IpAddress ip);
61
62 /**
Andrea Campanellaea2a7ad2018-03-07 14:27:54 -080063 * Returns all resolved routes stored for the given prefix, including the
64 * best selected route.
65 *
66 * @param prefix IP prefix to look up routes for
67 * @return all stored resolved routes for this prefix
68 */
69 Collection<ResolvedRoute> getAllResolvedRoutes(IpPrefix prefix);
70
71 /**
Jonathan Hartbfc5c482016-04-05 18:57:00 -070072 * Performs a longest prefix match on the given IP address. The call will
73 * return the route with the most specific prefix that contains the given
74 * IP address.
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070075 *
Jonathan Hartbfc5c482016-04-05 18:57:00 -070076 * @param ip IP address
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070077 * @return longest prefix matched route
Jonathan Hart96c146b2017-02-24 16:32:00 -080078 * @deprecated in Kingfisher release. Use {{@link #longestPrefixLookup(IpAddress)}}
79 * instead.
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070080 */
Jonathan Hart96c146b2017-02-24 16:32:00 -080081 @Deprecated
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070082 Route longestPrefixMatch(IpAddress ip);
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070083}