blob: faf0f286b4daa98389ff3c7edbd09a0677fd4720 [file] [log] [blame]
sonugupta-huawei99b187d2017-12-19 14:20:00 +05301module actn-ietf-routing-types {
2
3 namespace "urn:ietf:params:xml:ns:yang:actn-ietf-routing-types";
4 prefix "rt-types";
5
6 import yrt-ietf-yang-types {
7 prefix "yang";
8 }
9
10 import yrt-ietf-inet-types {
11 prefix "inet";
12 }
13
14 organization "IETF Routing Area Working Group (rtgwg)";
15
16 contact
17 "Routing Area Working Group - <rtgwg@ietf.org>";
18
19 description
20 "This module contains a collection of YANG data types
21 considered generally useful for routing protocols.";
22
23 revision 2017-02-27 {
24 description
25 "Initial revision.";
26 reference
27 "RFC TBD: Routing YANG Data Types";
28 }
29
30 /*** collection of types related to routing ***/
31 typedef router-id {
32 type yang:dotted-quad;
33 description
34 "A 32-bit number in the dotted quad format assigned to each
35 router. This number uniquely identifies the router within an
36 Autonomous System.";
37 }
38
39 // address-family
40 identity address-family {
41 description
42 "Base identity from which identities describing address
43 families are derived.";
44 }
45
46 identity ipv4 {
47 base address-family;
48 description
49 "This identity represents IPv4 address family.";
50 }
51
52 identity ipv6 {
53 base address-family;
54 description
55 "This identity represents IPv6 address family.";
56 }
57
58 //The rest of the values deinfed in the IANA registry
59
60 identity nsap {
61 base address-family;
62 description
63 "Address family from IANA registry.";
64 }
65 identity hdlc {
66 base address-family;
67 description
68 "(8-bit multidrop)
69 Address family from IANA registry.";
70 }
71 identity bbn1822 {
72 base address-family;
73 description
74 "AHIP (BBN report #1822)
75 Address family from IANA registry.";
76 }
77 identity ieee802 {
78 base address-family;
79 description
80 "(includes all 802 media plus Ethernet canonical format)
81 Address family from IANA registry.";
82 }
83 identity e163 {
84 base address-family;
85 description
86 "Address family from IANA registry.";
87 }
88 identity e164 {
89 base address-family;
90 description
91 "SMDS, Frame Relay, ATM
92 Address family from IANA registry.";
93 }
94 identity f69 {
95 base address-family;
96 description
97 "(Telex)
98 Address family from IANA registry.";
99 }
100 identity x121 {
101 base address-family;
102 description
103 "(X.25, Frame Relay)
104 Address family from IANA registry.";
105 }
106 identity ipx {
107 base address-family;
108 description
109 "Address family from IANA registry.";
110 }
111 identity appletalk {
112 base address-family;
113 description
114 "Address family from IANA registry.";
115 }
116 identity decnet-iv {
117 base address-family;
118 description
119 "Decnet IV
120 Address family from IANA registry.";
121 }
122 identity vines {
123 base address-family;
124 description
125 "Banyan Vines
126 Address family from IANA registry.";
127 }
128 identity e164-nsap {
129 base address-family;
130 description
131 "E.164 with NSAP format subaddress
132 Address family from IANA registry.";
133 }
134 identity dns {
135 base address-family;
136 description
137 "Domain Name System
138 Address family from IANA registry.";
139 }
140 identity dn {
141 base address-family;
142 description
143 "Distinguished Name
144 Address family from IANA registry.";
145 }
146 identity as-num {
147 base address-family;
148 description
149 "AS Number
150 Address family from IANA registry.";
151 }
152 identity xtp-v4 {
153 base address-family;
154 description
155 "XTP over IPv4
156 Address family from IANA registry.";
157 }
158 identity xtp-v6 {
159 base address-family;
160 description
161 "XTP over IPv6
162 Address family from IANA registry.";
163 }
164 identity xtp {
165 base address-family;
166 description
167 "XTP native mode XTP
168 Address family from IANA registry.";
169 }
170 identity fc-port {
171 base address-family;
172 description
173 "Fibre Channel World-Wide Port Name
174 Address family from IANA registry.";
175 }
176 identity fc-node {
177 base address-family;
178 description
179 "Fibre Channel World-Wide Node Name
180 Address family from IANA registry.";
181 }
182 identity gwid {
183 base address-family;
184 description
185 "Address family from IANA registry.";
186 }
187 identity l2vpn {
188 base address-family;
189 description
190 "Address family from IANA registry.";
191 }
192 identity mpls-tp-section-eid {
193 base address-family;
194 description
195 "MPLS-TP Section Endpoint Identifier
196 Address family from IANA registry.";
197 }
198 identity mpls-tp-lsp-eid {
199 base address-family;
200 description
201 "MPLS-TP LSP Endpoint Identifier
202 Address family from IANA registry.";
203 }
204 identity mpls-tp-pwe-eid {
205 base address-family;
206 description
207 "MPLS-TP Pseudowire Endpoint Identifier
208 Address family from IANA registry.";
209 }
210 identity mt-v4 {
211 base address-family;
212 description
213 "Multi-Topology IPv4.
214 Address family from IANA registry.";
215 }
216 identity mt-v6 {
217 base address-family;
218 description
219 "Multi-Topology IPv6.
220 Address family from IANA registry.";
221 }
222
223 /*** collection of types related to VPN ***/
224 typedef route-target {
225 type string {
226 pattern
227 '(0:(6553[0-5]|655[0-2]\d|65[0-4]\d{2}|6[0-4]\d{3}|'
228 + '[0-5]?\d{0,3}\d):(429496729[0-5]|42949672[0-8]\d|'
229 + '4294967[01]\d{2}|429496[0-6]\d{3}|42949[0-5]\d{4}|'
230 + '4294[0-8]\d{5}|429[0-3]\d{6}|42[0-8]\d{7}|4[01]\d{8}|'
231 + '[0-3]?\d{0,8}\d))|'
232 + '(1:(((\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|'
233 + '1\d{2}|2[0-4]\d|25[0-5])):(6553[0-5]|655[0-2]\d|'
234 + '65[0-4]\d{2}|6[0-4]\d{3}|[0-5]?\d{0,3}\d))|'
235 + '(2:(429496729[0-5]|42949672[0-8]\d|4294967[01]\d{2}|'
236 + '429496[0-6]\d{3}|42949[0-5]\d{4}|4294[0-8]\d{5}|'
237 + '429[0-3]\d{6}|42[0-8]\d{7}|4[01]\d{8}|[0-3]?\d{0,8}\d):'
238 + '(6553[0-5]|655[0-2]\d|65[0-4]\d{2}|6[0-4]\d{3}|'
239 + '[0-5]?\d{0,3}\d))';
240 }
241 description
242 "A route target is an 8-octet BGP extended community
243 initially identifying a set of sites in a BGP
244 VPN (RFC 4364). However, it has since taken on a more
245 general role in BGP route filtering.
246 A route target consists of three fields:
247 a 2-octet type field, an administrator field,
248 and an assigned number field.
249 According to the data formats for type 0, 1, and 2 defined in
250 RFC4360 and RFC5668, the encoding pattern is defined as:
251
252 0:2-octet-asn:4-octet-number
253 1:4-octet-ipv4addr:2-octet-number
254 2:4-octet-asn:2-octet-number.
255
256 Some valid examples are: 0:100:100, 1:1.1.1.1:100, and
257 2:1234567890:203.";
258 reference
259 "RFC4360: BGP Extended Communities Attribute.
260 RFC5668: 4-Octet AS Specific BGP Extended Community.";
261 }
262
263 typedef route-target-type {
264 type enumeration {
265 enum "import" {
266 value "0";
267 description
268 "The route target applies to route import.";
269 }
270 enum "export" {
271 value "1";
272 description
273 "The route target applies to route export.";
274 }
275 enum "both" {
276 value "2";
277 description
278 "The route target applies to both route import and
279 route export.";
280 }
281 }
282 description
283 "Indicates the role a route target takes
284 in route filtering.";
285 reference
286 "RFC4364: BGP/MPLS IP Virtual Private Networks (VPNs).";
287 }
288
289 typedef route-distinguisher {
290 type string {
291 pattern
292 '(0:(6553[0-5]|655[0-2]\d|65[0-4]\d{2}|6[0-4]\d{3}|'
293 + '[0-5]?\d{0,3}\d):(429496729[0-5]|42949672[0-8]\d|'
294 + '4294967[01]\d{2}|429496[0-6]\d{3}|42949[0-5]\d{4}|'
295 + '4294[0-8]\d{5}|429[0-3]\d{6}|42[0-8]\d{7}|4[01]\d{8}|'
296 + '[0-3]?\d{0,8}\d))|'
297 + '(1:(((\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|'
298 + '1\d{2}|2[0-4]\d|25[0-5])):(6553[0-5]|655[0-2]\d|'
299 + '65[0-4]\d{2}|6[0-4]\d{3}|[0-5]?\d{0,3}\d))|'
300 + '(2:(429496729[0-5]|42949672[0-8]\d|4294967[01]\d{2}|'
301 + '429496[0-6]\d{3}|42949[0-5]\d{4}|4294[0-8]\d{5}|'
302 + '429[0-3]\d{6}|42[0-8]\d{7}|4[01]\d{8}|[0-3]?\d{0,8}\d):'
303 + '(6553[0-5]|655[0-2]\d|65[0-4]\d{2}|6[0-4]\d{3}|'
304 + '[0-5]?\d{0,3}\d))|'
305 + '(([3-9a-fA-F]|[1-9a-fA-F][\da-fA-F]{1,3}):'
306 + '[\da-fA-F]{1,12})';
307 }
308 description
309 "A route distinguisher is an 8-octet value used to distinguish
310 routes from different BGP VPNs (RFC 4364). A route
311 distinguisher consists of three fields: A 2-octet type field,
312 an administrator field, and an assigned number field.
313 According to the data formats for type 0, 1, and 2 defined in
314 RFC4364, the encoding pattern is defined as:
315
316 0:2-octet-asn:4-octet-number
317 1:4-octet-ipv4addr:2-octet-number
318 2:4-octet-asn:2-octet-number.
319 2-octet-other-hex-number:6-octet-hex-number
320
321 Some valid examples are: 0:100:100, 1:1.1.1.1:100, and
322 2:1234567890:203.";
323 reference
324 "RFC4364: BGP/MPLS IP Virtual Private Networks (VPNs).";
325 }
326
327 /*** collection of types common to multicast ***/
328 typedef ipv4-multicast-group-address {
329 type inet:ipv4-address {
330 pattern '(2((2[4-9])|(3[0-9]))\.).*';
331 }
332 description
333 "This type represents an IPv4 multicast group address,
334 which is in the range from 224.0.0.0 to 239.255.255.255.";
335 reference
336 "RFC1112: Host Extensions for IP Multicasting.";
337 }
338
339 typedef ipv6-multicast-group-address {
340 type inet:ipv6-address {
341 pattern
342 '(([fF]{2}[0-9a-fA-F]{2}):).*';
343 }
344 description
345 "This type represents an IPv6 multicast group address,
346 which is in the range of FF00::/8.";
347 reference
348 "RFC4291: IP Version 6 Addressing Architecture. Sec 2.7.
349 RFC7346: IPv6 Multicast Address Scopes.";
350 }
351
352 typedef ip-multicast-group-address {
353 type union {
354 type ipv4-multicast-group-address;
355 type ipv6-multicast-group-address;
356 }
357 description
358 "This type represents an IP multicast group address and is IP
359 version neutral. The format of the textual representation
360 implies the IP version.";
361 }
362
363 typedef ipv4-multicast-source-address {
364 type union {
365 type enumeration {
366 //TODO: FIXME
367 //enum '*' {
368 enum 'any-src-addr' {
369 description
370 "Any source address.";
371 }
372 }
373 type inet:ipv4-address;
374 }
375 description
376 "Multicast source IPv4 address type.";
377 }
378
379 typedef ipv6-multicast-source-address {
380 type union {
381 type enumeration {
382 //TODO: FIXME
383 //enum '*' {
384 enum 'any-src-addr' {
385 description
386 "Any source address.";
387 }
388 }
389 type inet:ipv6-address;
390 }
391 description
392 "Multicast source IPv6 address type.";
393 }
394
395 /*** collection of types common to protocols ***/
396 typedef bandwidth-ieee-float32 {
397 type string {
398 pattern
399 '0[xX](0((\.0?)?[pP](\+)?0?|(\.0?))|'
400 + '1(\.([\da-fA-F]{0,5}[02468aAcCeE]?)?)?[pP](\+)?(12[0-7]|'
401 + '1[01]\d|0?\d?\d)?)';
402 }
403 description
404 "Bandwidth in IEEE 754 floating point 32-bit binary format:
405 (-1)**(S) * 2**(Exponent-127) * (1 + Fraction),
406 where Exponent uses 8 bits, and Fraction uses 23 bits.
407 The units are octets per second.
408 The encoding format is the external hexadecimal-significand
409 character sequences specified in IEEE 754 and C99,
410 restricted to be normalized, non-negative, and non-fraction:
411 0x1.hhhhhhp{+}d or 0X1.HHHHHHP{+}D
412 where 'h' and 'H' are hexadecimal digits, 'd' and 'D' are
413 integers in the range of [0..127].
414 When six hexadecimal digits are used for 'hhhhhh' or 'HHHHHH',
415 the least significant digit must be an even number.
416 'x' and 'X' indicate hexadecimal; 'p' and 'P' indicate power
417 of two.
418 Some examples are: 0x0p0, 0x1p10, and 0x1.abcde2p+20";
419 reference
420 "IEEE Std 754-2008: IEEE Standard for Floating-Point
421 Arithmetic.";
422 }
423
424 typedef link-access-type {
425 type enumeration {
426 enum "broadcast" {
427 description
428 "Specify broadcast multi-access network.";
429 }
430 enum "non-broadcast-multiaccess" {
431 description
432 "Specify Non-Broadcast Multi-Access (NBMA) network.";
433 }
434 enum "point-to-multipoint" {
435 description
436 "Specify point-to-multipoint network.";
437 }
438 enum "point-to-point" {
439 description
440 "Specify point-to-point network.";
441 }
442 }
443 description
444 "Link access type.";
445 }
446
447 typedef timer-multiplier {
448 type uint8;
449 description
450 "The number of timer value intervals that should be
451 interpreted as a failure.";
452 }
453
454 typedef timer-value-seconds16 {
455 type union {
456 type uint16 {
457 range "1..65535";
458 }
459 type enumeration {
460 enum "infinity" {
461 description "The timer is set to infinity.";
462 }
463 enum "not-set" {
464 description "The timer is not set.";
465 }
466 }
467 }
468 units seconds;
469 description "Timer value type, in seconds (16 bit range).";
470 }
471
472 typedef timer-value-seconds32 {
473 type union {
474 type uint32 {
475 range "1..4294967295";
476 }
477 type enumeration {
478 enum "infinity" {
479 description "The timer is set to infinity.";
480 }
481 enum "not-set" {
482 description "The timer is not set.";
483 }
484 }
485 }
486 units seconds;
487 description "Timer value type, in seconds (32 bit range).";
488 }
489
490 typedef timer-value-milliseconds {
491 type union {
492 type uint32{
493 range "1..4294967295";
494 }
495 type enumeration {
496 enum "infinity" {
497 description "The timer is set to infinity.";
498 }
499 enum "not-set" {
500 description "The timer is not set.";
501 }
502 }
503 }
504 units milliseconds;
505 description "Timer value type, in milliseconds.";
506 }
507
508 /*** collection of types related to MPLS/GMPLS ***/
509 typedef generalized-label {
510 type binary;
511 description
512 "Generalized label. Nodes sending and receiving the
513 Generalized Label know the kinds of link they are
514 using. Hence, the Generalized Label does not identify
515 its type. Instead, nodes are expected to know from
516 the context and type of label to expect.";
517 reference "RFC3471: Section 3.2";
518 }
519
520 identity mpls-label-special-purpose-value {
521 description
522 "Base identity for deriving identities describing
523 special-purpose Multiprotocol Label Switching (MPLS) label
524 values.";
525 reference
526 "RFC7274: Allocating and Retiring Special-Purpose MPLS
527 Labels.";
528 }
529
530 identity ipv4-explicit-null-label {
531 base mpls-label-special-purpose-value;
532 description
533 "This identity represents the IPv4 Explicit NULL Label.";
534 reference
535 "RFC3032: MPLS Label Stack Encoding. Section 2.1.";
536 }
537
538 identity router-alert-label {
539 base mpls-label-special-purpose-value;
540 description
541 "This identity represents the Router Alert Label.";
542 reference
543 "RFC3032: MPLS Label Stack Encoding. Section 2.1.";
544 }
545
546 identity ipv6-explicit-null-label {
547 base mpls-label-special-purpose-value;
548 description
549 "This identity represents the IPv6 Explicit NULL Label.";
550 reference
551 "RFC3032: MPLS Label Stack Encoding. Section 2.1.";
552 }
553
554 identity implicit-null-label {
555 base mpls-label-special-purpose-value;
556 description
557 "This identity represents the Implicit NULL Label.";
558 reference
559 "RFC3032: MPLS Label Stack Encoding. Section 2.1.";
560 }
561
562 identity entropy-label-indicator {
563 base mpls-label-special-purpose-value;
564 description
565 "This identity represents the Entropy Label Indicator.";
566 reference
567 "RFC6790: The Use of Entropy Labels in MPLS Forwarding.
568 Sections 3 and 10.1.";
569 }
570
571 identity gal-label {
572 base mpls-label-special-purpose-value;
573 description
574 "This identity represents the Generic Associated Channel Label
575 (GAL).";
576 reference
577 "RFC5586: MPLS Generic Associated Channel.
578 Sections 4 and 10.";
579 }
580
581 identity oam-alert-label {
582 base mpls-label-special-purpose-value;
583 description
584 "This identity represents the OAM Alert Label.";
585 reference
586 "RFC3429: Assignment of the 'OAM Alert Label' for Multiprotocol
587 Label Switching Architecture (MPLS) Operation and Maintenance
588 (OAM) Functions.
589 Sections 3 and 6.";
590 }
591
592 identity extension-label {
593 base mpls-label-special-purpose-value;
594 description
595 "This identity represents the Extension Label.";
596 reference
597 "RFC7274: Allocating and Retiring Special-Purpose MPLS Labels.
598 Sections 3.1 and 5.";
599 }
600
601 typedef mpls-label-special-purpose {
602 type identityref {
603 base mpls-label-special-purpose-value;
604 }
605 description
606 "This type represents the special-purpose Multiprotocol Label
607 Switching (MPLS) label values.";
608 reference
609 "RFC3032: MPLS Label Stack Encoding.
610 RFC7274: Allocating and Retiring Special-Purpose MPLS
611 Labels.";
612 }
613
614 typedef mpls-label-general-use {
615 type uint32 {
616 range "16..1048575";
617 }
618 description
619 "The 20 bits label values in an MPLS label stack entry,
620 specified in RFC3032. This label value does not include
621 the encodings of Traffic Class and TTL (time to live).
622 The label range specified by this type is for general use,
623 with special-purpose MPLS label values excluded.";
624 reference
625 "RFC3032: MPLS Label Stack Encoding.";
626 }
627
628 typedef mpls-label {
629 type union {
630 type mpls-label-special-purpose;
631 type mpls-label-general-use;
632 }
633 description
634 "The 20 bits label values in an MPLS label stack entry,
635 specified in RFC3032. This label value does not include
636 the encodings of Traffic Class and TTL (time to live).";
637 reference
638 "RFC3032: MPLS Label Stack Encoding.";
639 }
640
641 /*
642 * Groupings
643 */
644 grouping mpls-label-stack {
645 description
646 "A grouping that specifies an MPLS label stack.";
647 container mpls-label-stack {
648 description
649 "Container for a list of MPLS label stack entries.";
650 list entry {
651 key "id";
652 description
653 "List of MPLS label stack entries.";
654 leaf id {
655 type uint8;
656 description
657 "Identifies the sequence of an MPLS label stack entries.
658 An entry with smaller ID value is precedes an entry in
659 the label stack with a smaller ID.";
660 }
661 leaf label {
662 type rt-types:mpls-label;
663 description
664 "Label value.";
665 }
666 leaf ttl {
667 type uint8;
668 description
669 "Time to Live (TTL).";
670 reference
671 "RFC3032: MPLS Label Stack Encoding.";
672 }
673 leaf traffic-class {
674 type uint8 {
675 range "0..7";
676 }
677 description
678 "Traffic Class (TC).";
679 reference
680 "RFC5462: Multiprotocol Label Switching (MPLS) Label
681 Stack Entry: 'EXP' Field Renamed to 'Traffic Class'
682 Field.";
683 }
684 }
685 }
686 } // mpls-label-stack
687
688 grouping vpn-route-targets {
689 description
690 "A grouping that specifies Route Target import-export rules
691 used in the BGP enabled Virtual Private Networks (VPNs).";
692 reference
693 "RFC4364: BGP/MPLS IP Virtual Private Networks (VPNs).
694 RFC4664: Framework for Layer 2 Virtual Private Networks
695 (L2VPNs)";
696 list vpn-target {
697 key route-target;
698 description
699 "List of Route Targets.";
700 leaf route-target {
701 type rt-types:route-target;
702 description
703 "Route Target value";
704 }
705 leaf route-target-type {
706 type rt-types:route-target-type;
707 mandatory true;
708 description
709 "Import/export type of the Route Target.";
710 }
711 }
712 } // vpn-route-targets
713}