Jonathan Hart | 96c146b | 2017-02-24 16:32:00 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2017-present Open Networking Foundation |
Jonathan Hart | 96c146b | 2017-02-24 16:32:00 -0800 | [diff] [blame] | 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 | |
Ray Milkey | 69ec871 | 2017-08-08 13:00:43 -0700 | [diff] [blame] | 17 | package org.onosproject.routeservice.store; |
Jonathan Hart | 96c146b | 2017-02-24 16:32:00 -0800 | [diff] [blame] | 18 | |
| 19 | import org.onlab.packet.IpAddress; |
| 20 | import org.onlab.packet.IpPrefix; |
Ray Milkey | 69ec871 | 2017-08-08 13:00:43 -0700 | [diff] [blame] | 21 | import org.onosproject.routeservice.Route; |
| 22 | import org.onosproject.routeservice.RouteSet; |
| 23 | import org.onosproject.routeservice.RouteTableId; |
Jonathan Hart | 96c146b | 2017-02-24 16:32:00 -0800 | [diff] [blame] | 24 | |
| 25 | import java.util.Collection; |
| 26 | |
| 27 | /** |
| 28 | * Represents a route table that stores routes. |
| 29 | */ |
| 30 | public 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 | /** |
pier | 8a86db2 | 2019-10-16 16:58:20 +0200 | [diff] [blame] | 40 | * Adds the routes to the route table. |
| 41 | * |
| 42 | * @param routes routes |
| 43 | */ |
| 44 | void update(Collection<Route> routes); |
| 45 | |
| 46 | /** |
Jonathan Hart | 96c146b | 2017-02-24 16:32:00 -0800 | [diff] [blame] | 47 | * Removes a route from the route table. |
| 48 | * |
| 49 | * @param route route |
| 50 | */ |
| 51 | void remove(Route route); |
| 52 | |
| 53 | /** |
pier | 8a86db2 | 2019-10-16 16:58:20 +0200 | [diff] [blame] | 54 | * Removes the routes from the route table. |
| 55 | * |
| 56 | * @param routes routes |
| 57 | */ |
| 58 | void remove(Collection<Route> routes); |
| 59 | |
| 60 | /** |
Daniel Ginsburg | 83b7645 | 2018-06-09 01:43:59 +0300 | [diff] [blame] | 61 | * Replaces a route in the route table. |
| 62 | * |
| 63 | * @param route route |
| 64 | */ |
| 65 | void replace(Route route); |
| 66 | |
| 67 | /** |
Jonathan Hart | 96c146b | 2017-02-24 16:32:00 -0800 | [diff] [blame] | 68 | * 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 | /** |
pier | 8a86db2 | 2019-10-16 16:58:20 +0200 | [diff] [blame] | 98 | * 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 Hart | 96c146b | 2017-02-24 16:32:00 -0800 | [diff] [blame] | 106 | * 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 | } |