NonRT-RIC A1 Northbound API
[nonrtric.git] / sdnc-a1-controller / oam / platform-logic / restconfapi-yang / src / main / yang / sotn / ietf-routing-types@2017-10-13.yang
1 module ietf-routing-types {
2   namespace "urn:ietf:params:xml:ns:yang:ietf-routing-types";
3   prefix rt-types;
4
5   import ietf-yang-types {
6     prefix yang;
7   }
8   import ietf-inet-types {
9     prefix inet;
10   }
11
12   organization
13     "IETF RTGWG - Routing Area Working Group";
14   contact
15     "WG Web:   <http://tools.ietf.org/wg/rtgwg/>
16      WG List:  <mailto:rtgwg@ietf.org>
17      Editor:   Xufeng Liu
18                <mailto:Xufeng_Liu@jabail.com>
19                Yingzhen Qu
20                <mailto:yingzhen.qu@huawei.com>
21                Acee Lindem
22                <mailto:acee@cisco.com>
23                Christian Hopps
24                <mailto:chopps@chopps.org>
25                Lou Berger
26                <mailto:lberger@labn.com>";
27   description
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.";
40   reference "RFC XXXX";
41
42   revision 2017-10-13 {
43     description "Initial revision.";
44     reference "RFC TBD: Routing YANG Data Types";
45   }
46
47   /*** Identities related to MPLS/GMPLS ***/
48
49   identity mpls-label-special-purpose-value {
50     description
51       "Base identity for deriving identities describing
52        special-purpose Multiprotocol Label Switching (MPLS) label
53        values.";
54     reference
55       "RFC7274: Allocating and Retiring Special-Purpose MPLS
56        Labels.";
57   }
58
59   identity ipv4-explicit-null-label {
60     base mpls-label-special-purpose-value;
61     description
62       "This identity represents the IPv4 Explicit NULL Label.";
63     reference "RFC3032: MPLS Label Stack Encoding. Section 2.1.";
64   }
65
66   identity router-alert-label {
67     base mpls-label-special-purpose-value;
68     description
69       "This identity represents the Router Alert Label.";
70     reference "RFC3032: MPLS Label Stack Encoding. Section 2.1.";
71   }
72
73   identity ipv6-explicit-null-label {
74     base mpls-label-special-purpose-value;
75     description
76       "This identity represents the IPv6 Explicit NULL Label.";
77     reference "RFC3032: MPLS Label Stack Encoding. Section 2.1.";
78   }
79
80   identity implicit-null-label {
81     base mpls-label-special-purpose-value;
82     description
83       "This identity represents the Implicit NULL Label.";
84     reference "RFC3032: MPLS Label Stack Encoding. Section 2.1.";
85   }
86
87   identity entropy-label-indicator {
88     base mpls-label-special-purpose-value;
89     description
90       "This identity represents the Entropy Label Indicator.";
91     reference
92       "RFC6790: The Use of Entropy Labels in MPLS Forwarding.
93        Sections 3 and 10.1.";
94   }
95
96   identity gal-label {
97     base mpls-label-special-purpose-value;
98     description
99       "This identity represents the Generic Associated Channel
100        Label (GAL).";
101     reference
102       "RFC5586: MPLS Generic Associated Channel.
103        Sections 4 and 10.";
104   }
105
106   identity oam-alert-label {
107     base mpls-label-special-purpose-value;
108     description
109       "This identity represents the OAM Alert Label.";
110     reference
111       "RFC3429: Assignment of the 'OAM Alert Label' for
112        Multiprotocol Label Switching Architecture (MPLS)
113        Operation and Maintenance (OAM) Functions.
114        Sections 3 and 6.";
115   }
116
117   identity extension-label {
118     base mpls-label-special-purpose-value;
119     description
120       "This identity represents the Extension Label.";
121     reference
122       "RFC7274: Allocating and Retiring Special-Purpose MPLS
123        Labels.  Sections 3.1 and 5.";
124   }
125
126   /*** Collection of types related to routing ***/
127
128   typedef router-id {
129     type yang:dotted-quad;
130     description
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.";
134   }
135
136   /*** Collection of types related to VPN ***/
137
138   typedef route-target {
139     type string {
140       pattern
141         '(0:(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
142       +     '6[0-4][0-9]{3}|'
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]|'
153       +     '655[0-2][0-9]|'
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}|'
163       +     '6[0-4][0-9]{3}|'
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})';
168     }
169     description
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
185        route target types:
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";
189     reference
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";
194   }
195
196   typedef ipv6-route-target {
197     type string {
198       pattern
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])))'
203           + ':'
204           + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
205           + '6[0-4][0-9]{3}|'
206           + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)';
207       pattern '((([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
208           + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))'
209           + ':'
210           + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
211           + '6[0-4][0-9]{3}|'
212           + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)';
213     }
214     description
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";
222     reference
223       "RFC5701: IPv6 Address Specific BGP Extended Community
224                 Attribute";
225   }
226
227   typedef route-target-type {
228     type enumeration {
229       enum "import" {
230         value 0;
231         description
232           "The route target applies to route import.";
233       }
234       enum "export" {
235         value 1;
236         description
237           "The route target applies to route export.";
238       }
239       enum "both" {
240         value 2;
241         description
242           "The route target applies to both route import and
243            route export.";
244       }
245     }
246     description
247       "Indicates the role a route target takes
248        in route filtering.";
249     reference "RFC4364: BGP/MPLS IP Virtual Private Networks
250                (VPNs).";
251   }
252
253   typedef route-distinguisher {
254     type string {
255       pattern
256         '(0:(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
257       +     '6[0-4][0-9]{3}|'
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]|'
268       +     '655[0-2][0-9]|'
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}|'
278       +     '6[0-4][0-9]{3}|'
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})';
283     }
284     description
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";
303     reference
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";
308   }
309
310   typedef route-origin {
311     type string {
312       pattern
313         '(0:(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
314       +     '6[0-4][0-9]{3}|'
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]|'
325       +     '655[0-2][0-9]|'
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}|'
335       +     '6[0-4][0-9]{3}|'
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})';
340     }
341     description
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
355        route origin types:
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";
359     reference
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";
364   }
365
366   typedef ipv6-route-origin {
367     type string {
368       pattern
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])))'
373           + ':'
374           + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
375           + '6[0-4][0-9]{3}|'
376           + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)';
377       pattern '((([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
378           + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))'
379           + ':'
380           + '(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|'
381           + '6[0-4][0-9]{3}|'
382           + '[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)';
383     }
384     description
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";
392     reference
393       "RFC5701: IPv6 Address Specific BGP Extended Community
394                 Attribute";
395   }
396
397   /*** Collection of types common to multicast ***/
398
399   typedef ipv4-multicast-group-address {
400     type inet:ipv4-address {
401       pattern '(2((2[4-9])|(3[0-9]))\.).*';
402     }
403     description
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.";
407   }
408
409   typedef ipv6-multicast-group-address {
410     type inet:ipv6-address {
411       pattern
412         '(([fF]{2}[0-9a-fA-F]{2}):).*';
413     }
414     description
415       "This type represents an IPv6 multicast group address,
416        which is in the range of FF00::/8.";
417     reference
418       "RFC4291: IP Version 6 Addressing Architecture. Sec 2.7.
419        RFC7346: IPv6 Multicast Address Scopes.";
420   }
421
422   typedef ip-multicast-group-address {
423     type union {
424       type ipv4-multicast-group-address;
425       type ipv6-multicast-group-address;
426     }
427     description
428       "This type represents a version-neutral IP multicast group
429        address. The format of the textual representation implies
430        the IP version.";
431   }
432
433   typedef ipv4-multicast-source-address {
434     type union {
435       type enumeration {
436         enum "*" {
437           description
438             "Any source address.";
439         }
440       }
441       type inet:ipv4-address;
442     }
443     description
444       "Multicast source IPv4 address type.";
445   }
446
447   typedef ipv6-multicast-source-address {
448     type union {
449       type enumeration {
450         enum "*" {
451           description
452             "Any source address.";
453         }
454       }
455       type inet:ipv6-address;
456     }
457     description
458       "Multicast source IPv6 address type.";
459   }
460
461   /*** Collection of types common to protocols ***/
462
463   typedef bandwidth-ieee-float32 {
464     type string {
465       pattern
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])?)';
469     }
470     description
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
485        0x1.abcde2p+20";
486     reference
487       "IEEE Std 754-2008: IEEE Standard for Floating-Point
488        Arithmetic.";
489   }
490
491   typedef link-access-type {
492     type enumeration {
493       enum "broadcast" {
494         description
495           "Specify broadcast multi-access network.";
496       }
497       enum "non-broadcast-multiaccess" {
498         description
499           "Specify Non-Broadcast Multi-Access (NBMA) network.";
500       }
501       enum "point-to-multipoint" {
502         description
503           "Specify point-to-multipoint network.";
504       }
505       enum "point-to-point" {
506         description
507           "Specify point-to-point network.";
508       }
509     }
510     description
511       "Link access type.";
512   }
513
514   typedef timer-multiplier {
515     type uint8;
516     description
517       "The number of timer value intervals that should be
518        interpreted as a failure.";
519   }
520
521   typedef timer-value-seconds16 {
522     type union {
523       type uint16 {
524         range "1..65535";
525       }
526       type enumeration {
527         enum "infinity" {
528           description
529             "The timer is set to infinity.";
530         }
531         enum "not-set" {
532           description
533             "The timer is not set.";
534         }
535       }
536     }
537     units "seconds";
538     description
539       "Timer value type, in seconds (16-bit range).";
540   }
541
542   typedef timer-value-seconds32 {
543     type union {
544       type uint32 {
545         range "1..4294967295";
546       }
547       type enumeration {
548         enum "infinity" {
549           description
550             "The timer is set to infinity.";
551         }
552         enum "not-set" {
553           description
554             "The timer is not set.";
555         }
556       }
557     }
558     units "seconds";
559     description
560       "Timer value type, in seconds (32-bit range).";
561   }
562   typedef timer-value-milliseconds {
563     type union {
564       type uint32 {
565         range "1..4294967295";
566       }
567       type enumeration {
568         enum "infinity" {
569           description
570             "The timer is set to infinity.";
571         }
572         enum "not-set" {
573           description
574             "The timer is not set.";
575         }
576       }
577     }
578     units "milliseconds";
579     description
580       "Timer value type, in milliseconds.";
581   }
582
583   typedef percentage {
584     type uint8 {
585       range "0..100";
586     }
587     description
588       "Integer indicating a percentage value";
589   }
590
591   typedef timeticks64 {
592     type uint64;
593     description
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";
598   }
599
600   typedef uint24 {
601     type uint32 {
602       range "0 .. 16777215";
603     }
604     description
605       "24-bit unsigned integer";
606   }
607
608   /*** Collection of types related to MPLS/GMPLS ***/
609
610   typedef generalized-label {
611     type binary;
612     description
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";
617   }
618
619   typedef mpls-label-special-purpose {
620     type identityref {
621       base mpls-label-special-purpose-value;
622     }
623     description
624       "This type represents the special-purpose Multiprotocol Label
625        Switching (MPLS) label values.";
626     reference
627       "RFC3032: MPLS Label Stack Encoding.
628        RFC7274: Allocating and Retiring Special-Purpose MPLS
629        Labels.";
630   }
631
632   typedef mpls-label-general-use {
633     type uint32 {
634       range "16..1048575";
635     }
636     description
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.";
643   }
644
645   typedef mpls-label {
646     type union {
647       type mpls-label-special-purpose;
648       type mpls-label-general-use;
649     }
650     description
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.";
655   }
656
657   /*** Groupings **/
658   grouping mpls-label-stack {
659     description
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 {
666       description
667         "Container for a list of MPLS label stack entries.";
668       list entry {
669         key "id";
670         description
671           "List of MPLS label stack entries.";
672         leaf id {
673           type uint8;
674           description
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.";
681         }
682         leaf label {
683           type rt-types:mpls-label;
684           description
685             "Label value.";
686         }
687         leaf ttl {
688           type uint8;
689           description
690             "Time to Live (TTL).";
691           reference "RFC3032: MPLS Label Stack Encoding.";
692         }
693         leaf traffic-class {
694           type uint8 {
695             range "0..7";
696           }
697           description
698             "Traffic Class (TC).";
699           reference
700             "RFC5462: Multiprotocol Label Switching (MPLS) Label
701              Stack Entry: 'EXP' Field Renamed to 'Traffic Class'
702              Field.";
703         }
704       }
705     }
706   }
707
708   grouping vpn-route-targets {
709     description
710       "A grouping that specifies Route Target import-export rules
711        used in the BGP enabled Virtual Private Networks (VPNs).";
712     reference
713       "RFC4364: BGP/MPLS IP Virtual Private Networks (VPNs).
714        RFC4664: Framework for Layer 2 Virtual Private Networks
715        (L2VPNs)";
716     list vpn-target {
717       key "route-target";
718       description
719         "List of Route Targets.";
720       leaf route-target {
721         type rt-types:route-target;
722         description
723           "Route Target value";
724       }
725       leaf route-target-type {
726         type rt-types:route-target-type;
727         mandatory true;
728         description
729           "Import/export type of the Route Target.";
730       }
731     }
732   }
733 }