blob: 9b7509986912249cb0b7f7943fa7f8da93c38f17 [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;
20import org.onlab.packet.MacAddress;
21import org.onosproject.store.Store;
22
23import java.util.Collection;
Jonathan Hartfd176612016-04-11 10:42:10 -070024import java.util.Map;
Jonathan Hartbfc5c482016-04-05 18:57:00 -070025import java.util.Set;
26
27/**
28 * Unicast route store.
29 */
30public interface RouteStore extends Store<RouteEvent, RouteStoreDelegate> {
31
32 /**
33 * Adds or updates the given route in the store.
34 *
35 * @param route route to add or update
36 */
37 void updateRoute(Route route);
38
39 /**
40 * Removes the given route from the store.
41 *
42 * @param route route to remove
43 */
44 void removeRoute(Route route);
45
46 /**
47 * Returns the IDs for all route tables in the store.
48 *
49 * @return route table IDs
50 */
51 Set<RouteTableId> getRouteTables();
52
53 /**
54 * Returns the routes for a particular route table.
55 *
56 * @param table route table
57 * @return collection of route in the table
58 */
59 Collection<Route> getRoutes(RouteTableId table);
60
61 /**
62 * Performs a longest prefix match with the given IP address.
63 *
64 * @param ip IP to look up
65 * @return longest prefix match route
66 */
67 Route longestPrefixMatch(IpAddress ip);
68
69 /**
Jonathan Hartfd176612016-04-11 10:42:10 -070070 * Returns the routes that point to the given next hop IP address.
71 *
72 * @param ip IP address of the next hop
73 * @return routes for the given next hop
74 */
75 Collection<Route> getRoutesForNextHop(IpAddress ip);
76
77 /**
Jonathan Hartbfc5c482016-04-05 18:57:00 -070078 * Updates a next hop IP and MAC in the store.
79 *
80 * @param ip IP address
81 * @param mac MAC address
82 */
83 void updateNextHop(IpAddress ip, MacAddress mac);
84
85 /**
86 * Removes a next hop IP and MAC from the store.
87 *
88 * @param ip IP address
89 * @param mac MAC address
90 */
91 void removeNextHop(IpAddress ip, MacAddress mac);
92
93 /**
94 * Returns the MAC address of the given next hop.
95 *
96 * @param ip next hop IP
97 * @return MAC address
98 */
99 MacAddress getNextHop(IpAddress ip);
Jonathan Hartfd176612016-04-11 10:42:10 -0700100
101 /**
102 * Returns all next hops in the route store.
103 *
104 * @return next hops
105 */
106 Map<IpAddress, MacAddress> getNextHops();
Jonathan Hartbfc5c482016-04-05 18:57:00 -0700107}