summaryrefslogtreecommitdiffstats
path: root/mpls/api/src/main/yang/hc2vpp-ietf-routing-types@2017-02-27.yang
blob: b39357ae2f417d8201061d938df6ca272273073b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
module hc2vpp-ietf-routing-types {

  namespace "urn:ietf:params:xml:ns:yang:ietf-routing-types";
  prefix "rt-types";

  import ietf-yang-types {
    prefix "yang";
  }

  import ietf-inet-types {
    prefix "inet";
  }

  organization "IETF Routing Area Working Group (rtgwg)";

  contact
      "Routing Area Working Group - <rtgwg@ietf.org>";

  description
    "This module contains a collection of YANG data types
     considered generally useful for routing protocols.";

  revision 2017-02-27 {
    description
      "Initial revision.";
    reference
      "RFC TBD: Routing YANG Data Types";
  }

  /*** collection of types related to routing ***/
  typedef router-id {
    type yang:dotted-quad;
    description
      "A 32-bit number in the dotted quad format assigned to each
       router. This number uniquely identifies the router within an
       Autonomous System.";
  }

  // address-family
  identity address-family {
    description
      "Base identity from which identities describing address
       families are derived.";
  }

  identity ipv4 {
    base address-family;
    description
      "This identity represents IPv4 address family.";
  }

  identity ipv6 {
    base address-family;
    description
      "This identity represents IPv6 address family.";
  }

  //The rest of the values deinfed in the IANA registry

  identity nsap {
    base address-family;
    description
      "Address family from IANA registry.";
  }
  identity hdlc {
    base address-family;
    description
      "(8-bit multidrop)
        Address family from IANA registry.";
  }
  identity bbn1822 {
    base address-family;
    description
      "AHIP (BBN report #1822)
       Address family from IANA registry.";
  }
  identity ieee802 {
    base address-family;
    description
      "(includes all 802 media plus Ethernet canonical format)
       Address family from IANA registry.";
  }
  identity e163 {
    base address-family;
    description
      "Address family from IANA registry.";
  }
  identity e164 {
    base address-family;
    description
      "SMDS, Frame Relay, ATM
       Address family from IANA registry.";
  }
  identity f69 {
    base address-family;
    description
      "(Telex)
       Address family from IANA registry.";
  }
  identity x121 {
    base address-family;
    description
      "(X.25, Frame Relay)
       Address family from IANA registry.";
  }
  identity ipx {
    base address-family;
    description
      "Address family from IANA registry.";
  }
  identity appletalk {
    base address-family;
    description
      "Address family from IANA registry.";
  }
  identity decnet-iv {
    base address-family;
    description
      "Decnet IV
       Address family from IANA registry.";
  }
  identity vines {
    base address-family;
    description
      "Banyan Vines
       Address family from IANA registry.";
  }
  identity e164-nsap {
    base address-family;
    description
      "E.164 with NSAP format subaddress
       Address family from IANA registry.";
  }
  identity dns {
    base address-family;
    description
      "Domain Name System
       Address family from IANA registry.";
  }
  identity dn {
    base address-family;
    description
      "Distinguished Name
       Address family from IANA registry.";
  }
  identity as-num {
    base address-family;
    description
      "AS Number
       Address family from IANA registry.";
  }
  identity xtp-v4 {
    base address-family;
    description
      "XTP over IPv4
       Address family from IANA registry.";
  }
  identity xtp-v6 {
    base address-family;
    description
      "XTP over IPv6
       Address family from IANA registry.";
  }
  identity xtp {
    base address-family;
    description
      "XTP native mode XTP
       Address family from IANA registry.";
  }
  identity fc-port {
    base address-family;
    description
      "Fibre Channel World-Wide Port Name
       Address family from IANA registry.";
  }
  identity fc-node {
    base address-family;
    description
      "Fibre Channel World-Wide Node Name
       Address family from IANA registry.";
  }
  identity gwid {
    base address-family;
    description
      "Address family from IANA registry.";
  }
  identity l2vpn {
    base address-family;
    description
      "Address family from IANA registry.";
  }
  identity mpls-tp-section-eid {
    base address-family;
    description
      "MPLS-TP Section Endpoint Identifier
       Address family from IANA registry.";
  }
  identity mpls-tp-lsp-eid {
    base address-family;
    description
      "MPLS-TP LSP Endpoint Identifier
       Address family from IANA registry.";
  }
  identity mpls-tp-pwe-eid {
    base address-family;
    description
      "MPLS-TP Pseudowire Endpoint Identifier
       Address family from IANA registry.";
  }
  identity mt-v4 {
    base address-family;
    description
      "Multi-Topology IPv4.
       Address family from IANA registry.";
  }
  identity mt-v6 {
    base address-family;
    description
      "Multi-Topology IPv6.
       Address family from IANA registry.";
  }

  /*** collection of types related to VPN ***/
  typedef route-target {
    type string {
      pattern
        '(0:(6553[0-5]|655[0-2]\d|65[0-4]\d{2}|6[0-4]\d{3}|'
      + '[0-5]?\d{0,3}\d):(429496729[0-5]|42949672[0-8]\d|'
      + '4294967[01]\d{2}|429496[0-6]\d{3}|42949[0-5]\d{4}|'
      + '4294[0-8]\d{5}|429[0-3]\d{6}|42[0-8]\d{7}|4[01]\d{8}|'
      + '[0-3]?\d{0,8}\d))|'
      + '(1:(((\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|'
      + '1\d{2}|2[0-4]\d|25[0-5])):(6553[0-5]|655[0-2]\d|'
      + '65[0-4]\d{2}|6[0-4]\d{3}|[0-5]?\d{0,3}\d))|'
      + '(2:(429496729[0-5]|42949672[0-8]\d|4294967[01]\d{2}|'
      + '429496[0-6]\d{3}|42949[0-5]\d{4}|4294[0-8]\d{5}|'
      + '429[0-3]\d{6}|42[0-8]\d{7}|4[01]\d{8}|[0-3]?\d{0,8}\d):'
      + '(6553[0-5]|655[0-2]\d|65[0-4]\d{2}|6[0-4]\d{3}|'
      + '[0-5]?\d{0,3}\d))';
    }
    description
      "A route target is an 8-octet BGP extended community
       initially identifying a set of sites in a BGP
       VPN (RFC 4364). However, it has since taken on a more
       general role in BGP route filtering.
       A route target consists of three fields:
       a 2-octet type field, an administrator field,
       and an assigned number field.
       According to the data formats for type 0, 1, and 2 defined in
       RFC4360 and RFC5668, the encoding pattern is defined as:

       0:2-octet-asn:4-octet-number
       1:4-octet-ipv4addr:2-octet-number
       2:4-octet-asn:2-octet-number.

       Some valid examples are: 0:100:100, 1:1.1.1.1:100, and
       2:1234567890:203.";
    reference
      "RFC4360: BGP Extended Communities Attribute.
       RFC5668: 4-Octet AS Specific BGP Extended Community.";
  }

  typedef route-target-type {
    type enumeration {
      enum "import" {
        value "0";
        description
          "The route target applies to route import.";
       }
      enum "export" {
        value "1";
        description
          "The route target applies to route export.";
       }
      enum "both" {
        value "2";
        description
          "The route target applies to both route import and
           route export.";
       }
    }
    description
      "Indicates the role a route target takes
       in route filtering.";
    reference
      "RFC4364: BGP/MPLS IP Virtual Private Networks (VPNs).";
  }

  typedef route-distinguisher {
    type string {
      pattern
        '(0:(6553[0-5]|655[0-2]\d|65[0-4]\d{2}|6[0-4]\d{3}|'
      + '[0-5]?\d{0,3}\d):(429496729[0-5]|42949672[0-8]\d|'
      + '4294967[01]\d{2}|429496[0-6]\d{3}|42949[0-5]\d{4}|'
      + '4294[0-8]\d{5}|429[0-3]\d{6}|42[0-8]\d{7}|4[01]\d{8}|'
      + '[0-3]?\d{0,8}\d))|'
      + '(1:(((\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|'
      + '1\d{2}|2[0-4]\d|25[0-5])):(6553[0-5]|655[0-2]\d|'
      + '65[0-4]\d{2}|6[0-4]\d{3}|[0-5]?\d{0,3}\d))|'
      + '(2:(429496729[0-5]|42949672[0-8]\d|4294967[01]\d{2}|'
      + '429496[0-6]\d{3}|42949[0-5]\d{4}|4294[0-8]\d{5}|'
      + '429[0-3]\d{6}|42[0-8]\d{7}|4[01]\d{8}|[0-3]?\d{0,8}\d):'
      + '(6553[0-5]|655[0-2]\d|65[0-4]\d{2}|6[0-4]\d{3}|'
      + '[0-5]?\d{0,3}\d))|'
      + '(([3-9a-fA-F]|[1-9a-fA-F][\da-fA-F]{1,3}):'
      + '[\da-fA-F]{1,12})';
    }
    description
      "A route distinguisher is an 8-octet value used to distinguish
       routes from different BGP VPNs (RFC 4364). A route
       distinguisher consists of three fields: A 2-octet type field,
       an administrator field, and an assigned number field.
       According to the data formats for type 0, 1, and 2 defined in
       RFC4364, the encoding pattern is defined as:

       0:2-octet-asn:4-octet-number
       1:4-octet-ipv4addr:2-octet-number
       2:4-octet-asn:2-octet-number.
       2-octet-other-hex-number:6-octet-hex-number

       Some valid examples are: 0:100:100, 1:1.1.1.1:100, and
       2:1234567890:203.";
    reference
      "RFC4364: BGP/MPLS IP Virtual Private Networks (VPNs).";
  }

  /*** collection of types common to multicast ***/
  typedef ipv4-multicast-group-address {
    type inet:ipv4-address {
      pattern '(2((2[4-9])|(3[0-9]))\.).*';
    }
    description
      "This type represents an IPv4 multicast group address,
       which is in the range from 224.0.0.0 to 239.255.255.255.";
    reference
      "RFC1112: Host Extensions for IP Multicasting.";
  }

  typedef ipv6-multicast-group-address {
    type inet:ipv6-address {
      pattern
        '(([fF]{2}[0-9a-fA-F]{2}):).*';
    }
    description
      "This type represents an IPv6 multicast group address,
       which is in the range of FF00::/8.";
    reference
      "RFC4291: IP Version 6 Addressing Architecture. Sec 2.7.
       RFC7346: IPv6 Multicast Address Scopes.";
  }

  typedef ip-multicast-group-address {
    type union {
      type ipv4-multicast-group-address;
      type ipv6-multicast-group-address;
    }
    description
     "This type represents an IP multicast group address and is IP
      version neutral. The format of the textual representation
      implies the IP version.";
  }

  typedef ipv4-multicast-source-address {
    type union {
      type enumeration {
        enum 'any' {
        /*
        ODL does not support * as enum name (how it should be named to java identifier?)
        enum '*' {
        */
          description
          "Any source address.";
        }
      }
      type inet:ipv4-address;
    }
    description
      "Multicast source IPv4 address type.";
  }

  typedef ipv6-multicast-source-address {
    type union {
      type enumeration {
        enum 'any' {
        /*
        ODL does not support * as enum name (how it should be named to java identifier?)
        enum '*' {
        */
          description
          "Any source address.";
        }
      }
      type inet:ipv6-address;
    }
    description
      "Multicast source IPv6 address type.";
  }

  /*** collection of types common to protocols ***/
  typedef bandwidth-ieee-float32 {
    type string {
      pattern
        '0[xX](0((\.0?)?[pP](\+)?0?|(\.0?))|'
      + '1(\.([\da-fA-F]{0,5}[02468aAcCeE]?)?)?[pP](\+)?(12[0-7]|'
      + '1[01]\d|0?\d?\d)?)';
    }
    description
      "Bandwidth in IEEE 754 floating point 32-bit binary format:
       (-1)**(S) * 2**(Exponent-127) * (1 + Fraction),
       where Exponent uses 8 bits, and Fraction uses 23 bits.
       The units are octets per second.
       The encoding format is the external hexadecimal-significand
       character sequences specified in IEEE 754 and C99,
       restricted to be normalized, non-negative, and non-fraction:
       0x1.hhhhhhp{+}d or 0X1.HHHHHHP{+}D
       where 'h' and 'H' are hexadecimal digits, 'd' and 'D' are
       integers in the range of [0..127].
       When six hexadecimal digits are used for 'hhhhhh' or 'HHHHHH',
       the least significant digit must be an even number.
       'x' and 'X' indicate hexadecimal; 'p' and 'P' indicate power
       of two.
       Some examples are: 0x0p0, 0x1p10, and 0x1.abcde2p+20";
    reference
      "IEEE Std 754-2008: IEEE Standard for Floating-Point
       Arithmetic.";
  }

  typedef link-access-type {
    type enumeration {
      enum "broadcast" {
        description
        "Specify broadcast multi-access network.";
      }
      enum "non-broadcast-multiaccess" {
        description
        "Specify Non-Broadcast Multi-Access (NBMA) network.";
      }
      enum "point-to-multipoint" {
        description
        "Specify point-to-multipoint network.";
      }
      enum "point-to-point" {
        description
        "Specify point-to-point network.";
      }
    }
    description
      "Link access type.";
  }

  typedef timer-multiplier {
    type uint8;
    description
      "The number of timer value intervals that should be
       interpreted as a failure.";
  }

  typedef timer-value-seconds16 {
    type union {
      type uint16 {
        range "1..65535";
        }
      type enumeration {
        enum "infinity" {
          description "The timer is set to infinity.";
        }
        enum "not-set" {
          description "The timer is not set.";
        }
      }
    }
    units seconds;
    description "Timer value type, in seconds (16 bit range).";
  }

  typedef timer-value-seconds32 {
    type union {
      type uint32 {
        range "1..4294967295";
        }
      type enumeration {
        enum "infinity" {
          description "The timer is set to infinity.";
        }
        enum "not-set" {
          description "The timer is not set.";
        }
      }
    }
    units seconds;
    description "Timer value type, in seconds (32 bit range).";
  }

  typedef timer-value-milliseconds {
    type union {
      type uint32{
        range "1..4294967295";
        }
      type enumeration {
        enum "infinity" {
          description "The timer is set to infinity.";
        }
        enum "not-set" {
          description "The timer is not set.";
        }
      }
    }
    units milliseconds;
    description "Timer value type, in milliseconds.";
  }

  /*** collection of types related to MPLS/GMPLS ***/
  typedef generalized-label {
    type binary;
    description
      "Generalized label. Nodes sending and receiving the
       Generalized Label know the kinds of link they are
       using. Hence, the Generalized Label does not identify
       its type.  Instead, nodes are expected to know from
       the context and type of label to expect.";
    reference "RFC3471: Section 3.2";
  }

  identity mpls-label-special-purpose-value {
    description
      "Base identity for deriving identities describing
       special-purpose Multiprotocol Label Switching (MPLS) label
       values.";
    reference
      "RFC7274: Allocating and Retiring Special-Purpose MPLS
       Labels.";
  }

  identity ipv4-explicit-null-label {
    base mpls-label-special-purpose-value;
    description
      "This identity represents the IPv4 Explicit NULL Label.";
    reference
      "RFC3032: MPLS Label Stack Encoding. Section 2.1.";
  }

  identity router-alert-label {
    base mpls-label-special-purpose-value;
    description
      "This identity represents the Router Alert Label.";
    reference
      "RFC3032: MPLS Label Stack Encoding. Section 2.1.";
  }

  identity ipv6-explicit-null-label {
    base mpls-label-special-purpose-value;
    description
      "This identity represents the IPv6 Explicit NULL Label.";
    reference
      "RFC3032: MPLS Label Stack Encoding. Section 2.1.";
  }

  identity implicit-null-label {
    base mpls-label-special-purpose-value;
    description
      "This identity represents the Implicit NULL Label.";
    reference
      "RFC3032: MPLS Label Stack Encoding. Section 2.1.";
  }

  identity entropy-label-indicator {
    base mpls-label-special-purpose-value;
    description
      "This identity represents the Entropy Label Indicator.";
    reference
      "RFC6790: The Use of Entropy Labels in MPLS Forwarding.
       Sections 3 and 10.1.";
  }

  identity gal-label {
    base mpls-label-special-purpose-value;
    description
      "This identity represents the Generic Associated Channel Label
       (GAL).";
    reference
      "RFC5586: MPLS Generic Associated Channel.
       Sections 4 and 10.";
  }

  identity oam-alert-label {
    base mpls-label-special-purpose-value;
    description
      "This identity represents the OAM Alert Label.";
    reference
      "RFC3429: Assignment of the 'OAM Alert Label' for Multiprotocol
       Label Switching Architecture (MPLS) Operation and Maintenance
       (OAM) Functions.
       Sections 3 and 6.";
  }

  identity extension-label {
    base mpls-label-special-purpose-value;
    description
      "This identity represents the Extension Label.";
    reference
      "RFC7274: Allocating and Retiring Special-Purpose MPLS Labels.
       Sections 3.1 and 5.";
  }

  typedef mpls-label-special-purpose {
    type identityref {
      base mpls-label-special-purpose-value;
    }
    description
      "This type represents the special-purpose Multiprotocol Label
       Switching (MPLS) label values.";
    reference
      "RFC3032: MPLS Label Stack Encoding.
       RFC7274: Allocating and Retiring Special-Purpose MPLS
       Labels.";
  }

  typedef mpls-label-general-use {
    type uint32 {
      range "16..1048575";
    }
    description
      "The 20 bits label values in an MPLS label stack entry,
       specified in RFC3032. This label value does not include
       the encodings of Traffic Class and TTL (time to live).
       The label range specified by this type is for general use,
       with special-purpose MPLS label values excluded.";
    reference
      "RFC3032: MPLS Label Stack Encoding.";
  }


  typedef mpls-label {
/*
TODO: binding generator creates invalid type bindings, so we changed type to uint32.
Change back after https://jira.opendaylight.org/browse/MDSAL-269 is resolved.
    type union {
      type mpls-label-special-purpose;
      type mpls-label-general-use;
    }
*/
    type mpls-label-general-use;
    description
      "The 20 bits label values in an MPLS label stack entry,
       specified in RFC3032. This label value does not include
       the encodings of Traffic Class and TTL (time to live).";
    reference
      "RFC3032: MPLS Label Stack Encoding.";
  }

  /*
   * Groupings
   */
  grouping mpls-label-stack {
    description
      "A grouping that specifies an MPLS label stack.";
    container mpls-label-stack {
      description
        "Container for a list of MPLS label stack entries.";
      list entry {
        key "id";
        description
          "List of MPLS label stack entries.";
        leaf id {
          type uint8;
          description
            "Identifies the sequence of an MPLS label stack entries.
             An entry with smaller ID value is precedes an entry in
             the label stack with a smaller ID.";
        }
        leaf label {
          type rt-types:mpls-label;
          description
            "Label value.";
        }
        leaf ttl {
          type uint8;
          description
            "Time to Live (TTL).";
          reference
            "RFC3032: MPLS Label Stack Encoding.";
        }
        leaf traffic-class {
          type uint8 {
            range "0..7";
          }
          description
            "Traffic Class (TC).";
          reference
            "RFC5462: Multiprotocol Label Switching (MPLS) Label
             Stack Entry: 'EXP' Field Renamed to 'Traffic Class'
             Field.";
        }
      }
    }
  } // mpls-label-stack

  grouping vpn-route-targets {
    description
      "A grouping that specifies Route Target import-export rules
       used in the BGP enabled Virtual Private Networks (VPNs).";
    reference
      "RFC4364: BGP/MPLS IP Virtual Private Networks (VPNs).
       RFC4664: Framework for Layer 2 Virtual Private Networks
       (L2VPNs)";
    list vpn-target {
      key route-target;
      description
        "List of Route Targets.";
      leaf route-target {
        type rt-types:route-target;
        description
          "Route Target value";
      }
      leaf route-target-type {
        type rt-types:route-target-type;
        mandatory true;
        description
          "Import/export type of the Route Target.";
      }
    }
  } // vpn-route-targets
}