Jonathan Hart | ab63aac | 2014-10-16 08:52:55 -0700 | [diff] [blame] | 1 | package org.onlab.onos.sdnip.bgp; |
| 2 | |
| 3 | /** |
| 4 | * BGP related constants. |
| 5 | */ |
| 6 | public final class BgpConstants { |
| 7 | /** |
| 8 | * Default constructor. |
| 9 | * <p> |
| 10 | * The constructor is private to prevent creating an instance of |
| 11 | * this utility class. |
| 12 | */ |
| 13 | private BgpConstants() { |
| 14 | } |
| 15 | |
| 16 | /** BGP port number (RFC 4271). */ |
| 17 | public static final int BGP_PORT = 179; |
| 18 | |
| 19 | /** BGP version. */ |
| 20 | public static final int BGP_VERSION = 4; |
| 21 | |
| 22 | /** BGP OPEN message type. */ |
| 23 | public static final int BGP_TYPE_OPEN = 1; |
| 24 | |
| 25 | /** BGP UPDATE message type. */ |
| 26 | public static final int BGP_TYPE_UPDATE = 2; |
| 27 | |
| 28 | /** BGP NOTIFICATION message type. */ |
| 29 | public static final int BGP_TYPE_NOTIFICATION = 3; |
| 30 | |
| 31 | /** BGP KEEPALIVE message type. */ |
| 32 | public static final int BGP_TYPE_KEEPALIVE = 4; |
| 33 | |
| 34 | /** BGP Header Marker field length. */ |
| 35 | public static final int BGP_HEADER_MARKER_LENGTH = 16; |
| 36 | |
| 37 | /** BGP Header length. */ |
| 38 | public static final int BGP_HEADER_LENGTH = 19; |
| 39 | |
| 40 | /** BGP message maximum length. */ |
| 41 | public static final int BGP_MESSAGE_MAX_LENGTH = 4096; |
| 42 | |
| 43 | /** BGP OPEN message minimum length (BGP Header included). */ |
| 44 | public static final int BGP_OPEN_MIN_LENGTH = 29; |
| 45 | |
| 46 | /** BGP UPDATE message minimum length (BGP Header included). */ |
| 47 | public static final int BGP_UPDATE_MIN_LENGTH = 23; |
| 48 | |
| 49 | /** BGP NOTIFICATION message minimum length (BGP Header included). */ |
| 50 | public static final int BGP_NOTIFICATION_MIN_LENGTH = 21; |
| 51 | |
| 52 | /** BGP KEEPALIVE message expected length (BGP Header included). */ |
| 53 | public static final int BGP_KEEPALIVE_EXPECTED_LENGTH = 19; |
| 54 | |
| 55 | /** BGP KEEPALIVE messages transmitted per Hold interval. */ |
| 56 | public static final int BGP_KEEPALIVE_PER_HOLD_INTERVAL = 3; |
| 57 | |
| 58 | /** BGP KEEPALIVE messages minimum Holdtime (in seconds). */ |
| 59 | public static final int BGP_KEEPALIVE_MIN_HOLDTIME = 3; |
| 60 | |
| 61 | /** BGP KEEPALIVE messages minimum transmission interval (in seconds). */ |
| 62 | public static final int BGP_KEEPALIVE_MIN_INTERVAL = 1; |
| 63 | |
| 64 | /** BGP AS 0 (zero) value. See draft-ietf-idr-as0-06.txt Internet Draft. */ |
| 65 | public static final long BGP_AS_0 = 0; |
| 66 | |
| 67 | /** |
| 68 | * BGP UPDATE related constants. |
| 69 | */ |
| 70 | public static final class Update { |
| 71 | /** |
| 72 | * Default constructor. |
| 73 | * <p> |
| 74 | * The constructor is private to prevent creating an instance of |
| 75 | * this utility class. |
| 76 | */ |
| 77 | private Update() { |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * BGP UPDATE: ORIGIN related constants. |
| 82 | */ |
| 83 | public static final class Origin { |
| 84 | /** |
| 85 | * Default constructor. |
| 86 | * <p> |
| 87 | * The constructor is private to prevent creating an instance of |
| 88 | * this utility class. |
| 89 | */ |
| 90 | private Origin() { |
| 91 | } |
| 92 | |
| 93 | /** BGP UPDATE Attributes Type Code ORIGIN. */ |
| 94 | public static final int TYPE = 1; |
| 95 | |
| 96 | /** BGP UPDATE Attributes Type Code ORIGIN length. */ |
| 97 | public static final int LENGTH = 1; |
| 98 | |
| 99 | /** BGP UPDATE ORIGIN: IGP. */ |
| 100 | public static final int IGP = 0; |
| 101 | |
| 102 | /** BGP UPDATE ORIGIN: EGP. */ |
| 103 | public static final int EGP = 1; |
| 104 | |
| 105 | /** BGP UPDATE ORIGIN: INCOMPLETE. */ |
| 106 | public static final int INCOMPLETE = 2; |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * BGP UPDATE: AS_PATH related constants. |
| 111 | */ |
| 112 | public static final class AsPath { |
| 113 | /** |
| 114 | * Default constructor. |
| 115 | * <p> |
| 116 | * The constructor is private to prevent creating an instance of |
| 117 | * this utility class. |
| 118 | */ |
| 119 | private AsPath() { |
| 120 | } |
| 121 | |
| 122 | /** BGP UPDATE Attributes Type Code AS_PATH. */ |
| 123 | public static final int TYPE = 2; |
| 124 | |
| 125 | /** BGP UPDATE AS_PATH Type: AS_SET. */ |
| 126 | public static final int AS_SET = 1; |
| 127 | |
| 128 | /** BGP UPDATE AS_PATH Type: AS_SEQUENCE. */ |
| 129 | public static final int AS_SEQUENCE = 2; |
| 130 | } |
| 131 | |
| 132 | /** |
| 133 | * BGP UPDATE: NEXT_HOP related constants. |
| 134 | */ |
| 135 | public static final class NextHop { |
| 136 | /** |
| 137 | * Default constructor. |
| 138 | * <p> |
| 139 | * The constructor is private to prevent creating an instance of |
| 140 | * this utility class. |
| 141 | */ |
| 142 | private NextHop() { |
| 143 | } |
| 144 | |
| 145 | /** BGP UPDATE Attributes Type Code NEXT_HOP. */ |
| 146 | public static final int TYPE = 3; |
| 147 | |
| 148 | /** BGP UPDATE Attributes Type Code NEXT_HOP length. */ |
| 149 | public static final int LENGTH = 4; |
| 150 | } |
| 151 | |
| 152 | /** |
| 153 | * BGP UPDATE: MULTI_EXIT_DISC related constants. |
| 154 | */ |
| 155 | public static final class MultiExitDisc { |
| 156 | /** |
| 157 | * Default constructor. |
| 158 | * <p> |
| 159 | * The constructor is private to prevent creating an instance of |
| 160 | * this utility class. |
| 161 | */ |
| 162 | private MultiExitDisc() { |
| 163 | } |
| 164 | |
| 165 | /** BGP UPDATE Attributes Type Code MULTI_EXIT_DISC. */ |
| 166 | public static final int TYPE = 4; |
| 167 | |
| 168 | /** BGP UPDATE Attributes Type Code MULTI_EXIT_DISC length. */ |
| 169 | public static final int LENGTH = 4; |
| 170 | |
| 171 | /** BGP UPDATE Attributes lowest MULTI_EXIT_DISC value. */ |
| 172 | public static final int LOWEST_MULTI_EXIT_DISC = 0; |
| 173 | } |
| 174 | |
| 175 | /** |
| 176 | * BGP UPDATE: LOCAL_PREF related constants. |
| 177 | */ |
| 178 | public static final class LocalPref { |
| 179 | /** |
| 180 | * Default constructor. |
| 181 | * <p> |
| 182 | * The constructor is private to prevent creating an instance of |
| 183 | * this utility class. |
| 184 | */ |
| 185 | private LocalPref() { |
| 186 | } |
| 187 | |
| 188 | /** BGP UPDATE Attributes Type Code LOCAL_PREF. */ |
| 189 | public static final int TYPE = 5; |
| 190 | |
| 191 | /** BGP UPDATE Attributes Type Code LOCAL_PREF length. */ |
| 192 | public static final int LENGTH = 4; |
| 193 | } |
| 194 | |
| 195 | /** |
| 196 | * BGP UPDATE: ATOMIC_AGGREGATE related constants. |
| 197 | */ |
| 198 | public static final class AtomicAggregate { |
| 199 | /** |
| 200 | * Default constructor. |
| 201 | * <p> |
| 202 | * The constructor is private to prevent creating an instance of |
| 203 | * this utility class. |
| 204 | */ |
| 205 | private AtomicAggregate() { |
| 206 | } |
| 207 | |
| 208 | /** BGP UPDATE Attributes Type Code ATOMIC_AGGREGATE. */ |
| 209 | public static final int TYPE = 6; |
| 210 | |
| 211 | /** BGP UPDATE Attributes Type Code ATOMIC_AGGREGATE length. */ |
| 212 | public static final int LENGTH = 0; |
| 213 | } |
| 214 | |
| 215 | /** |
| 216 | * BGP UPDATE: AGGREGATOR related constants. |
| 217 | */ |
| 218 | public static final class Aggregator { |
| 219 | /** |
| 220 | * Default constructor. |
| 221 | * <p> |
| 222 | * The constructor is private to prevent creating an instance of |
| 223 | * this utility class. |
| 224 | */ |
| 225 | private Aggregator() { |
| 226 | } |
| 227 | |
| 228 | /** BGP UPDATE Attributes Type Code AGGREGATOR. */ |
| 229 | public static final int TYPE = 7; |
| 230 | |
| 231 | /** BGP UPDATE Attributes Type Code AGGREGATOR length. */ |
| 232 | public static final int LENGTH = 6; |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | /** |
| 237 | * BGP NOTIFICATION related constants. |
| 238 | */ |
| 239 | public static final class Notifications { |
| 240 | /** |
| 241 | * Default constructor. |
| 242 | * <p> |
| 243 | * The constructor is private to prevent creating an instance of |
| 244 | * this utility class. |
| 245 | */ |
| 246 | private Notifications() { |
| 247 | } |
| 248 | |
| 249 | /** |
| 250 | * BGP NOTIFICATION: Message Header Error constants. |
| 251 | */ |
| 252 | public static final class MessageHeaderError { |
| 253 | /** |
| 254 | * Default constructor. |
| 255 | * <p> |
| 256 | * The constructor is private to prevent creating an instance of |
| 257 | * this utility class. |
| 258 | */ |
| 259 | private MessageHeaderError() { |
| 260 | } |
| 261 | |
| 262 | /** Message Header Error code. */ |
| 263 | public static final int ERROR_CODE = 1; |
| 264 | |
| 265 | /** Message Header Error subcode: Connection Not Synchronized. */ |
| 266 | public static final int CONNECTION_NOT_SYNCHRONIZED = 1; |
| 267 | |
| 268 | /** Message Header Error subcode: Bad Message Length. */ |
| 269 | public static final int BAD_MESSAGE_LENGTH = 2; |
| 270 | |
| 271 | /** Message Header Error subcode: Bad Message Type. */ |
| 272 | public static final int BAD_MESSAGE_TYPE = 3; |
| 273 | } |
| 274 | |
| 275 | /** |
| 276 | * BGP NOTIFICATION: OPEN Message Error constants. |
| 277 | */ |
| 278 | public static final class OpenMessageError { |
| 279 | /** |
| 280 | * Default constructor. |
| 281 | * <p> |
| 282 | * The constructor is private to prevent creating an instance of |
| 283 | * this utility class. |
| 284 | */ |
| 285 | private OpenMessageError() { |
| 286 | } |
| 287 | |
| 288 | /** OPEN Message Error code. */ |
| 289 | public static final int ERROR_CODE = 2; |
| 290 | |
| 291 | /** OPEN Message Error subcode: Unsupported Version Number. */ |
| 292 | public static final int UNSUPPORTED_VERSION_NUMBER = 1; |
| 293 | |
| 294 | /** OPEN Message Error subcode: Bad PEER AS. */ |
| 295 | public static final int BAD_PEER_AS = 2; |
| 296 | |
| 297 | /** OPEN Message Error subcode: Unacceptable Hold Time. */ |
| 298 | public static final int UNACCEPTABLE_HOLD_TIME = 6; |
| 299 | } |
| 300 | |
| 301 | /** |
| 302 | * BGP NOTIFICATION: UPDATE Message Error constants. |
| 303 | */ |
| 304 | public static final class UpdateMessageError { |
| 305 | /** |
| 306 | * Default constructor. |
| 307 | * <p> |
| 308 | * The constructor is private to prevent creating an instance of |
| 309 | * this utility class. |
| 310 | */ |
| 311 | private UpdateMessageError() { |
| 312 | } |
| 313 | |
| 314 | /** UPDATE Message Error code. */ |
| 315 | public static final int ERROR_CODE = 3; |
| 316 | |
| 317 | /** UPDATE Message Error subcode: Malformed Attribute List. */ |
| 318 | public static final int MALFORMED_ATTRIBUTE_LIST = 1; |
| 319 | |
| 320 | /** UPDATE Message Error subcode: Unrecognized Well-known Attribute. */ |
| 321 | public static final int UNRECOGNIZED_WELL_KNOWN_ATTRIBUTE = 2; |
| 322 | |
| 323 | /** UPDATE Message Error subcode: Missing Well-known Attribute. */ |
| 324 | public static final int MISSING_WELL_KNOWN_ATTRIBUTE = 3; |
| 325 | |
| 326 | /** UPDATE Message Error subcode: Attribute Flags Error. */ |
| 327 | public static final int ATTRIBUTE_FLAGS_ERROR = 4; |
| 328 | |
| 329 | /** UPDATE Message Error subcode: Attribute Length Error. */ |
| 330 | public static final int ATTRIBUTE_LENGTH_ERROR = 5; |
| 331 | |
| 332 | /** UPDATE Message Error subcode: Invalid ORIGIN Attribute. */ |
| 333 | public static final int INVALID_ORIGIN_ATTRIBUTE = 6; |
| 334 | |
| 335 | /** UPDATE Message Error subcode: Invalid NEXT_HOP Attribute. */ |
| 336 | public static final int INVALID_NEXT_HOP_ATTRIBUTE = 8; |
| 337 | |
| 338 | /** UPDATE Message Error subcode: Optional Attribute Error. Unused. */ |
| 339 | public static final int OPTIONAL_ATTRIBUTE_ERROR = 9; |
| 340 | |
| 341 | /** UPDATE Message Error subcode: Invalid Network Field. */ |
| 342 | public static final int INVALID_NETWORK_FIELD = 10; |
| 343 | |
| 344 | /** UPDATE Message Error subcode: Malformed AS_PATH. */ |
| 345 | public static final int MALFORMED_AS_PATH = 11; |
| 346 | } |
| 347 | |
| 348 | /** |
| 349 | * BGP NOTIFICATION: Hold Timer Expired constants. |
| 350 | */ |
| 351 | public static final class HoldTimerExpired { |
| 352 | /** |
| 353 | * Default constructor. |
| 354 | * <p> |
| 355 | * The constructor is private to prevent creating an instance of |
| 356 | * this utility class. |
| 357 | */ |
| 358 | private HoldTimerExpired() { |
| 359 | } |
| 360 | |
| 361 | /** Hold Timer Expired code. */ |
| 362 | public static final int ERROR_CODE = 4; |
| 363 | } |
| 364 | |
| 365 | /** BGP NOTIFICATION message Error subcode: Unspecific. */ |
| 366 | public static final int ERROR_SUBCODE_UNSPECIFIC = 0; |
| 367 | } |
| 368 | } |