blob: 3fd9e69e813c3882cc2675faae1332fd8bad1c4d [file] [log] [blame]
Jonathan Hart7d7e2f52016-03-29 16:22:49 -07001/*
2 * Copyright 2016 Open Networking Laboratory
3 *
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;
23
24/**
25 * IP unicast routing service.
26 */
27public interface RouteService extends ListenerService<RouteEvent, RouteListener> {
28
29 /**
30 * Gets all routes.
31 *
32 * @return collection of all routes
33 */
34 Collection<Route> getRoutes();
35
36 /**
37 * Gets routes learnt from a particular source.
38 *
39 * @param source route source
40 * @return collection of routes
41 */
42 Collection<Route> getRoutesFromSource(Route.Source source);
43
44 /**
45 * Gets the longest prefix route that matches the given IP address.
46 *
47 * @param ip IP addres
48 * @return longest prefix matched route
49 */
50 Route longestPrefixMatch(IpAddress ip);
51
52 //TODO should mutation methods be pushed to a different interface?
53 /**
54 * Updates the given routes in the route service.
55 *
56 * @param routes collection of routes to update
57 */
58 void update(Collection<Route> routes);
59
60 /**
61 * Withdraws the given routes from the route service.
62 *
63 * @param routes collection of routes to withdraw
64 */
65 void withdraw(Collection<Route> routes);
66}