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: <http://tools.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>";
28 "This module contains a collection of YANG data types
29 considered generally useful for routing protocols.
30 Copyright (c) 2017 IETF Trust and the persons
31 identified as authors of the code. All rights reserved.
32 Redistribution and use in source and binary forms, with or
33 without modification, is permitted pursuant to, and subject
34 to the license terms contained in, the Simplified BSD License
35 set forth in Section 4.c of the IETF Trust's Legal Provisions
36 Relating to IETF Documents
37 (http://trustee.ietf.org/license-info).
38 This version of this YANG module is part of RFC XXXX; see
39 the RFC itself for full legal notices.";
43 description "Initial revision.";
44 reference "RFC TBD: Routing YANG Data Types";
47 /*** Identities related to MPLS/GMPLS ***/
49 identity mpls-label-special-purpose-value {
51 "Base identity for deriving identities describing
52 special-purpose Multiprotocol Label Switching (MPLS) label
55 "RFC7274: Allocating and Retiring Special-Purpose MPLS
59 identity ipv4-explicit-null-label {
60 base mpls-label-special-purpose-value;
62 "This identity represents the IPv4 Explicit NULL Label.";
63 reference "RFC3032: MPLS Label Stack Encoding. Section 2.1.";
66 identity router-alert-label {
67 base mpls-label-special-purpose-value;
69 "This identity represents the Router Alert Label.";
70 reference "RFC3032: MPLS Label Stack Encoding. Section 2.1.";
73 identity ipv6-explicit-null-label {
74 base mpls-label-special-purpose-value;
76 "This identity represents the IPv6 Explicit NULL Label.";
77 reference "RFC3032: MPLS Label Stack Encoding. Section 2.1.";
80 identity implicit-null-label {
81 base mpls-label-special-purpose-value;
83 "This identity represents the Implicit NULL Label.";
84 reference "RFC3032: MPLS Label Stack Encoding. Section 2.1.";
87 identity entropy-label-indicator {
88 base mpls-label-special-purpose-value;
90 "This identity represents the Entropy Label Indicator.";
92 "RFC6790: The Use of Entropy Labels in MPLS Forwarding.
93 Sections 3 and 10.1.";
97 base mpls-label-special-purpose-value;
99 "This identity represents the Generic Associated Channel
102 "RFC5586: MPLS Generic Associated Channel.
106 identity oam-alert-label {
107 base mpls-label-special-purpose-value;
109 "This identity represents the OAM Alert Label.";
111 "RFC3429: Assignment of the 'OAM Alert Label' for
112 Multiprotocol Label Switching Architecture (MPLS)
113 Operation and Maintenance (OAM) Functions.
117 identity extension-label {
118 base mpls-label-special-purpose-value;
120 "This identity represents the Extension Label.";
122 "RFC7274: Allocating and Retiring Special-Purpose MPLS
123 Labels. Sections 3.1 and 5.";
126 /*** Collection of types related to routing ***/
129 type yang:dotted-quad;
131 "A 32-bit number in the dotted quad format assigned to each
132 router. This number uniquely identifies the router within
133 an Autonomous System.";
136 /*** Collection of types related to VPN ***/
138 typedef route-target {
141 '(0:(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
143 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0):(429496729[0-5]|'
144 + '42949672[0-8][0-9]|'
145 + '4294967[01][0-9]{2}|429496[0-6][0-9]{3}|'
146 + '42949[0-5][0-9]{4}|'
147 + '4294[0-8][0-9]{5}|429[0-3][0-9]{6}|'
148 + '42[0-8][0-9]{7}|4[01][0-9]{8}|'
149 + '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0))|'
150 + '(1:((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|'
151 + '25[0-5])\.){3}([0-9]|[1-9][0-9]|'
152 + '1[0-9]{2}|2[0-4][0-9]|25[0-5])):(6553[0-5]|'
154 + '65[0-4][0-9]{2}|6[0-4][0-9]{3}|'
155 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
156 + '(2:(429496729[0-5]|42949672[0-8][0-9]|'
157 + '4294967[01][0-9]{2}|'
158 + '429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|'
159 + '4294[0-8][0-9]{5}|'
160 + '429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|'
161 + '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0):'
162 + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
164 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
165 + '(6(:[a-fA-F0-9]{2}){6})|'
166 + '(([3-57-9a-fA-F]|[1-9a-fA-F][0-9a-fA-F]{1,3}):'
167 + '[0-9a-fA-F]{1,12})';
170 "A route target is an 8-octet BGP extended community
171 initially identifying a set of sites in a BGP
172 VPN (RFC 4364). However, it has since taken on a more
173 general role in BGP route filtering.
174 A route target consists of two or three fields:
175 a 2-octet type field, an administrator field,
176 and, optionally, an assigned number field.
177 According to the data formats for type 0, 1, 2, and 6
178 defined in RFC4360, RFC5668, and RFC7432, the encoding
179 pattern is defined as:
180 0:2-octet-asn:4-octet-number
181 1:4-octet-ipv4addr:2-octet-number
182 2:4-octet-asn:2-octet-number.
183 6:6-octet-mac-address.
184 Additionally, a generic pattern is defined for future
186 2-octet-other-hex-number:6-octet-hex-number
187 Some valid examples are: 0:100:100, 1:1.1.1.1:100,
188 2:1234567890:203 and 6:26:00:08:92:78:00";
190 "RFC4360: BGP Extended Communities Attribute.
191 RFC4364: BGP/MPLS IP Virtual Private Networks (VPNs)
192 RFC5668: 4-Octet AS Specific BGP Extended Community.
193 RFC7432: BGP MPLS-Based Ethernet VPN";
196 typedef ipv6-route-target {
199 '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
200 + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
201 + '(((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}'
202 + '(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])))'
204 + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
206 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)';
207 pattern '((([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
208 + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))'
210 + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
212 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)';
215 "An IPv6 route target is a 20-octet BGP IPv6 address
216 specific extended community serving the same function
217 as a standard 8-octet route target only allowing for
218 an IPv6 address as the global administrator. The format
219 is <ipv6-address:2-octet-number>.
220 Some valid examples are: 2001:DB8::1:6544 and
221 2001:DB8::5eb1:791:6b37:17958";
223 "RFC5701: IPv6 Address Specific BGP Extended Community
227 typedef route-target-type {
232 "The route target applies to route import.";
237 "The route target applies to route export.";
242 "The route target applies to both route import and
247 "Indicates the role a route target takes
248 in route filtering.";
249 reference "RFC4364: BGP/MPLS IP Virtual Private Networks
253 typedef route-distinguisher {
256 '(0:(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
258 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0):(429496729[0-5]|'
259 + '42949672[0-8][0-9]|'
260 + '4294967[01][0-9]{2}|429496[0-6][0-9]{3}|'
261 + '42949[0-5][0-9]{4}|'
262 + '4294[0-8][0-9]{5}|429[0-3][0-9]{6}|'
263 + '42[0-8][0-9]{7}|4[01][0-9]{8}|'
264 + '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0))|'
265 + '(1:((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|'
266 + '25[0-5])\.){3}([0-9]|[1-9][0-9]|'
267 + '1[0-9]{2}|2[0-4][0-9]|25[0-5])):(6553[0-5]|'
269 + '65[0-4][0-9]{2}|6[0-4][0-9]{3}|'
270 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
271 + '(2:(429496729[0-5]|42949672[0-8][0-9]|'
272 + '4294967[01][0-9]{2}|'
273 + '429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|'
274 + '4294[0-8][0-9]{5}|'
275 + '429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|'
276 + '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0):'
277 + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
279 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
280 + '(6(:[a-fA-F0-9]{2}){6})|'
281 + '(([3-57-9a-fA-F]|[1-9a-fA-F][0-9a-fA-F]{1,3}):'
282 + '[0-9a-fA-F]{1,12})';
285 "A route distinguisher is an 8-octet value used to
286 distinguish routes from different BGP VPNs (RFC 4364).
287 As per RFC 4360, a route distinguisher will have the same
288 format as a route target and will consist of two or three
289 fields including a 2-octet type field, an administrator
290 field, and, optionally, an assigned number field.
291 According to the data formats for type 0, 1, 2, and 6
292 defined in RFC4360, RFC5668, and RFC7432, the encoding
293 pattern is defined as:
294 0:2-octet-asn:4-octet-number
295 1:4-octet-ipv4addr:2-octet-number
296 2:4-octet-asn:2-octet-number.
297 6:6-octet-mac-address.
298 Additionally, a generic pattern is defined for future
299 route discriminator types:
300 2-octet-other-hex-number:6-octet-hex-number
301 Some valid examples are: 0:100:100, 1:1.1.1.1:100,
302 2:1234567890:203 and 6:26:00:08:92:78:00";
304 "RFC4360: BGP Extended Communities Attribute.
305 RFC4364: BGP/MPLS IP Virtual Private Networks (VPNs)
306 RFC5668: 4-Octet AS Specific BGP Extended Community.
307 RFC7432: BGP MPLS-Based Ethernet VPN";
310 typedef route-origin {
313 '(0:(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
315 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0):(429496729[0-5]|'
316 + '42949672[0-8][0-9]|'
317 + '4294967[01][0-9]{2}|429496[0-6][0-9]{3}|'
318 + '42949[0-5][0-9]{4}|'
319 + '4294[0-8][0-9]{5}|429[0-3][0-9]{6}|'
320 + '42[0-8][0-9]{7}|4[01][0-9]{8}|'
321 + '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0))|'
322 + '(1:((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|'
323 + '25[0-5])\.){3}([0-9]|[1-9][0-9]|'
324 + '1[0-9]{2}|2[0-4][0-9]|25[0-5])):(6553[0-5]|'
326 + '65[0-4][0-9]{2}|6[0-4][0-9]{3}|'
327 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
328 + '(2:(429496729[0-5]|42949672[0-8][0-9]|'
329 + '4294967[01][0-9]{2}|'
330 + '429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|'
331 + '4294[0-8][0-9]{5}|'
332 + '429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|'
333 + '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0):'
334 + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
336 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
337 + '(6(:[a-fA-F0-9]{2}){6})|'
338 + '(([3-57-9a-fA-F]|[1-9a-fA-F][0-9a-fA-F]{1,3}):'
339 + '[0-9a-fA-F]{1,12})';
342 "A route origin is an 8-octet BGP extended community
343 identifying the set of sites where the BGP route
344 originated (RFC 4364). A route target consists of two
345 or three fields: a 2-octet type field, an administrator
346 field, and, optionally, an assigned number field.
347 According to the data formats for type 0, 1, 2, and 6
348 defined in RFC4360, RFC5668, and RFC7432, the encoding
349 pattern is defined as:
350 0:2-octet-asn:4-octet-number
351 1:4-octet-ipv4addr:2-octet-number
352 2:4-octet-asn:2-octet-number.
353 6:6-octet-mac-address.
354 Additionally, a generic pattern is defined for future
356 2-octet-other-hex-number:6-octet-hex-number
357 Some valid examples are: 0:100:100, 1:1.1.1.1:100,
358 2:1234567890:203 and 6:26:00:08:92:78:00";
360 "RFC4360: BGP Extended Communities Attribute.
361 RFC4364: BGP/MPLS IP Virtual Private Networks (VPNs)
362 RFC5668: 4-Octet AS Specific BGP Extended Community.
363 RFC7432: BGP MPLS-Based Ethernet VPN";
366 typedef ipv6-route-origin {
369 '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
370 + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
371 + '(((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}'
372 + '(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])))'
374 + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
376 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)';
377 pattern '((([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
378 + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))'
380 + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
382 + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)';
385 "An IPv6 route origin is a 20-octet BGP IPv6 address
386 specific extended community serving the same function
387 as a standard 8-octet route only allowing for
388 an IPv6 address as the global administrator. The format
389 is <ipv6-address:2-octet-number>.
390 Some valid examples are: 2001:DB8::1:6544 and
391 2001:DB8::5eb1:791:6b37:17958";
393 "RFC5701: IPv6 Address Specific BGP Extended Community
397 /*** Collection of types common to multicast ***/
399 typedef ipv4-multicast-group-address {
400 type inet:ipv4-address {
401 pattern '(2((2[4-9])|(3[0-9]))\.).*';
404 "This type represents an IPv4 multicast group address,
405 which is in the range from 224.0.0.0 to 239.255.255.255.";
406 reference "RFC1112: Host Extensions for IP Multicasting.";
409 typedef ipv6-multicast-group-address {
410 type inet:ipv6-address {
412 '(([fF]{2}[0-9a-fA-F]{2}):).*';
415 "This type represents an IPv6 multicast group address,
416 which is in the range of FF00::/8.";
418 "RFC4291: IP Version 6 Addressing Architecture. Sec 2.7.
419 RFC7346: IPv6 Multicast Address Scopes.";
422 typedef ip-multicast-group-address {
424 type ipv4-multicast-group-address;
425 type ipv6-multicast-group-address;
428 "This type represents a version-neutral IP multicast group
429 address. The format of the textual representation implies
433 typedef ipv4-multicast-source-address {
438 "Any source address.";
441 type inet:ipv4-address;
444 "Multicast source IPv4 address type.";
447 typedef ipv6-multicast-source-address {
452 "Any source address.";
455 type inet:ipv6-address;
458 "Multicast source IPv6 address type.";
461 /*** Collection of types common to protocols ***/
463 typedef bandwidth-ieee-float32 {
466 '0[xX](0((\.0?)?[pP](\+)?0?|(\.0?))|'
467 + '1(\.([0-9a-fA-F]{0,5}[02468aAcCeE]?)?)?[pP](\+)?(12[0-7]|'
468 + '1[01][0-9]|0?[0-9]?[0-9])?)';
471 "Bandwidth in IEEE 754 floating point 32-bit binary format:
472 (-1)**(S) * 2**(Exponent-127) * (1 + Fraction),
473 where Exponent uses 8 bits, and Fraction uses 23 bits.
474 The units are octets per second.
475 The encoding format is the external hexadecimal-significant
476 character sequences specified in IEEE 754 and C99. The
477 format is restricted to be normalized, non-negative, and
478 non-fraction: 0x1.hhhhhhp{+}d, 0X1.HHHHHHP{+}D, or 0x0p0,
479 where 'h' and 'H' are hexadecimal digits and'd' and 'D' are
480 integers in the range of [0..127].
481 When six hexadecimal digits are used for 'hhhhhh' or
482 'HHHHHH', the least significant digit must be an even
483 number. 'x' and 'X' indicate hexadecimal; 'p' and 'P'
484 indicate power of two. Some examples are: 0x0p0, 0x1p10, and
487 "IEEE Std 754-2008: IEEE Standard for Floating-Point
491 typedef link-access-type {
495 "Specify broadcast multi-access network.";
497 enum "non-broadcast-multiaccess" {
499 "Specify Non-Broadcast Multi-Access (NBMA) network.";
501 enum "point-to-multipoint" {
503 "Specify point-to-multipoint network.";
505 enum "point-to-point" {
507 "Specify point-to-point network.";
514 typedef timer-multiplier {
517 "The number of timer value intervals that should be
518 interpreted as a failure.";
521 typedef timer-value-seconds16 {
529 "The timer is set to infinity.";
533 "The timer is not set.";
539 "Timer value type, in seconds (16-bit range).";
542 typedef timer-value-seconds32 {
545 range "1..4294967295";
550 "The timer is set to infinity.";
554 "The timer is not set.";
560 "Timer value type, in seconds (32-bit range).";
562 typedef timer-value-milliseconds {
565 range "1..4294967295";
570 "The timer is set to infinity.";
574 "The timer is not set.";
578 units "milliseconds";
580 "Timer value type, in milliseconds.";
588 "Integer indicating a percentage value";
591 typedef timeticks64 {
594 "This type is based on the timeticks type defined in
595 RFC 6991, but with 64-bit width. It represents the time,
596 modulo 2^64, in hundredths of a second between two epochs.";
597 reference "RFC 6991 - Common YANG Data Types";
602 range "0 .. 16777215";
605 "24-bit unsigned integer";
608 /*** Collection of types related to MPLS/GMPLS ***/
610 typedef generalized-label {
613 "Generalized label. Nodes sending and receiving the
614 Generalized Label are aware of the link-specific
615 label context and type.";
616 reference "RFC3471: Section 3.2";
619 typedef mpls-label-special-purpose {
621 base mpls-label-special-purpose-value;
624 "This type represents the special-purpose Multiprotocol Label
625 Switching (MPLS) label values.";
627 "RFC3032: MPLS Label Stack Encoding.
628 RFC7274: Allocating and Retiring Special-Purpose MPLS
632 typedef mpls-label-general-use {
637 "The 20-bit label values in an MPLS label stack entry,
638 specified in RFC3032. This label value does not include
639 the encodings of Traffic Class and TTL (time to live).
640 The label range specified by this type is for general use,
641 with special-purpose MPLS label values excluded.";
642 reference "RFC3032: MPLS Label Stack Encoding.";
647 type mpls-label-special-purpose;
648 type mpls-label-general-use;
651 "The 20-bit label values in an MPLS label stack entry,
652 specified in RFC3032. This label value does not include
653 the encodings of Traffic Class and TTL (time to live).";
654 reference "RFC3032: MPLS Label Stack Encoding.";
658 grouping mpls-label-stack {
660 "This grouping specifies an MPLS label stack. The label
661 stack is encoded as a list of label stack entries. The
662 list key is an identifier which indicates relative
663 ordering of each entry, with the lowest value identifier
664 corresponding to the top of the label stack.";
665 container mpls-label-stack {
667 "Container for a list of MPLS label stack entries.";
671 "List of MPLS label stack entries.";
675 "Identifies the entry in a sequence of MPLS label
676 stack entries. An entry with a smaller identifier
677 value precedes an entry with a larger identifier
678 value in the label stack. The value of this ID has
679 no semantic meaning other than relative ordering
680 and referencing the entry.";
683 type rt-types:mpls-label;
690 "Time to Live (TTL).";
691 reference "RFC3032: MPLS Label Stack Encoding.";
698 "Traffic Class (TC).";
700 "RFC5462: Multiprotocol Label Switching (MPLS) Label
701 Stack Entry: 'EXP' Field Renamed to 'Traffic Class'
708 grouping vpn-route-targets {
710 "A grouping that specifies Route Target import-export rules
711 used in the BGP enabled Virtual Private Networks (VPNs).";
713 "RFC4364: BGP/MPLS IP Virtual Private Networks (VPNs).
714 RFC4664: Framework for Layer 2 Virtual Private Networks
719 "List of Route Targets.";
721 type rt-types:route-target;
723 "Route Target value";
725 leaf route-target-type {
726 type rt-types:route-target-type;
729 "Import/export type of the Route Target.";