blob: 130654b24d755967bff0e0dabcf7e732b3a4b77f [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 /**
40 * Removes a route from the route table.
41 *
42 * @param route route
43 */
44 void remove(Route route);
45
46 /**
Daniel Ginsburg83b76452018-06-09 01:43:59 +030047 * Replaces a route in the route table.
48 *
49 * @param route route
50 */
51 void replace(Route route);
52
53 /**
Jonathan Hart96c146b2017-02-24 16:32:00 -080054 * Returns the route table ID.
55 *
56 * @return route table ID
57 */
58 RouteTableId id();
59
60 /**
61 * Returns all routes in the route table.
62 *
63 * @return collection of routes, grouped by prefix
64 */
65 Collection<RouteSet> getRoutes();
66
67 /**
68 * Returns the routes in this table pertaining to a given prefix.
69 *
70 * @param prefix IP prefix
71 * @return routes for the prefix
72 */
73 RouteSet getRoutes(IpPrefix prefix);
74
75 /**
76 * Returns all routes that have the given next hop.
77 *
78 * @param nextHop next hop IP address
79 * @return collection of routes
80 */
81 Collection<Route> getRoutesForNextHop(IpAddress nextHop);
82
83 /**
84 * Releases route table resources held locally.
85 */
86 void shutdown();
87
88 /**
89 * Releases route table resources across the entire cluster.
90 */
91 void destroy();
92
93}