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