3e2027641c311eef5aaa545ffcf9c28544e50141
[bgpcep.git] / bgp / parser-api / src / main / java / org / opendaylight / protocol / bgp / parser / parameter / GracefulCapability.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.protocol.bgp.parser.parameter;
9
10 import java.util.Map;
11
12 import org.opendaylight.protocol.bgp.concepts.BGPTableType;
13
14
15 /**
16  * Graceful restart capability parameter as described in:
17  * 
18  * <a href="http://tools.ietf.org/html/rfc4724#section-3">Graceful Restart Capability</a>
19  */
20 public final class GracefulCapability extends CapabilityParameter {
21
22         /**
23          * Capability code for GR)
24          */
25         private static final int CODE = 64;
26
27         private final boolean restartFlag;
28
29         private final int restartTimerValue;
30
31         private final Map<BGPTableType, Boolean> tableTypes;
32
33         /**
34          * Creates new Graceful restart capability.
35          * 
36          * @param restartFlag should be false
37          * @param restartTimerValue should be 0
38          * @param tableTypes supported AFI/SAFI along with Forwarding state flag (should be true)
39          */
40         public GracefulCapability(final boolean restartFlag, final int restartTimerValue, final Map<BGPTableType, Boolean> tableTypes) {
41                 super(CODE);
42                 this.restartFlag = restartFlag;
43                 this.restartTimerValue = restartTimerValue;
44                 this.tableTypes = tableTypes;
45         }
46
47         /**
48          * Was router restarted?
49          * 
50          * @return the restartFlag
51          */
52         public boolean isRestartFlag() {
53                 return this.restartFlag;
54         }
55
56         /**
57          * Currently should be always 0.
58          * 
59          * @return the restartTimerValue
60          */
61         public int getRestartTimerValue() {
62                 return this.restartTimerValue;
63         }
64
65         /**
66          * Return supported AFI/SAFI along with Forwarding state flag.
67          * 
68          * @return the tableTypes
69          */
70         public Map<BGPTableType, Boolean> getTableTypes() {
71                 return this.tableTypes;
72         }
73 }