blob: 1e58de2b1a52d45988807de9e625f3c6adf2d50a [file] [log] [blame]
Thomas Vachuska8ca75a22017-08-24 16:12:59 -07001module openconfig-bgp-types {
2 yang-version "1";
3
4 namespace "http://openconfig.net/yang/bgp-types";
5
6 prefix "oc-bgp-types";
7
8 import openconfig-types { prefix "oc-types"; }
9 import openconfig-inet-types { prefix "oc-inet"; }
10 import openconfig-extensions { prefix "oc-ext"; }
11
12 // Include definitions of BGP error notifications
13 include openconfig-bgp-errors;
14
15 // meta
16 organization
17 "OpenConfig working group";
18
19 contact
20 "OpenConfig working group
21 netopenconfig@googlegroups.com";
22
23 description
24 "This module contains general data definitions for use in BGP
25 policy. It can be imported by modules that make use of BGP
26 attributes";
27
28 oc-ext:openconfig-version "4.0.1";
29
30 revision "2017-07-30" {
31 description
32 "Clarification of add-paths send-max leaf";
33 reference "4.0.1";
34 }
35
36 revision "2017-07-10" {
37 description
38 "Add error notifications; moved add-paths config; add AS
39 prepend policy features; removed unneeded config leaves";
40 reference "4.0.0";
41 }
42
43 revision "2017-02-02" {
44 description
45 "Bugfix to remove remaining global-level policy data";
46 reference "3.0.1";
47 }
48
49 revision "2017-01-26" {
50 description
51 "Add dynamic neighbor support, migrate to OpenConfig types";
52 reference "3.0.0";
53 }
54
55 revision "2016-06-21" {
56 description
57 "OpenConfig BGP refactor";
58 reference "2.1.1";
59 }
60
61
62 identity BGP_CAPABILITY {
63 description "Base identity for a BGP capability";
64 }
65
66 identity MPBGP {
67 base BGP_CAPABILITY;
68 description
69 "Multi-protocol extensions to BGP";
70 reference "RFC2858";
71 }
72
73 identity ROUTE_REFRESH {
74 base BGP_CAPABILITY;
75 description
76 "The BGP route-refresh functionality";
77 reference "RFC2918";
78 }
79
80 identity ASN32 {
81 base BGP_CAPABILITY;
82 description
83 "4-byte (32-bit) AS number functionality";
84 reference "RFC6793";
85 }
86
87 identity GRACEFUL_RESTART {
88 base BGP_CAPABILITY;
89 description
90 "Graceful restart functionality";
91 reference "RFC4724";
92 }
93
94 identity ADD_PATHS {
95 base BGP_CAPABILITY;
96 description
97 "BGP add-paths";
98 reference "draft-ietf-idr-add-paths";
99 }
100
101 identity AFI_SAFI_TYPE {
102 description
103 "Base identity type for AFI,SAFI tuples for BGP-4";
104 reference "RFC4760 - multiprotocol extensions for BGP-4";
105 }
106
107 identity IPV4_UNICAST {
108 base AFI_SAFI_TYPE;
109 description
110 "IPv4 unicast (AFI,SAFI = 1,1)";
111 reference "RFC4760";
112 }
113
114 identity IPV6_UNICAST {
115 base AFI_SAFI_TYPE;
116 description
117 "IPv6 unicast (AFI,SAFI = 2,1)";
118 reference "RFC4760";
119 }
120
121 identity IPV4_LABELED_UNICAST {
122 base AFI_SAFI_TYPE;
123 description
124 "Labeled IPv4 unicast (AFI,SAFI = 1,4)";
125 reference "RFC3107";
126 }
127
128 identity IPV6_LABELED_UNICAST {
129 base AFI_SAFI_TYPE;
130 description
131 "Labeled IPv6 unicast (AFI,SAFI = 2,4)";
132 reference "RFC3107";
133 }
134
135 identity L3VPN_IPV4_UNICAST {
136 base AFI_SAFI_TYPE;
137 description
138 "Unicast IPv4 MPLS L3VPN (AFI,SAFI = 1,128)";
139 reference "RFC4364";
140 }
141
142 identity L3VPN_IPV6_UNICAST {
143 base AFI_SAFI_TYPE;
144 description
145 "Unicast IPv6 MPLS L3VPN (AFI,SAFI = 2,128)";
146 reference "RFC4659";
147 }
148
149 identity L3VPN_IPV4_MULTICAST {
150 base AFI_SAFI_TYPE;
151 description
152 "Multicast IPv4 MPLS L3VPN (AFI,SAFI = 1,129)";
153 reference "RFC6514";
154 }
155
156 identity L3VPN_IPV6_MULTICAST {
157 base AFI_SAFI_TYPE;
158 description
159 "Multicast IPv6 MPLS L3VPN (AFI,SAFI = 2,129)";
160 reference "RFC6514";
161 }
162
163 identity L2VPN_VPLS {
164 base AFI_SAFI_TYPE;
165 description
166 "BGP-signalled VPLS (AFI,SAFI = 25,65)";
167 reference "RFC4761";
168 }
169
170 identity L2VPN_EVPN {
171 base AFI_SAFI_TYPE;
172 description
173 "BGP MPLS Based Ethernet VPN (AFI,SAFI = 25,70)";
174 }
175
176 identity BGP_WELL_KNOWN_STD_COMMUNITY {
177 description
178 "Reserved communities within the standard community space
179 defined by RFC1997. These communities must fall within the
180 range 0x00000000 to 0xFFFFFFFF";
181 reference "RFC1997";
182 }
183
184 identity NO_EXPORT {
185 base BGP_WELL_KNOWN_STD_COMMUNITY;
186 description
187 "Do not export NLRI received carrying this community outside
188 the bounds of this autonomous system, or this confederation if
189 the local autonomous system is a confederation member AS. This
190 community has a value of 0xFFFFFF01.";
191 reference "RFC1997";
192 }
193
194 identity NO_ADVERTISE {
195 base BGP_WELL_KNOWN_STD_COMMUNITY;
196 description
197 "All NLRI received carrying this community must not be
198 advertised to other BGP peers. This community has a value of
199 0xFFFFFF02.";
200 reference "RFC1997";
201 }
202
203 identity NO_EXPORT_SUBCONFED {
204 base BGP_WELL_KNOWN_STD_COMMUNITY;
205 description
206 "All NLRI received carrying this community must not be
207 advertised to external BGP peers - including over confederation
208 sub-AS boundaries. This community has a value of 0xFFFFFF03.";
209 reference "RFC1997";
210 }
211
212 identity NOPEER {
213 base BGP_WELL_KNOWN_STD_COMMUNITY;
214 description
215 "An autonomous system receiving NLRI tagged with this community
216 is advised not to readvertise the NLRI to external bi-lateral
217 peer autonomous systems. An AS may also filter received NLRI
218 from bilateral peer sessions when they are tagged with this
219 community value";
220 reference "RFC3765";
221 }
222
223 typedef bgp-session-direction {
224 type enumeration {
225 enum INBOUND {
226 description
227 "Refers to all NLRI received from the BGP peer";
228 }
229 enum OUTBOUND {
230 description
231 "Refers to all NLRI advertised to the BGP peer";
232 }
233 }
234 description
235 "Type to describe the direction of NLRI transmission";
236 }
237
238 typedef bgp-well-known-community-type {
239 type identityref {
240 base BGP_WELL_KNOWN_STD_COMMUNITY;
241 }
242 description
243 "Type definition for well-known IETF community attribute
244 values";
245 reference
246 "IANA Border Gateway Protocol (BGP) Well Known Communities";
247 }
248
249
250 typedef bgp-std-community-type {
251 // TODO: further refine restrictions and allowed patterns
252 // 4-octet value:
253 // <as number> 2 octets
254 // <community value> 2 octets
255 type union {
256 type uint32 {
257 // per RFC 1997, 0x00000000 - 0x0000FFFF and 0xFFFF0000 -
258 // 0xFFFFFFFF are reserved
259 }
260 type string {
261 pattern '^(6553[0-5]|655[0-2][0-9]|654[0-9]{2}|65[0-4][0-9]{2}' +
262 '|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9]):' +
263 '(6553[0-5]|655[0-2][0-9]|654[0-9]{2}|65[0-4][0-9]{2}' +
264 '|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9])$';
265 }
266 }
267 description
268 "Type definition for standard commmunity attributes represented as
269 a integer value, or a string of the form N:M where N and M are
270 integers between 0 and 65535.";
271 reference "RFC 1997 - BGP Communities Attribute";
272 }
273
274 typedef bgp-ext-community-type {
275 type union {
276 type string {
277 // Type 1: 2-octet global and 4-octet local
278 // (AS number) (Integer)
279 pattern '^(6553[0-5]|655[0-2][0-9]|654[0-9]{2}|65[0-4][0-9]{2}' +
280 '|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9]):' +
281 '(429496729[0-5]|42949672[0-8][0-9]|4294967[0-1][0-9]{2}' +
282 '|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|' +
283 '429[0-3][0-9]{6}|4[0-1][0-9]{7}|[1-3][0-9]{9}|' +
284 '[1-9][0-9]{1,8}|[0-9])$';
285 }
286 type string {
287 // Type 2: 4-octet global and 2-octet local
288 // (ipv4-address) (integer)
289 pattern '^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|' +
290 '25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|' +
291 '2[0-4][0-9]|25[0-5]):' +
292 '(6553[0-5]|655[0-2][0-9]|654[0-9]{2}|65[0-4][0-9]{2}' +
293 '|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9])$';
294 }
295 type string {
296 // RFC5668: 4-octet global and 2-octet local
297 // (AS number) (integer)
298 pattern '^(429496729[0-5]|42949672[0-8][0-9]|4294967[0-1][0-9]{2}' +
299 '|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|' +
300 '429[0-3][0-9]{6}|4[0-1][0-9]{7}|[1-3][0-9]{9}|' +
301 '[1-9][0-9]{1,8}|[0-9]):' +
302 '(6553[0-5]|655[0-2][0-9]|654[0-9]{2}|65[0-4][0-9]{2}' +
303 '|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9])$';
304 }
305 type string {
306 // route-target with Type 1
307 // route-target:(ASN):(local-part)
308 pattern '^route\-target:' +
309 '(6553[0-5]|655[0-2][0-9]|654[0-9]{2}|65[0-4][0-9]{2}' +
310 '|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9]):' +
311 '(429496729[0-5]|42949672[0-8][0-9]|4294967[0-1][0-9]{2}' +
312 '|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|' +
313 '429[0-3][0-9]{6}|4[0-1][0-9]{7}|[1-3][0-9]{9}|' +
314 '[1-9][0-9]{1,8}|[0-9])$';
315 }
316 type string {
317 // route-target with Type 2
318 // route-target:(IPv4):(local-part)
319 pattern '^route\-target:' +
320 '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|' +
321 '25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|' +
322 '2[0-4][0-9]|25[0-5]):' +
323 '(6553[0-5]|655[0-2][0-9]|654[0-9]{2}|65[0-4][0-9]{2}' +
324 '|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9])$';
325 }
326 type string {
327 // 4-byte AS Type 1 route-target
328 pattern '^route\-target:' +
329 '(429496729[0-5]|42949672[0-8][0-9]|4294967[0-1][0-9]{2}' +
330 '|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|' +
331 '429[0-3][0-9]{6}|4[0-1][0-9]{7}|[1-3][0-9]{9}|' +
332 '[1-9][0-9]{1,8}|[0-9]):' +
333 '(6553[0-5]|655[0-2][0-9]|654[0-9]{2}|65[0-4][0-9]{2}' +
334 '|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9])$';
335 }
336 type string {
337 // route-origin with Type 1
338 pattern '^route\-origin:' +
339 '(6553[0-5]|655[0-2][0-9]|654[0-9]{2}|65[0-4][0-9]{2}' +
340 '|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9]):' +
341 '(429496729[0-5]|42949672[0-8][0-9]|4294967[0-1][0-9]{2}' +
342 '|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|' +
343 '429[0-3][0-9]{6}|4[0-1][0-9]{7}|[1-3][0-9]{9}|' +
344 '[1-9][0-9]{1,8}|[0-9])$';
345 }
346 type string {
347 // route-origin with Type 2
348 pattern '^route\-origin:' +
349 '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|' +
350 '25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|' +
351 '2[0-4][0-9]|25[0-5]):' +
352 '(6553[0-5]|655[0-2][0-9]|654[0-9]{2}|65[0-4][0-9]{2}' +
353 '|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9])$';
354 }
355 type string {
356 // 4-byte AS Type 1 route-origin
357 pattern '^route\-origin:' +
358 '(429496729[0-5]|42949672[0-8][0-9]|4294967[0-1][0-9]{2}' +
359 '|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|' +
360 '429[0-3][0-9]{6}|4[0-1][0-9]{7}|[1-3][0-9]{9}|' +
361 '[1-9][0-9]{1,8}|[0-9]):' +
362 '(6553[0-5]|655[0-2][0-9]|654[0-9]{2}|65[0-4][0-9]{2}' +
363 '|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9])$';
364 }
365 }
366 description
367 "Type definition for extended community attributes. In the case that
368 common communities are utilised, they are represented as a string
369 of the form:
370 - <2b AS>:<4b value> per RFC4360 section 3.1
371 - <4b IPv4>:<2b value> per RFC4360 section 3.2
372 - <4b AS>:<2b value> per RFC5668 section 2.
373 - route-target:<2b AS>:<4b value> per RFC4360 section 4
374 - route-target:<4b IPv4>:<2b value> per RFC4360 section 4
375 - route-origin:<2b ASN>:<4b value> per RFC4360 section 5
376 - route-origin:<4b IPv4>:<2b value> per RFC4360 section 5";
377 reference
378 "RFC 4360 - BGP Extended Communities Attribute
379 RFC 5668 - 4-Octet AS Specific BGP Extended Community";
380 }
381
382 typedef bgp-ext-community-recv-type {
383 type union {
384 type bgp-ext-community-type;
385 type binary {
386 length 8;
387 }
388 }
389 description
390 "A type definition utilised to define the extended community
391 in a context where the system is receiving the extended
392 community from an external source, such that the value may be
393 unknown. In the case that the received extended community is
394 unknown it is defined to be a 8-octet quantity formatted
395 according to RFC4360:
396
397 Type Field: 1 or 2 octets.
398 Value Field: Remaining octets.
399
400 The high-order octet of the type field is encoded such that
401 bit 0 indicates whether the extended community type is IANA
402 assigned; and bit 1 indicates whether the extended community
403 is transitive. The remaining bits of the high-order type
404 field must be interpreted to determine whether the low-order
405 type field should be parsed, or whether the entire remainder
406 of the extended community is a value.";
407 reference
408 "RFC 4360 - BGP Extended Communities Attribute
409 RFC 5668 - 4-Octet AS Specific BGP Extended Community";
410 }
411
412 typedef bgp-community-regexp-type {
413 // TODO: needs more work to decide what format these regexps can
414 // take.
415 type oc-types:std-regexp;
416 description
417 "Type definition for communities specified as regular
418 expression patterns";
419 }
420
421 typedef bgp-origin-attr-type {
422 type enumeration {
423 enum IGP {
424 description
425 "Origin of the NLRI is internal";
426 }
427 enum EGP {
428 description
429 "Origin of the NLRI is EGP";
430 }
431 enum INCOMPLETE {
432 description
433 "Origin of the NLRI is neither IGP or EGP";
434 }
435 }
436 description
437 "Type definition for standard BGP origin attribute";
438 reference "RFC 4271 - A Border Gateway Protocol 4 (BGP-4),
439 Sec 4.3";
440 }
441
442 typedef peer-type {
443 type enumeration {
444 enum INTERNAL {
445 description
446 "Internal (iBGP) peer";
447 }
448 enum EXTERNAL {
449 description
450 "External (eBGP) peer";
451 }
452 }
453 description
454 "Labels a peer or peer group as explicitly internal or
455 external";
456 }
457
458 identity REMOVE_PRIVATE_AS_OPTION {
459 description
460 "Base identity for options for removing private autonomous
461 system numbers from the AS_PATH attribute";
462 }
463
464 identity PRIVATE_AS_REMOVE_ALL {
465 base REMOVE_PRIVATE_AS_OPTION;
466 description
467 "Strip all private autonmous system numbers from the AS_PATH.
468 This action is performed regardless of the other content of the
469 AS_PATH attribute, and for all instances of private AS numbers
470 within that attribute.";
471 }
472
473 identity PRIVATE_AS_REPLACE_ALL {
474 base REMOVE_PRIVATE_AS_OPTION;
475 description
476 "Replace all instances of private autonomous system numbers in
477 the AS_PATH with the local BGP speaker's autonomous system
478 number. This action is performed regardless of the other
479 content of the AS_PATH attribute, and for all instances of
480 private AS number within that attribute.";
481 }
482
483 typedef remove-private-as-option {
484 type identityref {
485 base REMOVE_PRIVATE_AS_OPTION;
486 }
487 description
488 "Set of options for configuring how private AS path numbers
489 are removed from advertisements";
490 }
491
492 typedef rr-cluster-id-type {
493 type union {
494 type uint32;
495 type oc-inet:ipv4-address;
496 }
497 description
498 "Union type for route reflector cluster ids:
499 option 1: 4-byte number
500 option 2: IP address";
501 }
502
503 typedef community-type {
504 type enumeration {
505 enum STANDARD {
506 description "Send only standard communities";
507 }
508 enum EXTENDED {
509 description "Send only extended communities";
510 }
511 enum BOTH {
512 description "Send both standard and extended communities";
513 }
514 enum NONE {
515 description "Do not send any community attribute";
516 }
517 }
518 description
519 "type describing variations of community attributes:
520 STANDARD: standard BGP community [rfc1997]
521 EXTENDED: extended BGP community [rfc4360]
522 BOTH: both standard and extended community";
523 }
524
525
526 typedef as-path-segment-type {
527 type enumeration {
528 enum AS_SEQ {
529 description
530 "Ordered set of autonomous systems that a route in
531 the UPDATE message has traversed";
532 }
533 enum AS_SET {
534 description
535 "Unordered set of autonomous systems that a route in
536 the UPDATE message has traversed";
537 }
538 enum AS_CONFED_SEQUENCE {
539 description
540 "Ordered set of Member Autonomous
541 Systems in the local confederation that the UPDATE message
542 has traversed";
543 }
544 enum AS_CONFED_SET {
545 description
546 "Unordered set of Member Autonomous Systems
547 in the local confederation that the UPDATE message has
548 traversed";
549 }
550 }
551 description
552 "Defines the types of BGP AS path segments.";
553 }
554}