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 | /** |
| 40 | * Removes a route from the route table. |
| 41 | * |
| 42 | * @param route route |
| 43 | */ |
| 44 | void remove(Route route); |
| 45 | |
| 46 | /** |
Daniel Ginsburg | 83b7645 | 2018-06-09 01:43:59 +0300 | [diff] [blame] | 47 | * Replaces a route in the route table. |
| 48 | * |
| 49 | * @param route route |
| 50 | */ |
| 51 | void replace(Route route); |
| 52 | |
| 53 | /** |
Jonathan Hart | 96c146b | 2017-02-24 16:32:00 -0800 | [diff] [blame] | 54 | * 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 | } |