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