blob: bab595a2593ed5c03c1404aa7a38e773d7200235 [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 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 Hartbfc5c482016-04-05 18:57:00 -070031 * Returns all routes for all route tables in the system.
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070032 *
Jonathan Hartbfc5c482016-04-05 18:57:00 -070033 * @return map of route table name to routes in that table
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070034 */
Jonathan Hartbfc5c482016-04-05 18:57:00 -070035 Map<RouteTableId, Collection<Route>> getAllRoutes();
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070036
37 /**
Jonathan Hartbfc5c482016-04-05 18:57:00 -070038 * Performs a longest prefix match on the given IP address. The call will
39 * return the route with the most specific prefix that contains the given
40 * IP address.
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070041 *
Jonathan Hartbfc5c482016-04-05 18:57:00 -070042 * @param ip IP address
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070043 * @return longest prefix matched route
44 */
45 Route longestPrefixMatch(IpAddress ip);
46
Jonathan Hart7d7e2f52016-03-29 16:22:49 -070047}