Jonathan Hart | 382623d | 2014-04-03 09:48:11 -0700 | [diff] [blame] | 1 | package net.onrc.onos.apps.bgproute; |
Jonathan Hart | e963a33 | 2013-07-26 15:56:20 +1200 | [diff] [blame] | 2 | |
Jonathan Hart | 31e15f1 | 2014-04-10 10:33:00 -0700 | [diff] [blame] | 3 | /** |
| 4 | * Represents a route update received from BGPd. An update has an operation |
| 5 | * describing whether the update is adding a route or revoking a route. It also |
| 6 | * contains the route prefix, and {@link RibEntry} containing next hop and |
| 7 | * sequence number information for the update. |
| 8 | */ |
Jonathan Hart | e963a33 | 2013-07-26 15:56:20 +1200 | [diff] [blame] | 9 | public class RibUpdate { |
Jonathan Hart | 738980f | 2014-04-04 10:11:15 -0700 | [diff] [blame] | 10 | private final Operation operation; |
| 11 | private final Prefix prefix; |
| 12 | private final RibEntry ribEntry; |
Ray Milkey | 5d40601 | 2014-04-08 14:44:41 -0700 | [diff] [blame] | 13 | |
Jonathan Hart | 31e15f1 | 2014-04-10 10:33:00 -0700 | [diff] [blame] | 14 | /** |
| 15 | * Updates can either add new routes or revoke old routes. The |
| 16 | * {@link Operation} enum descibes which action is being taken. |
| 17 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 18 | public enum Operation { |
Jonathan Hart | 31e15f1 | 2014-04-10 10:33:00 -0700 | [diff] [blame] | 19 | /** |
| 20 | * Represents a route update. ONOS should update its route information |
| 21 | * for this prefix to the new information provided in this |
| 22 | * {@link RibUpdate}. This means either add a new prefix, or update |
| 23 | * the information for an existing prefix. |
| 24 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 25 | UPDATE, |
Jonathan Hart | 31e15f1 | 2014-04-10 10:33:00 -0700 | [diff] [blame] | 26 | /** |
| 27 | * Represents a route delete. ONOS should remove this prefix and route |
| 28 | * information from its route table. |
| 29 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 30 | DELETE |
| 31 | } |
Jonathan Hart | e963a33 | 2013-07-26 15:56:20 +1200 | [diff] [blame] | 32 | |
Jonathan Hart | 31e15f1 | 2014-04-10 10:33:00 -0700 | [diff] [blame] | 33 | /** |
| 34 | * Class constructor, taking the operation of the update, the route prefix |
| 35 | * and the {@link RibEntry} describing the update. |
| 36 | * |
| 37 | * @param operation the operation of the update |
| 38 | * @param prefix the route prefix |
| 39 | * @param ribEntry the update entry |
| 40 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 41 | public RibUpdate(Operation operation, Prefix prefix, RibEntry ribEntry) { |
| 42 | this.operation = operation; |
| 43 | this.prefix = prefix; |
| 44 | this.ribEntry = ribEntry; |
| 45 | } |
Jonathan Hart | e963a33 | 2013-07-26 15:56:20 +1200 | [diff] [blame] | 46 | |
Jonathan Hart | 31e15f1 | 2014-04-10 10:33:00 -0700 | [diff] [blame] | 47 | /** |
| 48 | * Gets the operation of the update. |
| 49 | * |
| 50 | * @return the operation |
| 51 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 52 | public Operation getOperation() { |
| 53 | return operation; |
| 54 | } |
| 55 | |
Jonathan Hart | 31e15f1 | 2014-04-10 10:33:00 -0700 | [diff] [blame] | 56 | /** |
| 57 | * Gets the route prefix of the update. |
| 58 | * |
| 59 | * @return the prefix |
| 60 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 61 | public Prefix getPrefix() { |
| 62 | return prefix; |
| 63 | } |
| 64 | |
Jonathan Hart | 31e15f1 | 2014-04-10 10:33:00 -0700 | [diff] [blame] | 65 | /** |
| 66 | * Gets the {@link RibEntry} of the update. |
| 67 | * |
| 68 | * @return the entry |
| 69 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 70 | public RibEntry getRibEntry() { |
| 71 | return ribEntry; |
| 72 | } |
Jonathan Hart | e963a33 | 2013-07-26 15:56:20 +1200 | [diff] [blame] | 73 | } |