blob: 4d27d7186bb2efb3c791bd274b9344f9bfd4e6c9 [file] [log] [blame]
Jonathan Hart96c146b2017-02-24 16:32:00 -08001/*
2 * Copyright 2017-present 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.store.routing.impl;
18
19import org.onlab.packet.IpAddress;
20import org.onlab.packet.IpPrefix;
21import org.onosproject.incubator.net.routing.Route;
22import org.onosproject.incubator.net.routing.RouteSet;
23import org.onosproject.incubator.net.routing.RouteTableId;
24
25import java.util.Collection;
26
27/**
28 * Represents a route table that stores routes.
29 */
30public interface RouteTable {
31
32 /**
33 * Adds a route to the route table.
34 *
35 * @param route route
36 */
37 void update(Route route);
38
39 /**
40 * Removes a route from the route table.
41 *
42 * @param route route
43 */
44 void remove(Route route);
45
46 /**
47 * Returns the route table ID.
48 *
49 * @return route table ID
50 */
51 RouteTableId id();
52
53 /**
54 * Returns all routes in the route table.
55 *
56 * @return collection of routes, grouped by prefix
57 */
58 Collection<RouteSet> getRoutes();
59
60 /**
61 * Returns the routes in this table pertaining to a given prefix.
62 *
63 * @param prefix IP prefix
64 * @return routes for the prefix
65 */
66 RouteSet getRoutes(IpPrefix prefix);
67
68 /**
69 * Returns all routes that have the given next hop.
70 *
71 * @param nextHop next hop IP address
72 * @return collection of routes
73 */
74 Collection<Route> getRoutesForNextHop(IpAddress nextHop);
75
76 /**
77 * Releases route table resources held locally.
78 */
79 void shutdown();
80
81 /**
82 * Releases route table resources across the entire cluster.
83 */
84 void destroy();
85
86}