blob: 22a6285d2cc317ce80fbc3d0480142f2fb8a71ff [file] [log] [blame]
Jonathan Hartbfc5c482016-04-05 18:57:00 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Jonathan Hartbfc5c482016-04-05 18:57:00 -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;
Jonathan Hartbfc5c482016-04-05 18:57:00 -070020import org.onosproject.store.Store;
21
22import java.util.Collection;
Jonathan Hartfd176612016-04-11 10:42:10 -070023import java.util.Map;
Jonathan Hartbfc5c482016-04-05 18:57:00 -070024import java.util.Set;
25
26/**
27 * Unicast route store.
28 */
29public interface RouteStore extends Store<RouteEvent, RouteStoreDelegate> {
30
31 /**
32 * Adds or updates the given route in the store.
33 *
34 * @param route route to add or update
35 */
36 void updateRoute(Route route);
37
38 /**
39 * Removes the given route from the store.
40 *
41 * @param route route to remove
42 */
43 void removeRoute(Route route);
44
45 /**
46 * Returns the IDs for all route tables in the store.
47 *
48 * @return route table IDs
49 */
50 Set<RouteTableId> getRouteTables();
51
52 /**
53 * Returns the routes for a particular route table.
54 *
55 * @param table route table
56 * @return collection of route in the table
57 */
58 Collection<Route> getRoutes(RouteTableId table);
59
60 /**
61 * Performs a longest prefix match with the given IP address.
62 *
63 * @param ip IP to look up
64 * @return longest prefix match route
65 */
66 Route longestPrefixMatch(IpAddress ip);
67
68 /**
Jonathan Hartfd176612016-04-11 10:42:10 -070069 * Returns the routes that point to the given next hop IP address.
70 *
71 * @param ip IP address of the next hop
72 * @return routes for the given next hop
73 */
74 Collection<Route> getRoutesForNextHop(IpAddress ip);
75
76 /**
Charles Chane4d13102016-11-08 15:38:44 -080077 * Updates a next hop information in the store.
Jonathan Hartbfc5c482016-04-05 18:57:00 -070078 *
79 * @param ip IP address
Charles Chan8fe9f4c2016-10-24 16:46:25 -070080 * @param nextHopData Information of the next hop
Jonathan Hartbfc5c482016-04-05 18:57:00 -070081 */
Charles Chan8fe9f4c2016-10-24 16:46:25 -070082 void updateNextHop(IpAddress ip, NextHopData nextHopData);
Jonathan Hartbfc5c482016-04-05 18:57:00 -070083
84 /**
Charles Chane4d13102016-11-08 15:38:44 -080085 * Removes a next hop information from the store.
Jonathan Hartbfc5c482016-04-05 18:57:00 -070086 *
87 * @param ip IP address
Charles Chan8fe9f4c2016-10-24 16:46:25 -070088 * @param nextHopData Information of the next hop
Jonathan Hartbfc5c482016-04-05 18:57:00 -070089 */
Charles Chan8fe9f4c2016-10-24 16:46:25 -070090 void removeNextHop(IpAddress ip, NextHopData nextHopData);
Jonathan Hartbfc5c482016-04-05 18:57:00 -070091
92 /**
Charles Chane4d13102016-11-08 15:38:44 -080093 * Returns the information of the given next hop.
Jonathan Hartbfc5c482016-04-05 18:57:00 -070094 *
95 * @param ip next hop IP
Charles Chan8fe9f4c2016-10-24 16:46:25 -070096 * @return Information of the next hop
Jonathan Hartbfc5c482016-04-05 18:57:00 -070097 */
Charles Chan8fe9f4c2016-10-24 16:46:25 -070098 NextHopData getNextHop(IpAddress ip);
Jonathan Hartfd176612016-04-11 10:42:10 -070099
100 /**
101 * Returns all next hops in the route store.
102 *
103 * @return next hops
104 */
Charles Chan8fe9f4c2016-10-24 16:46:25 -0700105 Map<IpAddress, NextHopData> getNextHops();
Jonathan Hartbfc5c482016-04-05 18:57:00 -0700106}