1 module ietf-routing-types {
2 namespace "urn:ietf:params:xml:ns:yang:ietf-routing-types";
5 import ietf-yang-types {
8 import ietf-inet-types {
13 "IETF RTGWG - Routing Area Working Group";
15 "WG Web: <https://datatracker.ietf.org/wg/rtgwg/>
16 WG List: <mailto:rtgwg@ietf.org>
18 <mailto:Xufeng_Liu@jabail.com>
20 <mailto:yingzhen.qu@huawei.com>
22 <mailto:acee@cisco.com>
24 <mailto:chopps@chopps.org>
26 <mailto:lberger@labn.com>";
29 "This module contains a collection of YANG data types
30 considered generally useful for routing protocols.
31 Copyright (c) 2017 IETF Trust and the persons
32 identified as authors of the code. All rights reserved.
33 Redistribution and use in source and binary forms, with or
34 without modification, is permitted pursuant to, and subject
35 to the license terms contained in, the Simplified BSD License
36 set forth in Section 4.c of the IETF Trust's Legal Provisions
37 Relating to IETF Documents
38 (https://trustee.ietf.org/license-info).
39 This version of this YANG module is part of RFC 8294; see
40 the RFC itself for full legal notices.";
42 description "Initial revision.";
44 "RFC 8294: Common YANG Data Types for the Routing Area.
48 /*** Identities related to MPLS/GMPLS ***/
50 identity mpls-label-special-purpose-value {
52 "Base identity for deriving identities describing
53 special-purpose Multiprotocol Label Switching (MPLS) label
56 "RFC 7274: Allocating and Retiring Special-Purpose MPLS
60 identity ipv4-explicit-null-label {
61 base mpls-label-special-purpose-value;
63 "This identity represents the IPv4 Explicit NULL Label.";
65 "RFC 3032: MPLS Label Stack Encoding. Section 2.1.";
68 identity router-alert-label {
69 base mpls-label-special-purpose-value;
71 "This identity represents the Router Alert Label.";
73 "RFC 3032: MPLS Label Stack Encoding. Section 2.1.";
76 identity ipv6-explicit-null-label {
77 base mpls-label-special-purpose-value;
79 "This identity represents the IPv6 Explicit NULL Label.";
81 "RFC 3032: MPLS Label Stack Encoding. Section 2.1.";
84 identity implicit-null-label {
85 base mpls-label-special-purpose-value;
87 "This identity represents the Implicit NULL Label.";
89 "RFC 3032: MPLS Label Stack Encoding. Section 2.1.";
92 identity entropy-label-indicator {
93 base mpls-label-special-purpose-value;
95 "This identity represents the Entropy Label Indicator.";
97 "RFC 6790: The Use of Entropy Labels in MPLS Forwarding.
98 Sections 3 and 10.1.";
102 base mpls-label-special-purpose-value;
104 "This identity represents the Generic Associated Channel
105 (G-ACh) Label (GAL).";
107 "RFC 5586: MPLS Generic Associated Channel.
111 identity oam-alert-label {
112 base mpls-label-special-purpose-value;
114 "This identity represents the OAM Alert Label.";
116 "RFC 3429: Assignment of the 'OAM Alert Label' for
117 Multiprotocol Label Switching Architecture (MPLS)
118 Operation and Maintenance (OAM) Functions.
122 identity extension-label {
123 base mpls-label-special-purpose-value;
125 "This identity represents the Extension Label.";
127 "RFC 7274: Allocating and Retiring Special-Purpose MPLS
128 Labels. Sections 3.1 and 5.";
131 /*** Collection of types related to routing ***/
134 type yang:dotted-quad;
136 "A 32-bit number in the dotted-quad format assigned to each
137 router. This number uniquely identifies the router within
138 an Autonomous System.";
141 /*** Collection of types related to VPNs ***/
143 typedef route-target {
146 '(0:(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
148 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0):(429496729[0-5]|'
149 + '42949672[0-8][0-9]|'
150 + '4294967[01][0-9]{2}|429496[0-6][0-9]{3}|'
151 + '42949[0-5][0-9]{4}|'
152 + '4294[0-8][0-9]{5}|429[0-3][0-9]{6}|'
153 + '42[0-8][0-9]{7}|4[01][0-9]{8}|'
154 + '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0))|'
155 + '(1:((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|'
156 + '25[0-5])\.){3}([0-9]|[1-9][0-9]|'
157 + '1[0-9]{2}|2[0-4][0-9]|25[0-5])):(6553[0-5]|'
159 + '65[0-4][0-9]{2}|6[0-4][0-9]{3}|'
160 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
161 + '(2:(429496729[0-5]|42949672[0-8][0-9]|'
162 + '4294967[01][0-9]{2}|'
163 + '429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|'
164 + '4294[0-8][0-9]{5}|'
165 + '429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|'
166 + '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0):'
167 + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
169 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
170 + '(6(:[a-fA-F0-9]{2}){6})|'
171 + '(([3-57-9a-fA-F]|[1-9a-fA-F][0-9a-fA-F]{1,3}):'
172 + '[0-9a-fA-F]{1,12})';
176 "A Route Target is an 8-octet BGP extended community
177 initially identifying a set of sites in a BGP VPN
178 (RFC 4364). However, it has since taken on a more general
179 role in BGP route filtering. A Route Target consists of two
180 or three fields: a 2-octet Type field, an administrator
181 field, and, optionally, an assigned number field.
182 According to the data formats for types 0, 1, 2, and 6 as
183 defined in RFC 4360, RFC 5668, and RFC 7432, the encoding
184 pattern is defined as:
185 0:2-octet-asn:4-octet-number
186 1:4-octet-ipv4addr:2-octet-number
187 2:4-octet-asn:2-octet-number
188 6:6-octet-mac-address
189 Additionally, a generic pattern is defined for future
191 2-octet-other-hex-number:6-octet-hex-number
192 Some valid examples are 0:100:100, 1:1.1.1.1:100,
193 2:1234567890:203, and 6:26:00:08:92:78:00.";
195 "RFC 4360: BGP Extended Communities Attribute.
196 RFC 4364: BGP/MPLS IP Virtual Private Networks (VPNs).
197 RFC 5668: 4-Octet AS Specific BGP Extended Community.
198 RFC 7432: BGP MPLS-Based Ethernet VPN.";
201 typedef ipv6-route-target {
204 '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
205 + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
206 + '(((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}'
207 + '(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])))'
209 + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
211 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)';
212 pattern '((([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
213 + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))'
215 + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
217 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)';
220 "An IPv6 Route Target is a 20-octet BGP IPv6 Address
221 Specific Extended Community serving the same function
222 as a standard 8-octet Route Target, except that it only
223 allows an IPv6 address as the global administrator.
224 The format is <ipv6-address:2-octet-number>.
225 Two valid examples are 2001:db8::1:6544 and
226 2001:db8::5eb1:791:6b37:17958.";
228 "RFC 5701: IPv6 Address Specific BGP Extended Community
232 typedef route-target-type {
237 "The Route Target applies to route import.";
242 "The Route Target applies to route export.";
248 "The Route Target applies to both route import and
253 "Indicates the role a Route Target takes in route filtering.";
255 "RFC 4364: BGP/MPLS IP Virtual Private Networks (VPNs).";
258 typedef route-distinguisher {
261 '(0:(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
263 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0):(429496729[0-5]|'
264 + '42949672[0-8][0-9]|'
265 + '4294967[01][0-9]{2}|429496[0-6][0-9]{3}|'
266 + '42949[0-5][0-9]{4}|'
267 + '4294[0-8][0-9]{5}|429[0-3][0-9]{6}|'
268 + '42[0-8][0-9]{7}|4[01][0-9]{8}|'
269 + '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0))|'
270 + '(1:((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|'
271 + '25[0-5])\.){3}([0-9]|[1-9][0-9]|'
272 + '1[0-9]{2}|2[0-4][0-9]|25[0-5])):(6553[0-5]|'
274 + '65[0-4][0-9]{2}|6[0-4][0-9]{3}|'
275 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
276 + '(2:(429496729[0-5]|42949672[0-8][0-9]|'
277 + '4294967[01][0-9]{2}|'
278 + '429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|'
279 + '4294[0-8][0-9]{5}|'
280 + '429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|'
281 + '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0):'
282 + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
284 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
285 + '(6(:[a-fA-F0-9]{2}){6})|'
286 + '(([3-57-9a-fA-F]|[1-9a-fA-F][0-9a-fA-F]{1,3}):'
287 + '[0-9a-fA-F]{1,12})';
291 "A Route Distinguisher is an 8-octet value used to
292 distinguish routes from different BGP VPNs (RFC 4364).
293 A Route Distinguisher will have the same format as a
294 Route Target as per RFC 4360 and will consist of
295 two or three fields: a 2-octet Type field, an administrator
296 field, and, optionally, an assigned number field.
297 According to the data formats for types 0, 1, 2, and 6 as
298 defined in RFC 4360, RFC 5668, and RFC 7432, the encoding
299 pattern is defined as:
300 0:2-octet-asn:4-octet-number
301 1:4-octet-ipv4addr:2-octet-number
302 2:4-octet-asn:2-octet-number
303 6:6-octet-mac-address
304 Additionally, a generic pattern is defined for future
305 route discriminator types:
306 2-octet-other-hex-number:6-octet-hex-number
307 Some valid examples are 0:100:100, 1:1.1.1.1:100,
308 2:1234567890:203, and 6:26:00:08:92:78:00.";
310 "RFC 4360: BGP Extended Communities Attribute.
311 RFC 4364: BGP/MPLS IP Virtual Private Networks (VPNs).
312 RFC 5668: 4-Octet AS Specific BGP Extended Community.
313 RFC 7432: BGP MPLS-Based Ethernet VPN.";
316 typedef route-origin {
319 '(0:(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
321 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0):(429496729[0-5]|'
322 + '42949672[0-8][0-9]|'
323 + '4294967[01][0-9]{2}|429496[0-6][0-9]{3}|'
324 + '42949[0-5][0-9]{4}|'
325 + '4294[0-8][0-9]{5}|429[0-3][0-9]{6}|'
326 + '42[0-8][0-9]{7}|4[01][0-9]{8}|'
327 + '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0))|'
328 + '(1:((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|'
329 + '25[0-5])\.){3}([0-9]|[1-9][0-9]|'
330 + '1[0-9]{2}|2[0-4][0-9]|25[0-5])):(6553[0-5]|'
332 + '65[0-4][0-9]{2}|6[0-4][0-9]{3}|'
333 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
334 + '(2:(429496729[0-5]|42949672[0-8][0-9]|'
335 + '4294967[01][0-9]{2}|'
336 + '429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|'
337 + '4294[0-8][0-9]{5}|'
338 + '429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|'
339 + '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0):'
340 + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
342 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
343 + '(6(:[a-fA-F0-9]{2}){6})|'
344 + '(([3-57-9a-fA-F]|[1-9a-fA-F][0-9a-fA-F]{1,3}):'
345 + '[0-9a-fA-F]{1,12})';
348 "A Route Origin is an 8-octet BGP extended community
349 identifying the set of sites where the BGP route
350 originated (RFC 4364). A Route Origin will have the same
351 format as a Route Target as per RFC 4360 and will consist
352 of two or three fields: a 2-octet Type field, an
353 administrator field, and, optionally, an assigned number
355 According to the data formats for types 0, 1, 2, and 6 as
356 defined in RFC 4360, RFC 5668, and RFC 7432, the encoding
357 pattern is defined as:
358 0:2-octet-asn:4-octet-number
359 1:4-octet-ipv4addr:2-octet-number
360 2:4-octet-asn:2-octet-number
361 6:6-octet-mac-address
362 Additionally, a generic pattern is defined for future
364 2-octet-other-hex-number:6-octet-hex-number
365 Some valid examples are 0:100:100, 1:1.1.1.1:100,
366 2:1234567890:203, and 6:26:00:08:92:78:00.";
368 "RFC 4360: BGP Extended Communities Attribute.
369 RFC 4364: BGP/MPLS IP Virtual Private Networks (VPNs).
370 RFC 5668: 4-Octet AS Specific BGP Extended Community.
371 RFC 7432: BGP MPLS-Based Ethernet VPN.";
374 typedef ipv6-route-origin {
377 '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
378 + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
379 + '(((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}'
380 + '(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])))'
382 + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
384 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)';
385 pattern '((([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
386 + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))'
388 + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
390 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)';
393 "An IPv6 Route Origin is a 20-octet BGP IPv6 Address
394 Specific Extended Community serving the same function
395 as a standard 8-octet route, except that it only allows
396 an IPv6 address as the global administrator. The format
397 is <ipv6-address:2-octet-number>.
398 Two valid examples are 2001:db8::1:6544 and
399 2001:db8::5eb1:791:6b37:17958.";
401 "RFC 5701: IPv6 Address Specific BGP Extended Community
405 /*** Collection of types common to multicast ***/
407 typedef ipv4-multicast-group-address {
408 type inet:ipv4-address {
409 pattern '(2((2[4-9])|(3[0-9]))\.).*';
412 "This type represents an IPv4 multicast group address,
413 which is in the range of 224.0.0.0 to 239.255.255.255.";
415 "RFC 1112: Host Extensions for IP Multicasting.";
418 typedef ipv6-multicast-group-address {
419 type inet:ipv6-address {
420 pattern '(([fF]{2}[0-9a-fA-F]{2}):).*';
423 "This type represents an IPv6 multicast group address,
424 which is in the range of ff00::/8.";
426 "RFC 4291: IP Version 6 Addressing Architecture. Section 2.7.
427 RFC 7346: IPv6 Multicast Address Scopes.";
430 typedef ip-multicast-group-address {
432 type ipv4-multicast-group-address;
433 type ipv6-multicast-group-address;
436 "This type represents a version-neutral IP multicast group
437 address. The format of the textual representation implies
441 typedef ipv4-multicast-source-address {
446 "Any source address.";
449 type inet:ipv4-address;
452 "Multicast source IPv4 address type.";
455 typedef ipv6-multicast-source-address {
460 "Any source address.";
463 type inet:ipv6-address;
466 "Multicast source IPv6 address type.";
469 /*** Collection of types common to protocols ***/
471 typedef bandwidth-ieee-float32 {
474 '0[xX](0((\.0?)?[pP](\+)?0?|(\.0?))|'
475 + '1(\.([0-9a-fA-F]{0,5}[02468aAcCeE]?)?)?[pP](\+)?(12[0-7]|'
476 + '1[01][0-9]|0?[0-9]?[0-9])?)';
479 "Bandwidth in IEEE 754 floating-point 32-bit binary format:
480 (-1)**(S) * 2**(Exponent-127) * (1 + Fraction),
481 where Exponent uses 8 bits and Fraction uses 23 bits.
482 The units are octets per second.
483 The encoding format is the external hexadecimal-significant
484 character sequences specified in IEEE 754 and ISO/IEC C99.
485 The format is restricted to be normalized, non-negative, and
486 non-fraction: 0x1.hhhhhhp{+}d, 0X1.HHHHHHP{+}D, or 0x0p0,
487 where 'h' and 'H' are hexadecimal digits and 'd' and 'D' are
488 integers in the range of [0..127].
489 When six hexadecimal digits are used for 'hhhhhh' or
490 'HHHHHH', the least significant digit must be an even
491 number. 'x' and 'X' indicate hexadecimal; 'p' and 'P'
492 indicate a power of two. Some examples are 0x0p0, 0x1p10,
493 and 0x1.abcde2p+20.";
495 "IEEE Std 754-2008: IEEE Standard for Floating-Point
497 ISO/IEC C99: Information technology - Programming
501 typedef link-access-type {
505 "Specify broadcast multi-access network.";
507 enum non-broadcast-multiaccess {
509 "Specify Non-Broadcast Multi-Access (NBMA) network.";
511 enum point-to-multipoint {
513 "Specify point-to-multipoint network.";
515 enum point-to-point {
517 "Specify point-to-point network.";
524 typedef timer-multiplier {
527 "The number of timer value intervals that should be
528 interpreted as a failure.";
531 typedef timer-value-seconds16 {
539 "The timer is set to infinity.";
543 "The timer is not set.";
549 "Timer value type, in seconds (16-bit range).";
552 typedef timer-value-seconds32 {
555 range "1..4294967295";
560 "The timer is set to infinity.";
564 "The timer is not set.";
570 "Timer value type, in seconds (32-bit range).";
573 typedef timer-value-milliseconds {
576 range "1..4294967295";
581 "The timer is set to infinity.";
585 "The timer is not set.";
589 units "milliseconds";
591 "Timer value type, in milliseconds.";
599 "Integer indicating a percentage value.";
602 typedef timeticks64 {
605 "This type is based on the timeticks type defined in
606 RFC 6991, but with 64-bit width. It represents the time,
607 modulo 2^64, in hundredths of a second between two epochs.";
609 "RFC 6991: Common YANG Data Types.";
617 "24-bit unsigned integer.";
620 /*** Collection of types related to MPLS/GMPLS ***/
622 typedef generalized-label {
625 "Generalized Label. Nodes sending and receiving the
626 Generalized Label are aware of the link-specific
627 label context and type.";
629 "RFC 3471: Generalized Multi-Protocol Label Switching (GMPLS)
630 Signaling Functional Description. Section 3.2.";
633 typedef mpls-label-special-purpose {
635 base mpls-label-special-purpose-value;
638 "This type represents the special-purpose MPLS label values.";
640 "RFC 3032: MPLS Label Stack Encoding.
641 RFC 7274: Allocating and Retiring Special-Purpose MPLS
645 typedef mpls-label-general-use {
650 "The 20-bit label value in an MPLS label stack as specified
651 in RFC 3032. This label value does not include the
652 encodings of Traffic Class and TTL (Time to Live).
653 The label range specified by this type is for general use,
654 with special-purpose MPLS label values excluded.";
656 "RFC 3032: MPLS Label Stack Encoding.";
661 type mpls-label-special-purpose;
662 type mpls-label-general-use;
665 "The 20-bit label value in an MPLS label stack as specified
666 in RFC 3032. This label value does not include the
667 encodings of Traffic Class and TTL.";
669 "RFC 3032: MPLS Label Stack Encoding.";
674 grouping mpls-label-stack {
676 "This grouping specifies an MPLS label stack. The label
677 stack is encoded as a list of label stack entries. The
678 list key is an identifier that indicates the relative
679 ordering of each entry, with the lowest-value identifier
680 corresponding to the top of the label stack.";
681 container mpls-label-stack {
683 "Container for a list of MPLS label stack entries.";
687 "List of MPLS label stack entries.";
691 "Identifies the entry in a sequence of MPLS label
692 stack entries. An entry with a smaller identifier
693 value precedes an entry with a larger identifier
694 value in the label stack. The value of this ID has
695 no semantic meaning other than relative ordering
696 and referencing the entry.";
699 type rt-types:mpls-label;
707 "Time to Live (TTL).";
709 "RFC 3032: MPLS Label Stack Encoding.";
716 "Traffic Class (TC).";
718 "RFC 5462: Multiprotocol Label Switching (MPLS) Label
719 Stack Entry: 'EXP' Field Renamed to 'Traffic Class'
726 grouping vpn-route-targets {
728 "A grouping that specifies Route Target import-export rules
729 used in BGP-enabled VPNs.";
731 "RFC 4364: BGP/MPLS IP Virtual Private Networks (VPNs).
732 RFC 4664: Framework for Layer 2 Virtual Private Networks
737 "List of Route Targets.";
739 type rt-types:route-target;
741 "Route Target value.";
743 leaf route-target-type {
744 type rt-types:route-target-type;
747 "Import/export type of the Route Target.";