ietf-routing-types@2017-12-04.yang revision 35799fa6
1module ietf-routing-types {
2
3  namespace "urn:ietf:params:xml:ns:yang:ietf-routing-types";
4  prefix rt-types;
5
6  import ietf-yang-types {
7    prefix yang;
8  }
9  import ietf-inet-types {
10    prefix inet;
11  }
12
13  organization
14    "IETF RTGWG - Routing Area Working Group";
15  contact
16    "WG Web:   <https://datatracker.ietf.org/wg/rtgwg/>
17     WG List:  <mailto:rtgwg@ietf.org>
18
19     Editors:  Xufeng Liu
20               <mailto:Xufeng_Liu@jabail.com>
21               Yingzhen Qu
22               <mailto:yingzhen.qu@huawei.com>
23               Acee Lindem
24               <mailto:acee@cisco.com>
25               Christian Hopps
26               <mailto:chopps@chopps.org>
27               Lou Berger
28               <mailto:lberger@labn.com>";
29
30  description
31    "This module contains a collection of YANG data types
32     considered generally useful for routing protocols.
33
34     Copyright (c) 2017 IETF Trust and the persons
35     identified as authors of the code.  All rights reserved.
36
37     Redistribution and use in source and binary forms, with or
38     without modification, is permitted pursuant to, and subject
39     to the license terms contained in, the Simplified BSD License
40     set forth in Section 4.c of the IETF Trust's Legal Provisions
41     Relating to IETF Documents
42     (https://trustee.ietf.org/license-info).
43
44     This version of this YANG module is part of RFC 8294; see
45     the RFC itself for full legal notices.";
46   revision 2017-12-04 {
47     description "Initial revision.";
48     reference
49       "RFC 8294: Common YANG Data Types for the Routing Area.
50        Section 3.";
51  }
52
53  /*** Identities related to MPLS/GMPLS ***/
54
55  identity mpls-label-special-purpose-value {
56    description
57      "Base identity for deriving identities describing
58       special-purpose Multiprotocol Label Switching (MPLS) label
59       values.";
60    reference
61      "RFC 7274: Allocating and Retiring Special-Purpose MPLS
62       Labels.";
63  }
64
65  identity ipv4-explicit-null-label {
66    base mpls-label-special-purpose-value;
67    description
68      "This identity represents the IPv4 Explicit NULL Label.";
69    reference
70      "RFC 3032: MPLS Label Stack Encoding.  Section 2.1.";
71  }
72
73  identity router-alert-label {
74    base mpls-label-special-purpose-value;
75    description
76      "This identity represents the Router Alert Label.";
77    reference
78      "RFC 3032: MPLS Label Stack Encoding.  Section 2.1.";
79  }
80
81  identity ipv6-explicit-null-label {
82    base mpls-label-special-purpose-value;
83    description
84      "This identity represents the IPv6 Explicit NULL Label.";
85    reference
86      "RFC 3032: MPLS Label Stack Encoding.  Section 2.1.";
87  }
88
89  identity implicit-null-label {
90    base mpls-label-special-purpose-value;
91    description
92      "This identity represents the Implicit NULL Label.";
93    reference
94      "RFC 3032: MPLS Label Stack Encoding.  Section 2.1.";
95  }
96
97  identity entropy-label-indicator {
98    base mpls-label-special-purpose-value;
99    description
100      "This identity represents the Entropy Label Indicator.";
101    reference
102      "RFC 6790: The Use of Entropy Labels in MPLS Forwarding.
103       Sections 3 and 10.1.";
104  }
105
106  identity gal-label {
107    base mpls-label-special-purpose-value;
108    description
109      "This identity represents the Generic Associated Channel
110       (G-ACh) Label (GAL).";
111    reference
112      "RFC 5586: MPLS Generic Associated Channel.
113       Sections 4 and 10.";
114  }
115
116  identity oam-alert-label {
117    base mpls-label-special-purpose-value;
118    description
119      "This identity represents the OAM Alert Label.";
120    reference
121      "RFC 3429: Assignment of the 'OAM Alert Label' for
122       Multiprotocol Label Switching Architecture (MPLS)
123       Operation and Maintenance (OAM) Functions.
124       Sections 3 and 6.";
125  }
126
127  identity extension-label {
128    base mpls-label-special-purpose-value;
129    description
130      "This identity represents the Extension Label.";
131    reference
132      "RFC 7274: Allocating and Retiring Special-Purpose MPLS
133       Labels.  Sections 3.1 and 5.";
134  }
135
136  /*** Collection of types related to routing ***/
137
138  typedef router-id {
139    type yang:dotted-quad;
140    description
141      "A 32-bit number in the dotted-quad format assigned to each
142       router.  This number uniquely identifies the router within
143       an Autonomous System.";
144  }
145
146  /*** Collection of types related to VPNs ***/
147
148  typedef route-target {
149    type string {
150      pattern
151        '(0:(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
152      +     '6[0-4][0-9]{3}|'
153      +     '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0):(429496729[0-5]|'
154      +     '42949672[0-8][0-9]|'
155      +     '4294967[01][0-9]{2}|429496[0-6][0-9]{3}|'
156      +     '42949[0-5][0-9]{4}|'
157      +     '4294[0-8][0-9]{5}|429[0-3][0-9]{6}|'
158      +     '42[0-8][0-9]{7}|4[01][0-9]{8}|'
159      +     '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0))|'
160      + '(1:((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|'
161      +     '25[0-5])\.){3}([0-9]|[1-9][0-9]|'
162      +     '1[0-9]{2}|2[0-4][0-9]|25[0-5])):(6553[0-5]|'
163      +     '655[0-2][0-9]|'
164      +     '65[0-4][0-9]{2}|6[0-4][0-9]{3}|'
165      +     '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
166      + '(2:(429496729[0-5]|42949672[0-8][0-9]|'
167      +     '4294967[01][0-9]{2}|'
168      +     '429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|'
169      +     '4294[0-8][0-9]{5}|'
170      +     '429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|'
171      +     '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0):'
172      +     '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
173      +     '6[0-4][0-9]{3}|'
174      +     '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
175      + '(6(:[a-fA-F0-9]{2}){6})|'
176      + '(([3-57-9a-fA-F]|[1-9a-fA-F][0-9a-fA-F]{1,3}):'
177      +     '[0-9a-fA-F]{1,12})';
178    }
179
180    description
181      "A Route Target is an 8-octet BGP extended community
182       initially identifying a set of sites in a BGP VPN
183       (RFC 4364).  However, it has since taken on a more general
184       role in BGP route filtering.  A Route Target consists of two
185       or three fields: a 2-octet Type field, an administrator
186       field, and, optionally, an assigned number field.
187
188       According to the data formats for types 0, 1, 2, and 6 as
189       defined in RFC 4360, RFC 5668, and RFC 7432, the encoding
190       pattern is defined as:
191
192       0:2-octet-asn:4-octet-number
193       1:4-octet-ipv4addr:2-octet-number
194       2:4-octet-asn:2-octet-number
195       6:6-octet-mac-address
196
197       Additionally, a generic pattern is defined for future
198       Route Target types:
199
200       2-octet-other-hex-number:6-octet-hex-number
201
202       Some valid examples are 0:100:100, 1:1.1.1.1:100,
203       2:1234567890:203, and 6:26:00:08:92:78:00.";
204    reference
205      "RFC 4360: BGP Extended Communities Attribute.
206       RFC 4364: BGP/MPLS IP Virtual Private Networks (VPNs).
207       RFC 5668: 4-Octet AS Specific BGP Extended Community.
208       RFC 7432: BGP MPLS-Based Ethernet VPN.";
209  }
210
211  typedef ipv6-route-target {
212    type string {
213      pattern
214          '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
215          + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
216          + '(((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}'
217          + '(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])))'
218          + ':'
219          + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
220          + '6[0-4][0-9]{3}|'
221          + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)';
222      pattern '((([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
223          + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))'
224          + ':'
225          + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
226          + '6[0-4][0-9]{3}|'
227          + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)';
228    }
229    description
230      "An IPv6 Route Target is a 20-octet BGP IPv6 Address
231       Specific Extended Community serving the same function
232       as a standard 8-octet Route Target, except that it only
233       allows an IPv6 address as the global administrator.
234       The format is <ipv6-address:2-octet-number>.
235
236       Two valid examples are 2001:db8::1:6544 and
237       2001:db8::5eb1:791:6b37:17958.";
238    reference
239      "RFC 5701: IPv6 Address Specific BGP Extended Community
240       Attribute.";
241  }
242
243  typedef route-target-type {
244    type enumeration {
245      enum import {
246        value 0;
247        description
248          "The Route Target applies to route import.";
249      }
250      enum export {
251        value 1;
252        description
253          "The Route Target applies to route export.";
254      }
255
256      enum both {
257        value 2;
258        description
259          "The Route Target applies to both route import and
260           route export.";
261      }
262    }
263    description
264      "Indicates the role a Route Target takes in route filtering.";
265    reference
266      "RFC 4364: BGP/MPLS IP Virtual Private Networks (VPNs).";
267  }
268
269  typedef route-distinguisher {
270    type string {
271      pattern
272        '(0:(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
273      +     '6[0-4][0-9]{3}|'
274      +     '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0):(429496729[0-5]|'
275      +     '42949672[0-8][0-9]|'
276      +     '4294967[01][0-9]{2}|429496[0-6][0-9]{3}|'
277      +     '42949[0-5][0-9]{4}|'
278      +     '4294[0-8][0-9]{5}|429[0-3][0-9]{6}|'
279      +     '42[0-8][0-9]{7}|4[01][0-9]{8}|'
280      +     '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0))|'
281      + '(1:((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|'
282      +     '25[0-5])\.){3}([0-9]|[1-9][0-9]|'
283      +     '1[0-9]{2}|2[0-4][0-9]|25[0-5])):(6553[0-5]|'
284      +     '655[0-2][0-9]|'
285      +     '65[0-4][0-9]{2}|6[0-4][0-9]{3}|'
286      +     '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
287      + '(2:(429496729[0-5]|42949672[0-8][0-9]|'
288      +     '4294967[01][0-9]{2}|'
289      +     '429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|'
290      +     '4294[0-8][0-9]{5}|'
291      +     '429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|'
292      +     '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0):'
293      +     '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
294      +     '6[0-4][0-9]{3}|'
295      +     '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
296      + '(6(:[a-fA-F0-9]{2}){6})|'
297      + '(([3-57-9a-fA-F]|[1-9a-fA-F][0-9a-fA-F]{1,3}):'
298      +     '[0-9a-fA-F]{1,12})';
299    }
300
301    description
302      "A Route Distinguisher is an 8-octet value used to
303       distinguish routes from different BGP VPNs (RFC 4364).
304       A Route Distinguisher will have the same format as a
305       Route Target as per RFC 4360 and will consist of
306       two or three fields: a 2-octet Type field, an administrator
307       field, and, optionally, an assigned number field.
308
309       According to the data formats for types 0, 1, 2, and 6 as
310       defined in RFC 4360, RFC 5668, and RFC 7432, the encoding
311       pattern is defined as:
312
313       0:2-octet-asn:4-octet-number
314       1:4-octet-ipv4addr:2-octet-number
315       2:4-octet-asn:2-octet-number
316       6:6-octet-mac-address
317
318       Additionally, a generic pattern is defined for future
319       route discriminator types:
320
321       2-octet-other-hex-number:6-octet-hex-number
322
323       Some valid examples are 0:100:100, 1:1.1.1.1:100,
324       2:1234567890:203, and 6:26:00:08:92:78:00.";
325    reference
326      "RFC 4360: BGP Extended Communities Attribute.
327       RFC 4364: BGP/MPLS IP Virtual Private Networks (VPNs).
328       RFC 5668: 4-Octet AS Specific BGP Extended Community.
329       RFC 7432: BGP MPLS-Based Ethernet VPN.";
330  }
331
332  typedef route-origin {
333    type string {
334      pattern
335        '(0:(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
336      +     '6[0-4][0-9]{3}|'
337      +     '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0):(429496729[0-5]|'
338      +     '42949672[0-8][0-9]|'
339      +     '4294967[01][0-9]{2}|429496[0-6][0-9]{3}|'
340      +     '42949[0-5][0-9]{4}|'
341      +     '4294[0-8][0-9]{5}|429[0-3][0-9]{6}|'
342      +     '42[0-8][0-9]{7}|4[01][0-9]{8}|'
343      +     '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0))|'
344      + '(1:((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|'
345      +     '25[0-5])\.){3}([0-9]|[1-9][0-9]|'
346      +     '1[0-9]{2}|2[0-4][0-9]|25[0-5])):(6553[0-5]|'
347      +     '655[0-2][0-9]|'
348      +     '65[0-4][0-9]{2}|6[0-4][0-9]{3}|'
349      +     '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
350      + '(2:(429496729[0-5]|42949672[0-8][0-9]|'
351      +     '4294967[01][0-9]{2}|'
352      +     '429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|'
353      +     '4294[0-8][0-9]{5}|'
354      +     '429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|'
355      +     '[1-3][0-9]{9}|[1-9][0-9]{0,8}|0):'
356      +     '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
357      +     '6[0-4][0-9]{3}|'
358      +     '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|'
359      + '(6(:[a-fA-F0-9]{2}){6})|'
360      + '(([3-57-9a-fA-F]|[1-9a-fA-F][0-9a-fA-F]{1,3}):'
361      +    '[0-9a-fA-F]{1,12})';
362    }
363    description
364      "A Route Origin is an 8-octet BGP extended community
365       identifying the set of sites where the BGP route
366       originated (RFC 4364).  A Route Origin will have the same
367       format as a Route Target as per RFC 4360 and will consist
368       of two or three fields: a 2-octet Type field, an
369       administrator field, and, optionally, an assigned number
370       field.
371
372       According to the data formats for types 0, 1, 2, and 6 as
373       defined in RFC 4360, RFC 5668, and RFC 7432, the encoding
374       pattern is defined as:
375
376       0:2-octet-asn:4-octet-number
377       1:4-octet-ipv4addr:2-octet-number
378       2:4-octet-asn:2-octet-number
379       6:6-octet-mac-address
380       Additionally, a generic pattern is defined for future
381       Route Origin types:
382
383       2-octet-other-hex-number:6-octet-hex-number
384
385       Some valid examples are 0:100:100, 1:1.1.1.1:100,
386       2:1234567890:203, and 6:26:00:08:92:78:00.";
387    reference
388      "RFC 4360: BGP Extended Communities Attribute.
389       RFC 4364: BGP/MPLS IP Virtual Private Networks (VPNs).
390       RFC 5668: 4-Octet AS Specific BGP Extended Community.
391       RFC 7432: BGP MPLS-Based Ethernet VPN.";
392  }
393
394  typedef ipv6-route-origin {
395    type string {
396      pattern
397          '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
398          + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
399          + '(((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}'
400          + '(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])))'
401          + ':'
402          + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
403          + '6[0-4][0-9]{3}|'
404          + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)';
405      pattern '((([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
406          + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))'
407          + ':'
408          + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
409          + '6[0-4][0-9]{3}|'
410          + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)';
411    }
412    description
413      "An IPv6 Route Origin is a 20-octet BGP IPv6 Address
414       Specific Extended Community serving the same function
415       as a standard 8-octet route, except that it only allows
416       an IPv6 address as the global administrator.  The format
417       is <ipv6-address:2-octet-number>.
418
419       Two valid examples are 2001:db8::1:6544 and
420       2001:db8::5eb1:791:6b37:17958.";
421    reference
422      "RFC 5701: IPv6 Address Specific BGP Extended Community
423       Attribute.";
424  }
425
426  /*** Collection of types common to multicast ***/
427
428  typedef ipv4-multicast-group-address {
429    type inet:ipv4-address {
430      pattern '(2((2[4-9])|(3[0-9]))\.).*';
431    }
432    description
433      "This type represents an IPv4 multicast group address,
434       which is in the range of 224.0.0.0 to 239.255.255.255.";
435    reference
436      "RFC 1112: Host Extensions for IP Multicasting.";
437  }
438
439  typedef ipv6-multicast-group-address {
440    type inet:ipv6-address {
441      pattern '(([fF]{2}[0-9a-fA-F]{2}):).*';
442    }
443    description
444      "This type represents an IPv6 multicast group address,
445       which is in the range of ff00::/8.";
446    reference
447      "RFC 4291: IP Version 6 Addressing Architecture.  Section 2.7.
448       RFC 7346: IPv6 Multicast Address Scopes.";
449  }
450
451  typedef ip-multicast-group-address {
452    type union {
453      type ipv4-multicast-group-address;
454      type ipv6-multicast-group-address;
455    }
456    description
457      "This type represents a version-neutral IP multicast group
458       address.  The format of the textual representation implies
459       the IP version.";
460  }
461
462  typedef ipv4-multicast-source-address {
463    type union {
464      type enumeration {
465        enum '*' {
466          description
467            "Any source address.";
468        }
469      }
470      type inet:ipv4-address;
471    }
472    description
473      "Multicast source IPv4 address type.";
474  }
475
476  typedef ipv6-multicast-source-address {
477    type union {
478      type enumeration {
479        enum '*' {
480          description
481            "Any source address.";
482        }
483      }
484      type inet:ipv6-address;
485    }
486    description
487      "Multicast source IPv6 address type.";
488  }
489
490  /*** Collection of types common to protocols ***/
491
492  typedef bandwidth-ieee-float32 {
493    type string {
494      pattern
495        '0[xX](0((\.0?)?[pP](\+)?0?|(\.0?))|'
496      + '1(\.([0-9a-fA-F]{0,5}[02468aAcCeE]?)?)?[pP](\+)?(12[0-7]|'
497      + '1[01][0-9]|0?[0-9]?[0-9])?)';
498    }
499    description
500      "Bandwidth in IEEE 754 floating-point 32-bit binary format:
501       (-1)**(S) * 2**(Exponent-127) * (1 + Fraction),
502       where Exponent uses 8 bits and Fraction uses 23 bits.
503       The units are octets per second.
504       The encoding format is the external hexadecimal-significant
505       character sequences specified in IEEE 754 and ISO/IEC C99.
506       The format is restricted to be normalized, non-negative, and
507       non-fraction: 0x1.hhhhhhp{+}d, 0X1.HHHHHHP{+}D, or 0x0p0,
508       where 'h' and 'H' are hexadecimal digits and 'd' and 'D' are
509       integers in the range of [0..127].
510       When six hexadecimal digits are used for 'hhhhhh' or
511       'HHHHHH', the least significant digit must be an even
512       number.  'x' and 'X' indicate hexadecimal; 'p' and 'P'
513       indicate a power of two.  Some examples are 0x0p0, 0x1p10,
514       and 0x1.abcde2p+20.";
515    reference
516      "IEEE Std 754-2008: IEEE Standard for Floating-Point
517       Arithmetic.
518       ISO/IEC C99: Information technology - Programming
519       Languages - C.";
520  }
521
522  typedef link-access-type {
523    type enumeration {
524      enum broadcast {
525        description
526          "Specify broadcast multi-access network.";
527      }
528      enum non-broadcast-multiaccess {
529        description
530          "Specify Non-Broadcast Multi-Access (NBMA) network.";
531      }
532      enum point-to-multipoint {
533        description
534          "Specify point-to-multipoint network.";
535      }
536      enum point-to-point {
537        description
538          "Specify point-to-point network.";
539      }
540    }
541    description
542      "Link access type.";
543  }
544
545  typedef timer-multiplier {
546    type uint8;
547    description
548      "The number of timer value intervals that should be
549       interpreted as a failure.";
550  }
551
552  typedef timer-value-seconds16 {
553    type union {
554      type uint16 {
555        range "1..65535";
556      }
557      type enumeration {
558        enum infinity {
559          description
560            "The timer is set to infinity.";
561        }
562        enum not-set {
563          description
564            "The timer is not set.";
565        }
566      }
567    }
568    units "seconds";
569    description
570      "Timer value type, in seconds (16-bit range).";
571  }
572
573  typedef timer-value-seconds32 {
574    type union {
575      type uint32 {
576        range "1..4294967295";
577      }
578      type enumeration {
579        enum infinity {
580          description
581            "The timer is set to infinity.";
582        }
583        enum not-set {
584          description
585            "The timer is not set.";
586        }
587      }
588    }
589    units "seconds";
590    description
591      "Timer value type, in seconds (32-bit range).";
592  }
593
594  typedef timer-value-milliseconds {
595    type union {
596      type uint32 {
597        range "1..4294967295";
598      }
599      type enumeration {
600        enum infinity {
601          description
602            "The timer is set to infinity.";
603        }
604        enum not-set {
605          description
606            "The timer is not set.";
607        }
608      }
609    }
610    units "milliseconds";
611    description
612      "Timer value type, in milliseconds.";
613  }
614
615  typedef percentage {
616    type uint8 {
617      range "0..100";
618    }
619    description
620      "Integer indicating a percentage value.";
621  }
622
623  typedef timeticks64 {
624    type uint64;
625    description
626      "This type is based on the timeticks type defined in
627       RFC 6991, but with 64-bit width.  It represents the time,
628       modulo 2^64, in hundredths of a second between two epochs.";
629    reference
630      "RFC 6991: Common YANG Data Types.";
631  }
632
633  typedef uint24 {
634    type uint32 {
635      range "0..16777215";
636    }
637    description
638      "24-bit unsigned integer.";
639  }
640
641  /*** Collection of types related to MPLS/GMPLS ***/
642
643  typedef generalized-label {
644    type binary;
645    description
646      "Generalized Label.  Nodes sending and receiving the
647       Generalized Label are aware of the link-specific
648       label context and type.";
649    reference
650      "RFC 3471: Generalized Multi-Protocol Label Switching (GMPLS)
651       Signaling Functional Description.  Section 3.2.";
652  }
653
654  typedef mpls-label-special-purpose {
655    type identityref {
656      base mpls-label-special-purpose-value;
657    }
658    description
659      "This type represents the special-purpose MPLS label values.";
660    reference
661      "RFC 3032: MPLS Label Stack Encoding.
662       RFC 7274: Allocating and Retiring Special-Purpose MPLS
663       Labels.";
664  }
665
666  typedef mpls-label-general-use {
667    type uint32 {
668      range "16..1048575";
669    }
670    description
671      "The 20-bit label value in an MPLS label stack as specified
672       in RFC 3032.  This label value does not include the
673       encodings of Traffic Class and TTL (Time to Live).
674       The label range specified by this type is for general use,
675       with special-purpose MPLS label values excluded.";
676    reference
677      "RFC 3032: MPLS Label Stack Encoding.";
678  }
679
680  typedef mpls-label {
681    type union {
682      type mpls-label-special-purpose;
683      type mpls-label-general-use;
684    }
685    description
686      "The 20-bit label value in an MPLS label stack as specified
687       in RFC 3032.  This label value does not include the
688       encodings of Traffic Class and TTL.";
689    reference
690      "RFC 3032: MPLS Label Stack Encoding.";
691  }
692
693  /*** Groupings **/
694
695  grouping mpls-label-stack {
696    description
697      "This grouping specifies an MPLS label stack.  The label
698       stack is encoded as a list of label stack entries.  The
699       list key is an identifier that indicates the relative
700       ordering of each entry, with the lowest-value identifier
701       corresponding to the top of the label stack.";
702    container mpls-label-stack {
703      description
704        "Container for a list of MPLS label stack entries.";
705      list entry {
706        key "id";
707        description
708          "List of MPLS label stack entries.";
709        leaf id {
710          type uint8;
711          description
712            "Identifies the entry in a sequence of MPLS label
713             stack entries.  An entry with a smaller identifier
714             value precedes an entry with a larger identifier
715             value in the label stack.  The value of this ID has
716             no semantic meaning other than relative ordering
717             and referencing the entry.";
718        }
719        leaf label {
720          type rt-types:mpls-label;
721          description
722            "Label value.";
723        }
724
725        leaf ttl {
726          type uint8;
727          description
728            "Time to Live (TTL).";
729          reference
730            "RFC 3032: MPLS Label Stack Encoding.";
731        }
732        leaf traffic-class {
733          type uint8 {
734            range "0..7";
735          }
736          description
737            "Traffic Class (TC).";
738          reference
739            "RFC 5462: Multiprotocol Label Switching (MPLS) Label
740             Stack Entry: 'EXP' Field Renamed to 'Traffic Class'
741             Field.";
742        }
743      }
744    }
745  }
746
747  grouping vpn-route-targets {
748    description
749      "A grouping that specifies Route Target import-export rules
750       used in BGP-enabled VPNs.";
751    reference
752      "RFC 4364: BGP/MPLS IP Virtual Private Networks (VPNs).
753       RFC 4664: Framework for Layer 2 Virtual Private Networks
754       (L2VPNs).";
755    list vpn-target {
756      key "route-target";
757      description
758        "List of Route Targets.";
759      leaf route-target {
760        type rt-types:route-target;
761        description
762          "Route Target value.";
763      }
764      leaf route-target-type {
765        type rt-types:route-target-type;
766        mandatory true;
767        description
768          "Import/export type of the Route Target.";
769      }
770    }
771  }
772}
773