summaryrefslogtreecommitdiffstats
path: root/yang/frr-bgp-common.yang
blob: 2b1babdd2807dc7f814aea955788a2141f6d8136 (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
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
submodule frr-bgp-common {
  yang-version 1.1;

  belongs-to frr-bgp {
    prefix "bgp";
  }

  import ietf-bgp-types {
    prefix bt;
  }

  import ietf-inet-types {
    prefix inet;
  }

  import frr-bgp-types {
    prefix frr-bt;
  }

  import frr-route-map {
    prefix frr-route-map;
  }

  import frr-route-types {
    prefix frr-rt-type;
  }

  import frr-vrf {
    prefix frr-vrf;
  }

  import ietf-routing-types {
    prefix rt-types;
  }

  import frr-interface {
    prefix frr-interface;
  }

  organization
    "FRRouting";
  contact
    "FRR Users List: <mailto:frog@lists.frrouting.org> FRR Development
     List: <mailto:dev@lists.frrouting.org>";
  description
    "This submodule contains general data definitions for use in BGP.

     Copyright 2020 FRRouting

     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions
     are met:

     1. Redistributions of source code must retain the above copyright notice,
     this list of conditions and the following disclaimer.

     2. Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in the
     documentation and/or other materials provided with the distribution.

     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.";

  revision 2019-12-03 {
    description
      "Initial revision.";
  }

  grouping rmap-policy-import {
    leaf rmap-import {
      type frr-route-map:route-map-ref;
    }
  }

  grouping rmap-policy-export {
    leaf rmap-export {
      type frr-route-map:route-map-ref;
    }
  }

  grouping unsuppress-map-policy-import {
    leaf unsuppress-map-import {
      type frr-route-map:route-map-ref;
    }
  }

  grouping unsuppress-map-policy-export {
    leaf unsuppress-map-export {
      type frr-route-map:route-map-ref;
    }
  }

  grouping plist-policy-import {
    leaf plist-import {
      type frr-bt:plist-ref;
    }
  }

  grouping plist-policy-export {
    leaf plist-export {
      type frr-bt:plist-ref;
    }
  }

  grouping access-list-policy-import {
    leaf access-list-import {
      type frr-bt:access-list-ref;
    }
  }

  grouping access-list-policy-export {
    leaf access-list-export {
      type frr-bt:access-list-ref;
    }
  }

  grouping as-path-filter-list-policy-import {
    leaf as-path-filter-list-import {
      type frr-bt:as-path-filter-ref;
    }
  }

  grouping as-path-filter-list-policy-export {
    leaf as-path-filter-list-export {
      type frr-bt:as-path-filter-ref;
    }
  }

  grouping route-selection-options {
    description
      "Configuration relating to route selection options.";
    container route-selection-options {
      description
        "Parameters relating to options for route selection.";
      leaf always-compare-med {
        type boolean;
        default "false";
        description
          "Compare multi-exit discriminator (MED) value from
           different ASes when selecting the best route.  The
           default behaviour is to only compare MEDs for paths
           received from the same AS.";
      }

      leaf deterministic-med {
        type boolean;
        default "false";
        description
          "Compare multi-exit discriminator (MED) value from
           Same ASes when selecting the best route.";
      }

      leaf confed-med {
        type boolean;
        default "false";
        description
          "Compare multi-exit discriminator (MED) value from
           different Sub ASes when selecting the best route.";
      }

      leaf missing-as-worst-med {
        type boolean;
        default "false";
        description
          "Missing multi-exit discriminator (MED) value is
           considered as value of infinity, making the path
           least desirable when selecting the best route.";
      }

      leaf aspath-confed {
        type boolean;
        default "false";
        description
          "Compare path lengths including confederation sets
           and sequences in selecting a route.";
      }

      leaf ignore-as-path-length {
        type boolean;
        default "false";
        description
          "Ignore the AS path length when selecting the best path.
           The default is to use the AS path length and prefer paths
           with shorter length.";
      }

      leaf external-compare-router-id {
        type boolean;
        default "false";
        description
          "When comparing similar routes received from external BGP
           peers, use the router-id as a criterion to select the
           active path.";
      }

      leaf allow-multiple-as {
        type boolean;
        default "false";
        description
          "Allow multi-path to use paths from different neighbouring
           ASes.  The default is to only consider multiple paths
           from the same neighbouring AS.";
      }

      leaf multi-path-as-set {
        when "../allow-multiple-as = 'true'";
        type boolean;
        default "false";
        description
          "Multi-path with AS-SET, When set to 'true' it adds AS set
           information for aggregate routes, When set to 'false' it
           prevents AS set generation.";
      }
    }
  }

  grouping med-config {
    description
      "Configuration relating to MED.";
    container med-config {
      leaf enable-med-admin {
        type boolean;
        default "false";
        description
          "Flag to enable receiving of MED metric attribute
           in routing updates.";
      }
      leaf max-med-admin {
        type uint32 {
          range "0..4294967295";
        }
        default "4294967294";
        description
          "Tells the router to announce routes with this MED value
           This MED value is applicable for indefinite time.";
      }

      leaf max-med-onstart-up-time {
        type uint32 {
          range "5..86400";
        }
        units "seconds";
        description
          "Tells the router to announce routes with MED value,
           This MED value is applicable for this duration during
           start-up.";
      }

      leaf max-med-onstart-up-value {
        type uint32 {
          range "0..4294967295";
        }
        default "4294967294";
        description
          "Tells the router to announce routes with this MED value
           This MED value is applicable for start-up time.";
      }
    }
  }

  grouping route-reflector-config {
    description
      "Grouping used to include route reflector
       configuration for BGP global.";
    container route-reflector {
      description
        "Route reflector parameters for the BGP global.";
      leaf route-reflector-cluster-id {
        type bt:rr-cluster-id-type;
        description
          "Route Reflector cluster ID to use when local router is
           configured as a route reflector.  Commonly set at the
           group level, but allows a different cluster ID to be set
           for each neighbor.";
        reference
          "RFC 4456: BGP Route Reflection: An Alternative to
           Full Mesh.";
      }

      leaf no-client-reflect {
        type boolean;
        default "false";
        description
          "When set to 'true', this disables route redistribution
           by the Route Reflector. It is set 'true' when the client is
           fully meshed to prevent sending of redundant route
           advertisements.";
        reference
          "TODO: Add reference when IETF writes a draft describing
           this.";
      }

      leaf allow-outbound-policy {
        type boolean;
        default "false";
        description
          "When set to 'true', this allow RR to modify the attributes of the
           reflected IBGP routes as per the out route-map. It is set 'false'
           RR will not modify the attributes of the reflected IBGP routes as
           per the out route-map rules.";
      }
    }
  }

  grouping global-bgp-config {
    leaf instance-type-view {
      type boolean;
      default "false";
      description
        "When set to 'true' BGP instance type is view.
         When set to 'false' BGP instance type is regular.";
    }

    leaf ebgp-multihop-connected-route-check {
      type boolean;
      default "false";
      description
        "When set to 'true' it will disable checking if nexthop is connected
         on EBGP sessions. When set to 'false' it will enable checking if
         nexthop is connected on EBGP sessions.";
    }

    leaf fast-external-failover {
      type boolean;
      default "true";
      description
        "It's an interface tracking mechanism. When set to 'true' don't
         immediately reset session if a link to a directly connected
         external peer goes down. When set to 'false' it will immediately
         reset session if a link to a directly connected external peer goes down.";
    }

    leaf local-pref {
      type uint32;
      default "100";
      description
        "BGP local preference attribute sent to internal peers to
         indicate the degree of preference for externally learned
         routes.  The route with the highest local preference
         value is preferred.";
      reference
        "RFC 4271.";
    }

    leaf default-shutdown {
      type boolean;
      default "false";
      description
        "Apply administrative shutdown to newly configured peers.";
    }

    leaf suppress-duplicates {
      type boolean;
      default "true";
      description
        "Suppress duplicate updates if the route actually not changed.";
    }

    leaf ebgp-requires-policy {
      type boolean;
      default "true";
      description
        "When set to 'true' BGP speaker requires in and out policy
         for EBGP peers (RFC8212).";
    }

    leaf show-hostname {
      type boolean;
      default "false";
      description
        "When set to 'true' BGP show hostname in certain command outputs.";
    }

    leaf show-nexthop-hostname {
      type boolean;
      default "false";
      description
        "When set to 'true' BGP show hostname for nexthop in certain
         command outputs.";
    }
  }

  grouping global-neighbor-config {
    container global-neighbor-config {
      leaf dynamic-neighbors-limit {
        type uint32 {
          range "1..65535";
        }
        description
          "Maximum number of BGP Dynamic Neighbors that can be created.";
      }

      leaf log-neighbor-changes {
        type boolean;
        default "false";
        description
          "When set to 'true' BGP will start logging neighbor up/down and reset reason.
           When set to 'false' BGP will stop logging neighbor up/down and reset reason.";
      }

      container packet-quanta-config {
        leaf wpkt-quanta {
          type uint32 {
            range "1..64";
          }
          default "64";
          description
            "How many packets to write to peer socket per run.";
        }

        leaf rpkt-quanta {
          type uint32 {
            range "1..10";
          }
          default "10";
          description
            "How many packets to read from peer socket per I/O cycle.";
        }
      }
    }
  }

  grouping global-update-group-config {
    container global-update-group-config {
      leaf subgroup-pkt-queue-size {
        type uint32 {
          range "20..100";
        }
        default "40";
        description
          "Subgroup packet queue size.";
      }

      leaf coalesce-time {
        type uint32 {
          range "0..4294967295";
        }
        units "milliseconds";
        default "1000";
        description
          "Configures the Subgroup coalesce timer.";
      }
    }
  }

  grouping global-network-config {
    leaf import-check {
      type boolean;
      default "true";
      description
        "When set to 'true' bgp creates entries for network statements
         if a matching prefix exists in the rib. When set to 'false' bgp
         creates entries for networks that the router cannot reach.

         In FRR versions < 7.4 this used to default to 'false' this is an
         incompatible backward change";
    }
  }

  grouping neighbor-timers {
    leaf hold-time {
      type uint16 {
        range "0 | 3..65535";
      }
      units "seconds";
      default "180";
      description
        "Time interval (in seconds) for the HoldTimer established
         with the peer.  When read as operational data (ro), the
         value of this object is calculated by this BGP speaker,
         using the smaller of the values in hold-time that was
         configured (rw) in the running datastore and the Hold Time
         received in the OPEN message.

         This value must be at least three seconds
         if it is not zero (0).

         If the Hold Timer has not been established
         with the peer this object MUST have a value
         of zero (0).

         If the configured value of hold-time object was
         a value of (0), then when read this object MUST have a
         value of (0) also.";
      reference
        "RFC 4271";
    }

    leaf keepalive {
      type uint16 {
        range "0..65535";
      }
      units "seconds";
      default "60";
      description
        "When used as a configuration (rw) value, this Time interval
         (in seconds) for the KeepAlive timer configured for this BGP
         speaker with this peer. The value of this object will only
         determine the KEEPALIVE messages' frequency relative to
         the value specified in configured value for hold-time.

         If the value of this object is zero (0), no periodical
         KEEPALIVE messages are sent to the peer after the BGP
         connection has been established.  The suggested value for
         this timer is 30 seconds.;

         The actual time interval for the KEEPALIVE messages is
         indicated by operational value of keepalive. That value
         of this object is calculated by this BGP speaker such that,
         when compared with hold-time, it has the same proportion
         that keepalive has, compared with hold-time. A
         reasonable maximum value for this timer would be one third
         of that of hold-time.";
      reference
        "RFC 4271";
    }
  }

  grouping global-config-timers {
    container global-config-timers {
      leaf rmap-delay-time {
        type uint16 {
          range "0..600";
        }
        units "seconds";
        default "5";
        description
          "Time to wait before processing route-map changes.";
      }

      leaf update-delay-time {
        type uint16 {
          range "0..3600";
        }
        units "seconds";
        description
          "Time to force initial delay for best-path and updates.";
      }

      leaf establish-wait-time {
        type uint16 {
          range "1..3600";
        }
        units "seconds";
        description
          "Time to force initial delay for updates.";
      }

      leaf connect-retry-interval {
        type uint16 {
          range "1..max";
        }
        units "seconds";
        default "120";
        description
          "Time interval (in seconds) for the ConnectRetryTimer. The
           suggested value for this timer is 120 seconds.";
        reference
          "RFC 4271, This is the value used
           to initialize the 'ConnectRetryTimer'.";
      }

      uses neighbor-timers;
    }
  }

  grouping graceful-restart-config {
    description
      "Configuration parameters relating to BGP graceful restart.";
    choice mode {
      case graceful-restart-mode {
        leaf enabled {
          type boolean;
          default "false";
          description
            "Enable or disable the graceful-restart capability. When set to 'true'
             it will enable graceful restart and helper both globally. When set
             to 'false' it will enable the default behaviour global helper mode.";
        }
      }

      case graceful-restart-disable-mode {
        leaf graceful-restart-disable {
          type boolean;
          default "false";
          description
            "When set to 'true' it will disable graceful restart and helper both
             globally. when set to 'false' it will enable the default behaviour
             global helper mode.";
        }
      }
    }

    leaf preserve-fw-entry {
      type boolean;
      default "false";
      description
        "Sets F-bit indication that fib is preserved while doing Graceful Restart.
         When set to 'true' Zebra would preserve the FIB entry on the restarting
         node.";
    }

    leaf restart-time {
      type uint16 {
        range "1..3600";
      }
      units "seconds";
      default "120";
      description
        "Estimated time (in seconds) for the local BGP speaker to
         restart a session. This value is advertise in the graceful
         restart BGP capability.  This is a 12-bit value, referred to
         as Restart Time in RFC4724.  Per RFC4724, the suggested
         default value is <= the hold-time value. This timer is
         applicable for helper node.";
      reference
        "RFC 4724: Graceful Restart Mechanism for BGP.";
    }

    leaf stale-routes-time {
      type uint16 {
        range "1..3600";
      }
      units "seconds";
      default "360";
      description
        "An upper-bound on the time that stale routes will be
         retained by a router after a session is restarted. If an
         End-of-RIB (EOR) marker is received prior to this timer
         expiring stale-routes will be flushed upon its receipt - if
         no EOR is received, then when this timer expires stale paths
         will be purged. This timer is applicable for restarting node.";
      reference
        "RFC 4724: Graceful Restart Mechanism for BGP.";
    }

    leaf selection-deferral-time {
      type uint16 {
        range "0..3600";
      }
      units "seconds";
      default "360";
      description
        "An upper-bound on the time that restarting router defers
         the route selection process after restart.";
      reference
        "RFC 4724: Graceful Restart Mechanism for BGP.";
    }

    leaf rib-stale-time {
      type uint16 {
        range "1..3600";
      }
      units "seconds";
      default "500";
      description
        "An upper-bound on the time that helper router holds the
         stale routes in Zebra, When this timer gets expired Zebra
         removes the stale routes.";
    }
  }

  grouping global-group-use-multiple-paths {
    description
      "Common grouping used for both global and groups which provides
       configuration parameters relating to use of multiple paths.";
    container use-multiple-paths {
      description
        "Parameters related to the use of multiple paths for the
         same NLRI.";
      container ebgp {
        description
          "Multi-Path parameters for EBGP.";
        leaf maximum-paths {
          type uint16;
          default "64";
          description
            "Maximum number of parallel paths to consider when using
             BGP multi-path. The default is use a single path.";
        }
      }

      container ibgp {
        description
          "Multi-Path parameters for IBGP.";
        leaf maximum-paths {
          type uint16;
          default "64";
          description
            "Maximum number of parallel paths to consider when using
             IBGP multi-path. The default is to use a single path.";
        }

        leaf cluster-length-list {
          when "../maximum-paths != 0";
          type boolean;
          default "false";
          description
            "When set to 'true' route with the shortest cluster-list
             length is used. The cluster-list reflects the IBGP
             reflection path the route has taken. It's the part
             of route selection algo.";
        }
      }
    }
  }

  grouping global-redistribute {
    description
      "List of route redistribution per AFI.";
    list redistribution-list {
      key "route-type route-instance";
      leaf route-type {
        type frr-rt-type:frr-route-types;
        description
          "Protocol route type.";
      }

      leaf route-instance {
        type uint16 {
          range "0..65535";
        }
        description
          "Protocol Instance.";
      }

      leaf metric {
        type uint32 {
          range "0..4294967295";
        }
        description
          "Metric for redistributed routes.";
      }

      leaf rmap-policy-import {
        type frr-route-map:route-map-ref;
        description
          "Route-map to be applied for redistributed routes into the bgp.";
      }
    }
  }

  grouping mp-afi-safi-network-config {
    leaf label-index {
      type rt-types:mpls-label;
      description
        "Label index to associate with the prefix.";
    }

    leaf rmap-policy-export {
      type frr-route-map:route-map-ref;
      description
        "Route-map to modify the attributes for Routes going out
         via BGP updates.";
    }
  }

  grouping mp-afi-safi-agg-route-config {
    leaf as-set {
      type boolean;
      default "false";
      description
        "When set to 'true' AS set path information is generated
         for aggregate address. When set to 'false' AS set path
         information is not generated.";
    }

    leaf summary-only {
      type boolean;
      default "false";
      description
        "When set to 'true' it advertise only the aggregate route
         and suppress the advertisement of all the component routes.
         When set to 'false' all more-specific routes summarized
         by the aggregate route are advertised.";
    }

    leaf rmap-policy-export {
      type frr-route-map:route-map-ref;
      description
        "Apply route map to aggregate network.";
    }

    leaf origin {
      type enumeration {
        enum "igp" {
          value 0;
          description
            "Local IGP.";
        }
        enum "egp" {
          value 1;
          description
            "Remote EGP.";
        }
        enum "incomplete" {
          value 2;
          description
            "Unknown heritage.";
        }
        enum "unspecified" {
          value 255;
          description
            "Unspecified.";
        }
      }
      default "unspecified";
      description
        "BGP origin type.";
    }

    leaf match-med {
      type boolean;
      default "false";
      description
        "When set to 'true' aggregate-route matches only
         med.";
    }

    leaf suppress-map {
      type string;
      description
        "Suppress more specific routes specified in route-map.";
    }
  }

  grouping admin-distance {
    container admin-distance {
      description
        "Administrative distance (or preference) assigned to
         routes received from different sources
         (external, internal, and local).";
      leaf external {
        type uint8 {
          range "1..255";
        }
        default "20";
        description
          "Administrative distance for routes learned from
           external BGP (EBGP).";
      }

      leaf internal {
        type uint8 {
          range "1..255";
        }
        default "200";
        description
          "Administrative distance for routes learned from
           internal BGP (IBGP).";
      }

      leaf local {
        type uint8 {
          range "1..255";
        }
        default "200";
        description
          "Administrative distance for routes learned from
           local.";
      }
    }
  }

  grouping distance-per-route-config {
    leaf distance {
      type uint8 {
        range "1..255";
      }
      mandatory true;
      description
        "Administrative distance for route.";
    }

    leaf access-list-policy-export {
      type frr-bt:access-list-ref;
      description
        "Access-list policy applied on routes going from BGP to Zebra.";
    }
  }

  grouping route-flap-dampening {
    container route-flap-dampening {
      description
        "Dampening feature";
      leaf enable {
        type boolean;
        default "false";
        description
          "Enable route flap dampening.";
      }

      leaf reach-decay {
        when "../enable = 'true'";
        type uint8 {
          range "1..45";
        }
        units "seconds";
        default "15";
        description
          "This value specifies the time desired for the instability
           metric value to reach one-half of its current value when
           the route is reachable. This half-life value determines
           the rate at which the metric value is decayed. A smaller
           half-life value makes a suppressed route reusable sooner
           than a larger value. The accumulated penalty will be reduced
           to half after this duration.";
      }

      leaf reuse-above {
        when "../enable = 'true'";
        type uint16 {
          range "1..20000";
        }
        default "750";
        description
          "This is the value of the instability metric at which a
           suppressed route becomes unsuppressed if it is reachable
           but currently suppressed. The value assigned to
           reuse-below must be less than suppress-above.";
      }

      leaf suppress-above {
        when "../enable = 'true'";
        type uint16 {
          range "1..20000";
        }
        default "2000";
        description
          "This is the value of the instability metric at which
           route suppression takes place. A route is not installed
           in the forwarding information base (FIB), or announced
           even if it is reachable during the period that it is
           suppressed.";
      }

      leaf unreach-decay {
        when "../enable = 'true'";
        type uint8 {
          range "1..255";
        }
        units "seconds";
        default "60";
        description
          "This value acts the same as reach-decay except that it
           specifies the rate at which the instability metric is
           decayed when a route is unreachable. It should have a
           value greater than or equal to reach-decay.";
      }
    }
  }

  grouping flow-spec-config {
    container flow-spec-config {
      description
        "Flow spec feature.";
      leaf interface {
        type frr-interface:interface-ref {
          require-instance false;
        }
        description
          "The local interface.";
      }
    }
  }

  grouping global-graceful-shutdown {
    description
      "Structural grouping used to include graceful-shutdown
       configuration for both BGP neighbors and peer groups.";
    container graceful-shutdown {
      description
        "BGP Graceful shutdown feature.";
      leaf enable {
        type boolean;
        default "false";
        description
          "Enable graceful-shutdown feature.";
      }
    }
  }

  grouping global-filter-config {
    description
      "Structural grouping used to include filter
       configuration for BGP RIB table.";
    container filter-config {
      description
        "BGP table to RIB route download filter.";
      uses rmap-policy-export;
    }
  }

  grouping route-distinguisher-params {
    description
      "Route distinguisher value as per RFC4364.";
    leaf rd {
      type rt-types:route-distinguisher;
      description
        "Route distinguisher value as per RFC4364.";
    }
  }

  grouping vpn-label-params {
    description
      "Label value for VRF.";
    choice label-allocation-mode {
      case manual {
        leaf label {
          type rt-types:mpls-label;
          description
            "Label index to associate with the prefix.";
        }
      }

      case auto {
        leaf label-auto {
          type boolean;
          default "false";
          description
            "Automatically assign a label.";
        }
      }
    }
  }

  grouping vpn-nexthop-params {
    description
      "Specify next hop to use for VRF advertised prefixes.";
    leaf nexthop {
      type inet:ip-address;
      description
        "Nexthop IP address.";
    }
  }

  grouping rt-list {
    description
      "Route Target list";
    leaf-list import-rt-list {
      type rt-types:route-target;
      description
        "For routes leaked from vpn to current address-family: match any.";
    }

    leaf-list export-rt-list {
      type rt-types:route-target;
      description
        "For routes leaked from current address-family to vpn: set.";
    }
  }

  grouping vpn-route-target-params {
    description
      "Route Target value.";
    leaf redirect-rt {
      type rt-types:route-target;
      description
        "Flow-spec redirect type route target.";
    }

    choice rt-direction {
      case import-export {
        uses rt-list;
      }

      case both {
        leaf-list rt-list {
          type rt-types:route-target;
          description
            "Both import: match any and export: set.";
        }
      }
    }
  }

  grouping vpn-import-params {
    description
      "VPN route leaking parameters.";
    leaf import-vpn {
      type boolean;
      default "false";
      description
        "Import routes from default instance VPN RIB.";
    }

    leaf export-vpn {
      type boolean;
      default "false";
      description
        "Export routes to default instance VPN RIB.";
    }

    list import-vrf-list {
      key "vrf";
      description
        "List of VRFs to import routes from.";
      leaf vrf {
        type frr-vrf:vrf-ref {
          require-instance false;
        }
        description
          "Routing instance.";
      }
    }

    uses rmap-policy-import;

    uses rmap-policy-export;
  }

  grouping global-afi-safi-vpn-config {
    container vpn-config {
      leaf rd {
        type string;
        description
          "Route distinguisher value as per RFC4364.";
      }

      uses vpn-label-params;

      uses vpn-nexthop-params;

      uses vpn-import-params;

      uses vpn-route-target-params;
    }
  }

  grouping global-afi-safi-vpn-network-config {
    list network-config {
      key "rd";
      description
        "A list of rd.";
      uses route-distinguisher-params;

      list prefix-list {
        key "prefix";
        description
          "A list of prefix.";
        leaf prefix {
          type inet:ip-prefix;
          description
            "IP destination prefix.";
        }

        leaf label-index {
          type uint32;
          mandatory true;
          description
            "Label index to associate with the prefix.";
        }

        leaf rmap-policy-export {
          type frr-route-map:route-map-ref;
          description
            "Route-map to modify the attributes for Routes going out
             via BGP updates.";
        }
      }
    }
  }
}