blob: 1905d1bb153dde296e8145ab4a9e4f5b1053c20b [file] [log] [blame]
Jonathan Hartbfc5c482016-04-05 18:57:00 -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.onlab.packet.MacAddress;
21import org.onosproject.store.Store;
22
23import java.util.Collection;
24import 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 /**
69 * Updates a next hop IP and MAC in the store.
70 *
71 * @param ip IP address
72 * @param mac MAC address
73 */
74 void updateNextHop(IpAddress ip, MacAddress mac);
75
76 /**
77 * Removes a next hop IP and MAC from the store.
78 *
79 * @param ip IP address
80 * @param mac MAC address
81 */
82 void removeNextHop(IpAddress ip, MacAddress mac);
83
84 /**
85 * Returns the MAC address of the given next hop.
86 *
87 * @param ip next hop IP
88 * @return MAC address
89 */
90 MacAddress getNextHop(IpAddress ip);
91}