summaryrefslogtreecommitdiffstats
path: root/src/plugins/yang/openconfig/openconfig-segment-routing.yang
blob: f19b2d891fe5e167f59e2ef0bec384bedbf585e5 (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
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
module openconfig-segment-routing {

  yang-version "1";

  // namespace
  namespace "http://openconfig.net/yang/sr";
  prefix "oc-sr";

  // import some basic types
  import openconfig-extensions { prefix "oc-ext"; }
  import openconfig-mpls-types { prefix "oc-mpls-t"; }
  import openconfig-interfaces { prefix "oc-if"; }
  import ietf-inet-types { prefix "inet"; }
  import ietf-yang-types { prefix "yang"; }

  // meta
  organization "OpenConfig working group";

  contact
    "OpenConfig working group
    netopenconfig@googlegroups.com";

  description
    "Configuration and operational state parameters relating to the
    segment routing. This module defines a number of elements which are
    instantiated in multiple places throughout the OpenConfig collection
    of models.

    Particularly:
      - SRGB+LB dataplane instances - directly instantied by SR.
      - SRGB+LB dataplane reservations - instantiated within MPLS and future SR
                                      dataplanes.
      - SR SID advertisements - instantiated within the relevant IGP.
      - SR-specific counters - instantied within the relevant dataplane.";

  oc-ext:openconfig-version "0.0.3";

  revision "2017-01-12" {
    description
      "Minor compliance fixes.";
    reference "0.0.3";
  }

  revision "2016-12-15" {
    description
      "Updated revision of SR module.";
    reference "0.0.2";
  }

  revision "2016-07-28" {
    description
      "Initial revision of SR module.";
    reference "0.0.1";
  }

  typedef sr-dataplane-type {
    type enumeration {
      enum MPLS {
        description
          "The entity uses MPLS labels as Segment Identifiers.";
      }
      enum IPV6 {
        description
          "The entity uses IPv6 prefixes as Segment Identifiers.";
      }
    }
    description
      "Types of data plane that can be used to instantiate a Segment
      Routing block of SIDs.";
  }

  typedef sr-sid-type {
    type union {
      type oc-mpls-t:mpls-label;
      type inet:ipv6-address-no-zone;
    }
    description
      "The defined value of a segment identifier.";
  }

  grouping srgb-config {
    description
      "Configuration parameters relating to the SRGB.";

    leaf local-id {
      type string;
      description
        "Unique identifier for the segment routing global block on
        the local system.";
    }

    leaf dataplane-type {
      type sr-dataplane-type;
      description
        "The dataplane being used to instantiate the SRGB. When MPLS is specified
        the set of MPLS label blocks that are defined in the mpls-label-blocks
        list are used to make up the SRGB. When IPv6 is specified, the set of IPv6
        prefixes specified in the ipv6-prefixes list are used.";
    }

    leaf-list mpls-label-blocks {
      when "../dataplane-type = 'MPLS'" {
        description
          "Allow the MPLS label block to be specified only for SRGBs that are
          using the MPLS dataplane.";
      }
      type leafref {
        // We are at /network-instances/network-instance/segment-routing/
        // srgbs/srgb/config/mpls-label-blocks
        path "../../../../../mpls/global/reserved-label-blocks/" +
             "reserved-label-block/config/local-id";
      }
      description
        "A list of refences to the label blocks that are used to make
        up the SRGB.";
    }

    leaf-list ipv6-prefixes {
      when "../dataplane-type = 'IPV6'" {
        description
          "Allow IPv6 prefixes to be specified only when the dataplane
          realisation of the SRGB is IPv6.";
      }
      type inet:ipv6-prefix;
      description
        "A list of IPv6 prefixes which are to be used for segment routing using
        the IPv6 dataplane.";
    }
  }

  grouping srgb-state {
    description
      "Operational state parameters relating to the SRGB.";

    leaf size {
      type uint32;
      description
        "The total number of SRGB entries that are available within the SRGB.";
    }

    leaf used {
      type uint32;
      description
        "The total number of SRGB entries that have already been alocated by
        protocols referencing the SRGB.";
    }
  }

  grouping srlb-config {
    description
      "Configuration parameters relating to an SRLB.";

    leaf local-id {
      type string;
      description
        "A unique local identifier used for the Segment Routing Local Block.
        The identifier is used when referencing the SRLB within other
        contexts.";
    }

    leaf dataplane-type {
      type sr-dataplane-type;
      description
        "The dataplane that is to be used for the Segment Routing Local Block.
        When MPLS is specified, the local block corresponds to a block of MPLS
        labels; when IPv6 is specified it corresponds to an IPv6 prefix.";
    }

    leaf mpls-label-block {
      when "../dataplane-type = 'MPLS'" {
        description
          "Allow the MPLS label block to be specified only for SRLBs that are
          using the MPLS dataplane.";
      }
      type leafref {
        path "../../../../../mpls/global/reserved-label-blocks/" +
             "reserved-label-block/config/local-id";
      }
      description
        "A reference to the MPLS label block that is used to contain the
        SIDs of the SRLB.";
    }

    leaf ipv6-prefix {
      when "../dataplane-type = 'IPV6'" {
        description
          "Allow IPv6 prefixes to be specified only when the dataplane
          realisation of the SRGB is IPv6.";
      }
      type inet:ipv6-prefix;
      description
        "The IPv6 prefix that is used for the SRLB.";
    }
  }

  grouping sr-structural {
    description
      "Top-level structural grouping defining Segment Routing Global Blocks.";

    container srgbs {
      description
        "Configuration and operational state parameters relating to the
        SRGBs defined for the system.";

      list srgb {
        key "local-id";

        description
          "A single definition of an SRGB which may comprise of multiple
          sets of dataplane addresses (IPv6 addresses, or MPLS labels).";

        leaf local-id {
          type leafref {
            path "../config/local-id";
          }
          description
            "A reference to the identifier for the SRGB.";
        }

        container config {
          description
            "Configuration parameters relating to the SRGB.";
          uses srgb-config;
        }

        container state {
          config false;
          description
            "State parameters relating to the SRGB.";
          uses srgb-config;
          uses srgb-state;
        }
      }
    }

    container srlbs {
      description
        "Configuration and operational state parameters relating to the
        Segment Routing Local Blocks (SRLBs) defined for the system.";

      list srlb {
        key "local-id";

        description
          "A definition of a Segment Routing Local Block, defined to be
          a set of Segment Identifiers (specified as MPLS labels or
          IPv6 addreses) that are defined for local allocation by the
          system. A block may optionally be advertised into an IGP.";

        leaf local-id {
          type leafref {
            path "../config/local-id";
          }
          description
            "Reference to the local identifier used for the SRLB.";
        }

        container config {
          description
            "Configuration parameters relating to the SRLB.";
          uses srlb-config;
        }

        container state {
          config false;
          description
            "Operational state parmeters relating to the SRLB.";
          uses srlb-config;
        }
      }
    }
  }

  grouping sr-mpls-top {
    description
      "Structural grouping defining SR definition within MPLS.";

    container segment-routing {
      description
        "MPLS-specific Segment Routing configuration and operational state
        parameters";

      container aggregate-sid-counters {
        description
          "Per-SID counters aggregated across all interfaces on the local system";

        list aggregate-sid-counter {
          key "mpls-label";
          config false;

          description
            "Counters aggregated across all of the interfaces of the local
            system corresponding to traffic received or forwarded with a
            particular SID";

          leaf mpls-label {
            type leafref {
              path "../state/mpls-label";
            }
            description
              "The MPLS label representing the segment identifier";
          }

          container state {
            config false;
            description
              "State parameters for per-SID statistics";
            uses sr-mpls-sid-counters-state;
            uses sr-mpls-common-counters;
          }
        }
      }

      container interfaces {
        description
          "Interface related Segment Routing parameters.";

        list interface {
          key "interface-id";

          description
            "Parameters and MPLS-specific configuration relating to Segment
            Routing on an interface.";

          leaf interface-id {
            type leafref {
              path "../config/interface-id";
            }
            description
              "A reference to the ID for the interface for which SR is
              configured";
          }

          container config {
            description
              "MPLS-specific Segment Routing configuration parameters
              related to an interface.";
            uses sr-mpls-interface-config;
          }

          container state {
            config false;
            description
              "MPLS-specific Segment Routing operational state parameters
              related to an interface.";
            uses sr-mpls-interface-config;
            uses sr-mpls-interface-state;
          }

          container sid-counters {
            description
              "Per-SID statistics for MPLS";

            list sid-counter {
              key "mpls-label";
              config false;

              description
                "Per segment identifier counters for the MPLS dataplane.";

              leaf mpls-label {
                type leafref {
                  path "../state/mpls-label";
                }
                description
                  "The MPLS label representing the segment identifier";
              }

              container state {
                config false;
                description
                  "State parameters for per-SID statistics";
                uses sr-mpls-sid-counters-state;
                uses sr-mpls-common-counters;
              }

              container forwarding-classes {
                description
                  "Per-SID per-forwarding class counters for Segment Routing.";

                list forwarding-class {
                  key "exp";
                  config false;

                  description
                    "SID entries for the forwarding class associated with the
                    referenced MPLS EXP.";

                  leaf exp {
                    type leafref {
                      path "../state/exp";
                    }
                    description
                      "Reference to the value of the EXP bits of the segment
                      identifier.";
                  }

                  container state {
                    config false;
                    description
                      "Per-SID, per forwarding class counters for Segment Routing
                      with the MPLS dataplane";

                    uses sr-mpls-interface-sid-fc-state;
                    uses sr-mpls-common-counters;
                  }
                }
              }
            }
          }
          uses oc-if:interface-ref;
        }
      }
    }
  }

  grouping sr-mpls-interface-config {
    description
      "MPLS-specific Segment Routing configuration for an interface";

    leaf interface-id {
      type string;
      description
        "A unique identifier for the interface.";
    }
  }

  grouping sr-mpls-interface-state {
    description
      "MPLS-specific Segment Routing operational state parameters for an
      interface";

    uses sr-mpls-common-counters;
  }

  grouping sr-mpls-interface-sid-fc-state {
    description
      "Per-SID per forwarding class statistics for SR with the MPLS dataplane";

    leaf exp {
      type uint8 {
        range "0..7";
      }
      description
        "The value of the MPLS EXP (experimental) or Traffic Class bits that the
        SID statistics relate to. Packets received with a MPLS label value
        equal to the SID's MPLS label and EXP bits equal to the this value
        should be counted towards the associated ingress statistics. Packets
        that are forwarded to the destination MPLS label corresponding to the
        SID should be counted towards this value. In the egress direction, where
        forwarding follows a SID value that requires PHP at the local node,
        packets should still be counted towards the egress counters.";
    }
  }

  grouping sr-mpls-sid-counters-state {
    description
      "Per-SID statistics leaves";

    leaf mpls-label {
      type oc-mpls-t:mpls-label;
      description
        "The MPLS label used for the segment identifier";
    }
  }

  grouping sr-mpls-common-counters {
    description
      "Per segment identifier counters used in the model";

      leaf in-pkts {
        type yang:counter64;
        description
          "A cumulative counter of the packets received within the context
          which have matched a label corresponding to an SR Segment Identifier.";
      }

      leaf in-octets {
        type yang:counter64;
        description
          "The cumulative counter of the total bytes received within the context
          which have matched a label corresponding to an SR Segment Identifier";
      }

      leaf out-pkts {
        type yang:counter64;
        description
          "A cumulative counter of the total number of packets transmitted by
          the local system within the context which have a label imposed that
          corresponds to an Segment Identifier.";
      }

      leaf out-octets {
        type yang:counter64;
        description
          "A cumulative counter of the total bytes transmitted by the local
          system within the context which have a label imported that
          corresponds to an SR Segment Identifier.";
      }
  }

  grouping sr-igp-config {
    description
      "Configuration parameters relating to segment routing within an
      IGP.";

    leaf enabled {
      type boolean;
      description
        "When this leaf is set to true, the segment routing extensions are
        utilised within the IGP.";
    }

    leaf srgb {
      type leafref {
        path "../../../../../../../segment-routing/srgbs/srgb/config/local-id";
      }
      description
        "A reference to the Segment Routing Global Block (SRGB) that is
        to be used by this IGP instance.";
    }

    leaf srlb {
      // Leaf is defined at
      // /network-instances/network-instance/protocols/protocol/<igp>/global/
      // segment-routing/config
      type leafref {
        path "../../../../../../../segment-routing/srlbs/srlb/config/local-id";
      }
      description
        "A reference to the Segment Routing Local Block (SRLB) that is to
        be advertised by the IGP instance.";
    }
  }

  grouping sr-igp-top {
    description
      "Per-instance configuration and state parameters for Segment Routing
      in an IGP.";

    container segment-routing {
      description
        "Configuration and operational state relating to segment routing.";

      container config {
        description
          "Configuration parameters relating to the configuration of segment
          routing for the IGP instance.";
        uses sr-igp-config;
      }

      container state {
        config false;
        description
          "Operational state parameters relating to segment routing for the
          IGP instance.";
        uses sr-igp-config;
      }
    }
  }

  grouping sr-igp-interface-prefix-sid-config {
    description
      "Configuration parameters relating to an IGP prefix SID advertisement";

    leaf prefix {
      type inet:ip-prefix;
      description
        "The IP prefix for which the IGP prefix SID should be advertised. The
        value specified is a local prefix on the interface which is advertised
        into the IGP.";
    }

    leaf sid-id {
      type sr-sid-type;
      description
        "The Segment Identifier to be used when advertising the IGP Prefix SID.";
    }

    leaf label-options {
      type enumeration {
        enum NO_PHP {
          description
            "When this value is specified, the penultimate hop must not pop
            the Prefix-SID label before forwarding it to the local system.";
        }
        enum EXPLICIT_NULL {
          description
            "When set, the penultimate hop must swap the prefix SID for the
            relevant explicit null label before forwarding the packet.";
        }
      }
      description
        "The options associated with the IGP prefix SID for MPLS. The value
        of this leaf specifies the option that the SID should be advertised
        into the IGP with.";
    }
  }

  grouping sr-igp-interface-adjsid-config {
    description
      "Configuration parameters relating to an Adj-SID on an interface";

    leaf sid-id {
      type union {
        type sr-sid-type;
        type enumeration {
            enum DYNAMIC {
              description
                "The SID chosen for the Adjacency SID should be dynamically
                allocated from the system's dynamic range of Segment
                Identifiers. For MPLS, this range should be considered to be
                those labels that do not fall within a reserved label block.";
            }
        }
      }
      description
        "The value of the Adj-SID to be advertised. Where a static SID
        identifier is specified, this should be advertised directly by the
        system. Where the DYNAMIC value is specified, this should be treated
        as a dynamically allocated value. When the MPLS data plane is in use
        the dynamic value should not fall within a reserved-label-block.";
    }

    leaf protection-eligible {
      type boolean;
      default true;
      description
        "Whether the Adj-SID should be considered to be eligible for protection
        using IP or MPLS FRR during a network failure. When this value is set to
        true, the B-flag of the Adj-SID is set to 1, and the local system should
        provide FRR paths for the associated label forwarding entry. When it is
        set to false, the local system must not provide FRR for the specified
        LFIB entry.";
    }

    leaf group {
      type boolean;
      default false;
      description
        "When set to true, the Adj-SID is indicated to be part of a group, and
        the G flag is set to 1 in the corresponding advertisement in the IGP.";
    }

    leaf neighbor {
      type inet:ip-address;
      description
        "The remote system on the interface with which the Adj-SID is
        associated.";
    }
  }

  grouping sr-igp-interface-adjsid-state {
    description
      "Operational state parameters relating to the adjacency SID for an
      interface";

    leaf allocated-dynamic-local {
      type sr-sid-type;
      description
        "Where an Adjacency SID with a dynamic value is to be allocated by
        the system, this leaf reports to the value of the Adj-SID allocated
        to this interface.";
    }
  }

  grouping sr-igp-interface-top {
    description
      "Per-interface configuration and operational state relating to an
      interface within the IGP.";

    container segment-routing {
      description
        "Configuration and operatioanl state parameters relating to segment
        routing for an interface within the IGP.";

      container prefix-sids {
        description
          "Configuration and operational state parameters relating to
          the advertisement of a segment routing IGP-Prefix SID for this
          interface.";

        list prefix-sid {
          key "prefix";

          description
            "An IGP prefix that should have a segment routing IGP-Prefix SID
            allocated to it. The value of the SID is specified by the SID ID,
            as an absolute value. If the absolute value falls within the SRGB,
            the Global flag should be advertised by the system.";

          leaf prefix {
            type leafref {
              path "../config/prefix";
            }
            description
              "Reference to the prefix for which the IGP-Prefix SID is to be
              advertised";
          }

          container config {
            description
              "Configuration parameters for the IGP Prefix SID.";
            uses sr-igp-interface-prefix-sid-config;
          }

          container state {
            config false;
            description
              "Operational state parameters for the IGP-Prefix SID.";
            uses sr-igp-interface-prefix-sid-config;
          }
        }
      }

      container adjacency-sids {
        description
          "Configuration and operational state parameters relating to
          the advertisement of a segment routing adjacency SID for this
          interface.";

        list adjacency-sid {
          key "neighbor sid-id";

          description
            "An Adjacency SID to be advertised for the specified interface.
            The Adj-SID's identifier (the SID ID) must be unique, with flags
            specified indicating the parameters that should be set for the SID.
            Where a SID value is specified that is allocated from the SRGB, the
            global flag must be set by the system.";

          leaf sid-id {
            type leafref {
              path "../config/sid-id";
            }
            description
              "Reference to the segment identifier to be used by the local
              system.";
          }

          leaf neighbor {
            type leafref {
              path "../config/neighbor";
            }
            description
              "Reference to the neighbor with which the Adjacency SID is
              associated.";
          }

          container config {
            description
              "Configuraton parameters relating to the AdjSID.";
            uses sr-igp-interface-adjsid-config;
          }

          container state {
            config false;
            description
              "Operational state parameters relating to the AdjSID.";
            uses sr-igp-interface-adjsid-config;
            uses sr-igp-interface-adjsid-state;
          }
        }
      }
    }
  }

  grouping sr-top {
    description
      "Top level grouping for Segment Routing";

    container segment-routing {
      description
        "Configuration and operational state parameters relating to
        segment routing.";

      uses sr-structural;
    }
  }
}