Jonathan Hart | 552e31f | 2015-02-06 11:11:59 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2015 Open Networking Laboratory |
| 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 | package org.onosproject.sdnip; |
| 17 | |
| 18 | /** |
| 19 | * Represents a change to the Forwarding Information Base (FIB). |
| 20 | */ |
| 21 | public class FibUpdate { |
| 22 | |
| 23 | /** |
| 24 | * Specifies the type of the FIB update. |
| 25 | */ |
| 26 | public enum Type { |
| 27 | /** |
| 28 | * The update contains a new or updated FIB entry for a prefix. |
| 29 | */ |
| 30 | UPDATE, |
| 31 | |
| 32 | /** |
| 33 | * The update signals that a prefix should be removed from the FIB. |
| 34 | */ |
| 35 | DELETE |
| 36 | } |
| 37 | |
| 38 | private final Type type; |
| 39 | private final FibEntry entry; |
| 40 | |
| 41 | /** |
| 42 | * Creates a new FIB update. |
| 43 | * |
| 44 | * @param type type of the update |
| 45 | * @param entry FIB entry describing the update |
| 46 | */ |
| 47 | public FibUpdate(Type type, FibEntry entry) { |
| 48 | this.type = type; |
| 49 | this.entry = entry; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Returns the type of the update. |
| 54 | * |
| 55 | * @return update type |
| 56 | */ |
| 57 | public Type type() { |
| 58 | return type; |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Returns the FIB entry which contains update information. |
| 63 | * |
| 64 | * @return the FIB entry |
| 65 | */ |
| 66 | public FibEntry entry() { |
| 67 | return entry; |
| 68 | } |
| 69 | } |