blob: fddd116038d0f947dfdd96efb82b0bbfb4612f23 [file] [log] [blame]
Jonathan Hart96c146b2017-02-24 16:32:00 -08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
Jonathan Hart96c146b2017-02-24 16:32:00 -08003 *
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
Ray Milkey69ec8712017-08-08 13:00:43 -070017package org.onosproject.routeservice.store;
Jonathan Hart96c146b2017-02-24 16:32:00 -080018
19import org.onlab.packet.IpAddress;
20import org.onlab.packet.IpPrefix;
Ray Milkey69ec8712017-08-08 13:00:43 -070021import org.onosproject.routeservice.Route;
22import org.onosproject.routeservice.RouteSet;
23import org.onosproject.routeservice.RouteTableId;
Jonathan Hart96c146b2017-02-24 16:32:00 -080024
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 /**
piere91c87f2019-10-16 16:58:20 +020040 * Adds the routes to the route table.
41 *
42 * @param routes routes
43 */
44 void update(Collection<Route> routes);
45
46 /**
Jonathan Hart96c146b2017-02-24 16:32:00 -080047 * Removes a route from the route table.
48 *
49 * @param route route
50 */
51 void remove(Route route);
52
53 /**
piere91c87f2019-10-16 16:58:20 +020054 * Removes the routes from the route table.
55 *
56 * @param routes routes
57 */
58 void remove(Collection<Route> routes);
59
60 /**
Daniel Ginsburg83b76452018-06-09 01:43:59 +030061 * Replaces a route in the route table.
62 *
63 * @param route route
64 */
65 void replace(Route route);
66
67 /**
Jonathan Hart96c146b2017-02-24 16:32:00 -080068 * Returns the route table ID.
69 *
70 * @return route table ID
71 */
72 RouteTableId id();
73
74 /**
75 * Returns all routes in the route table.
76 *
77 * @return collection of routes, grouped by prefix
78 */
79 Collection<RouteSet> getRoutes();
80
81 /**
82 * Returns the routes in this table pertaining to a given prefix.
83 *
84 * @param prefix IP prefix
85 * @return routes for the prefix
86 */
87 RouteSet getRoutes(IpPrefix prefix);
88
89 /**
90 * Returns all routes that have the given next hop.
91 *
92 * @param nextHop next hop IP address
93 * @return collection of routes
94 */
95 Collection<Route> getRoutesForNextHop(IpAddress nextHop);
96
97 /**
piere91c87f2019-10-16 16:58:20 +020098 * Returns all routes that have the given next hops.
99 *
100 * @param nextHops next hops IP addresses
101 * @return collection of routes sets
102 */
103 Collection<RouteSet> getRoutesForNextHops(Collection<IpAddress> nextHops);
104
105 /**
Jonathan Hart96c146b2017-02-24 16:32:00 -0800106 * Releases route table resources held locally.
107 */
108 void shutdown();
109
110 /**
111 * Releases route table resources across the entire cluster.
112 */
113 void destroy();
114
115}