summaryrefslogtreecommitdiffhomepage
path: root/tools/pyang_plugins/gobgp.yang
blob: b93be4247ef9df02d1ca2e045e97fc669821cde3 (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
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
module gobgp {

  yang-version "1";

  // namespace
  namespace "https://github.com/osrg/gobgp";

  prefix "gobgp";

  // import some basic types
  import openconfig-bgp { prefix bgp; }
  import openconfig-bgp-types { prefix bgp-types; }
  import openconfig-bgp-multiprotocol { prefix bgp-mp; }
  import openconfig-routing-policy {prefix rpol; }
  import openconfig-policy-types {prefix ptypes; }
  import openconfig-bgp-policy {prefix bgp-pol; }
  import ietf-inet-types { prefix inet; }
  import ietf-yang-types { prefix yang; }

  // meta
  organization
    "GoBGP";

  contact
    "GoBGP http://osrg.github.io/gobgp/";

  description
    "This module contains definitions for GoBGP-specific configuration.
    It augments bgp modules with GoBGP-specific options.";

  revision "2015-08-10" {
    description
      "Updated model to augment base bgp modules";
    reference "TBD";
  }

  typedef bmp-route-monitoring-policy-type {
    type enumeration {
      enum PRE-POLICY {
        value 0;
        description "send pre-policy routes";
      }
      enum POST-POLICY {
        value 1;
        description "send post-policy routes";
      }
      enum BOTH {
        value 2;
        description "!OBSOLETED! send both pre and post-policy routes";
      }
      enum LOCAL-RIB {
        value 3;
        description "send local rib routes";
      }
      enum ALL {
        value 4;
        description "send pre-policy, post-policy, and local rib routes";
      }
    }
  }

  identity eq {
      base ptypes:attribute-comparison;
  }

  identity ge {
      base ptypes:attribute-comparison;
  }

  identity le {
      base ptypes:attribute-comparison;
  }

  identity IPV4-MULTICAST {
    base bgp-types:afi-safi-type;
    description
      "IPv4 multicast (AFI,SAFI = 1,2)";
    reference "RFC4760";
  }

  identity IPV6-MULTICAST {
    base bgp-types:afi-safi-type;
    description
      "IPv4 multicast (AFI,SAFI = 1,2)";
    reference "RFC4760";
  }

  identity RTC {
    base bgp-types:afi-safi-type;
    description
      "Route target membership (AFI,SAFI = 1,132)";
    reference "RFC4684";
  }

  identity IPV4-ENCAP {
    base bgp-types:afi-safi-type;
    description
      "Encapsulation (AFI,SAFI = 1,7)";
    reference "RFC5512";
  }

  identity IPV6-ENCAP {
    base bgp-types:afi-safi-type;
    description
      "Encapsulation (AFI,SAFI = 2,7)";
    reference "RFC5512";
  }

  identity IPV4-FLOWSPEC {
    base bgp-types:afi-safi-type;
    description
      "IPv4 flowspec (AFI,SAFI = 1,133)";
    reference "RFC5575";
  }

  identity L3VPN-IPV4-FLOWSPEC {
    base bgp-types:afi-safi-type;
    description
      "L3VPN IPv4 flowspec (AFI,SAFI = 1,134)";
    reference "RFC5575";
  }

  identity IPV6-FLOWSPEC {
    base bgp-types:afi-safi-type;
    description
      "IPv6 flowspec (AFI,SAFI = 1,133)";
    reference "RFC5575";
  }

  identity L3VPN-IPV6-FLOWSPEC {
    base bgp-types:afi-safi-type;
    description
      "L3VPN IPv6 flowspec (AFI,SAFI = 1,134)";
    reference "RFC5575";
  }

  identity L2VPN-FLOWSPEC {
    base bgp-types:afi-safi-type;
    description
      "L2VPN flowspec (AFI,SAFI = 25,134)";
    reference "draft-ietf-idr-flowspec-l2vpn-03";
  }

  identity IPV4-SRPOLICY {
    base bgp-types:afi-safi-type;
    description
      "SR Policy IPv4 (AFI,SAFI = 1,73)";
    reference "https://tools.ietf.org/html/draft-ietf-idr-segment-routing-te-policy-11";
  }

  identity IPV6-SRPOLICY {
    base bgp-types:afi-safi-type;
    description
      "SR Policy IPv6 (AFI,SAFI = 2,73)";
    reference "https://tools.ietf.org/html/draft-ietf-idr-segment-routing-te-policy-11";
  }

  identity OPAQUE {
    base bgp-types:afi-safi-type;
    description
      "Opaque (AFI,SAFI = 16397,241)";
    reference "https://tools.ietf.org/html/draft-lapukhov-bgp-opaque-signaling-01";
  }

  identity LS {
    base bgp-types:afi-safi-type;
    description
      "Linkstate (AFI,SAFI = 16388,71)";
    reference "RFC7752";
  }

  grouping gobgp-message-counter {
    description
      "Counters for all BGPMessage types";

    leaf OPEN {
      type uint64;
      description
        "Number of BGP open messages announcing, withdrawing
        or modifying paths exchanged.";
    }

    leaf REFRESH {
      type uint64;
      description
        "Number of BGP Route-Refresh messages indicating an
        error condition has occurred exchanged.";
    }

    leaf KEEPALIVE {
      type uint64;
      description
        "Number of BGP Keepalive messages indicating an
        error condition has occurred exchanged.";
    }

    leaf DYNAMIC-CAP {
      type uint64;
      description
        "Number of BGP dynamic-cap messages indicating an
        error condition has occurred exchanged.";
    }

    leaf WITHDRAW-UPDATE {
      type uint32;
      description
        "Number of updates subjected to treat-as-withdraw treatment.";
    }

    leaf WITHDRAW-PREFIX {
      type uint32;
      description
        "Number of prefixes subjected to treat-as-withdraw treatment.";
    }

    leaf DISCARDED {
      type uint64;
      description
        "Number of discarded messages indicating an
        error condition has occurred exchanged.";
    }

    leaf TOTAL {
      type uint64;
      description
        "Number of total messages indicating an
        error condition has occurred exchanged.";
    }
  }

  grouping gobgp-adjacent-table {
    container adj-table {
      leaf ADVERTISED {
        type uint32;
      }

      leaf FILTERED {
        type uint32;
      }

      leaf RECEIVED {
        type uint32;
      }

      leaf ACCEPTED {
        type uint32;
      }
    }
  }


  grouping gobgp-timer {
    description "additional timer";

    leaf idle-hold-time-after-reset {
      type decimal64 {
        fraction-digits 2;
      }
      default 30;
      description
        "Time interval in seconds that a BGP session will be
        in idle state after neighbor reset operation.";
    }
  }


  grouping gobgp-neighbor-timer {
    description "additional timer";

    leaf downtime {
      type yang:timeticks;
      description
        "This timer determines the amount of time since the
        BGP last transitioned out of the Established state";
    }

    leaf update-recv-time {
      type int64;
      description
        "The number of seconds elapsed since January 1, 1970 UTC
        last time the BGP session received an UPDATE message";
    }
  }


  grouping gobgp-in-policy {
    description
      "additional policy";

    leaf-list in-policy {
      type leafref {
        path "/rpol:routing-policy/rpol:policy-definitions/" +
            "rpol:policy-definition/rpol:name";
        //require-instance true;
      }
      description
        "list of policy names in sequence to be applied on
        sending a routing update in the current context, e.g.,
        for the current other route server clients.";
    }

    leaf default-in-policy {
      type rpol:default-policy-type;
      default REJECT-ROUTE;
      description
        "explicitly set a default policy if no policy definition
        in the in-policy chain is satisfied.";
    }
  }

  grouping gobgp-route-server-config {
    description
      "Configuration parameter specifying whether
      the neighbor is route server client or not.";

    leaf route-server-client {
      type boolean;
      default "false";
      description
        "Configure the neighbor as a route server client.";
    }

    leaf secondary-route {
      type boolean;
      default "false";
      description
        "if an export policy rejects a selected route, try the next route in
        order until one that is accepted is found or all routes for the peer
        are rejected.";
    }
  }

  grouping gobgp-route-server-config-set {
     description
        "set of configurations for route server client.";

    container route-server {
       description
         "Configure the local router as a route server";

      container config {
      description
        "Configuration parameters relating to route server
        client(s) used for the BGP neighbor";
      uses gobgp-route-server-config;
      }
      container state {
      config false;
      description
        "State information relating to route server
        client(s) used for the BGP neighbor";
      uses gobgp-route-server-config;
      }
    }
  }

   typedef rpki-validation-result-type {
    type enumeration {
      enum NONE {
        description "RPKI disabled";
      }
      enum NOT-FOUND {
        description "If the origin AS, prefix, maximum prefix length
        does not exist in the range of ROA";
      }
      enum VALID {
        description "If the origin AS, prefix, maximum prefix length is
        exist in the range of ROA";
      }
      enum INVALID {
        description "if the origin AS is different when prefix,
        maximum prefix length is exist in the range of ROA";
      }
    }
    description
      "indicate the validation result of RPKI based on ROA";
  }

  grouping gobgp-rpki-validation-result {
    description "additional rpki";

    leaf rpki-validation-result {
      type rpki-validation-result-type;
      default NOT-FOUND;
      description
        "specify the validation result of RPKI based on ROA as conditions";
    }
  }

  grouping gobgp-rpki-server-messages-sent {
    description "additional RPKI sent messages";

    leaf serial-query {
      type int64;
      description
        "Number of serial query message sent to RPKI server";
    }
    leaf reset-query {
      type int64;
      description
        "Number of reset query message sent to RPKI server";
    }
    leaf error {
      type int64;
      description
        "Number of error message sent to RPKI server";
    }
  }

  grouping gobgp-rpki-server-messages-received {
    description "additional RPKI receive messages";

    leaf serial-notify {
      type int64;
      description
        "Number of serial notify message received from RPKI server";
    }
    leaf cache-reset {
      type int64;
      description
        "Number of cache reset message received from RPKI server";
    }
    leaf cache-response {
      type int64;
      description
        "Number of cache response message received from RPKI server";
    }
    leaf ipv4-prefix {
      type int64;
      description
        "Number of ipv4 prefix message received from RPKI server";
    }
    leaf ipv6-prefix {
      type int64;
      description
        "Number of ipv6 prefix message received from RPKI server";
    }
    leaf end-of-data {
      type int64;
      description
        "Number of end of data message received from RPKI server";
    }
    leaf error {
      type int64;
      description
        "Number of error message received from RPKI server";
    }
  }

  grouping gobgp-rpki-server-messages {
    description "additional RPKI messages";

    container rpki-sent {
      description
        "Counters for transmission RPKI Message types";
      uses gobgp-rpki-server-messages-sent;
    }
    container rpki-received {
      description
        "Counters for reception RPKI Message types";
      uses gobgp-rpki-server-messages-received;
    }
  }

  grouping gobgp-rpki-server-state {
    description "additional RPKI state";

    leaf up {
      type boolean;
    }
    leaf serial-number {
      type uint32;
    }
    leaf records-v4 {
      type uint32;
    }
    leaf records-v6 {
      type uint32;
    }
    leaf prefixes-v4 {
      type uint32;
    }
    leaf prefixes-v6 {
      type uint32;
    }
    leaf uptime {
      type int64;
      description
        "This timer determines the amount of time since the
         RPKI last transitioned in of the Established state";
    }
    leaf downtime {
      type int64;
      description
        "This timer determines the amount of time since the
         RPKI last transitioned out of the Established state";
    }
    leaf last-pdu-recv-time {
      type int64;
      description
        "last time the received an pdu message from RPKI server";
    }
    container rpki-messages {
      description
        "Counters for transmission and reception RPKI Message types";
      uses gobgp-rpki-server-messages;
    }
  }

  grouping gobgp-rpki-server-config {
    description "additional RPKI config";

    leaf address {
      type inet:ip-address;
      description
        "Reference to the address of the RPKI server used as
         a key in the RPKI server list";
    }
    leaf port {
      type uint32;
      description
        "Reference to the port of the RPKI server";
    }
    leaf refresh-time {
      type int64;
      description
        "Check interval for a configured RPKI server.";
    }
    leaf hold-time {
      type int64;
      description
        "Specify the length of time in seconds that the session between
        the router and RPKI server is to be considered operational
        without any activity";
    }
    leaf record-lifetime {
      type int64;
      description
        "Indicate the expiration date of the route validation recode
        received from RPKI server";
    }
    leaf preference {
      type uint8;
      description
        "RPKI server has a static preference.
        Higher the preference values indicates a higher priority RPKI server";
    }
  }

  grouping gobgp-rpki-server-set {
    description "additional RPKI configuration and state";

    container config {
      description
        "Configuration parameters relating to RPKI server";
      uses gobgp-rpki-server-config;
    }
    container state {
      description
        "State information relating to RPKI server";
      uses gobgp-rpki-server-state;
    }
  }

  grouping gobgp-rpki-servers {
    description "additional RPKI structure";

    container rpki-servers {
      list rpki-server {
        key "address";
        description
          "List of RPKI servers configured on the local system";
        leaf address {
          type leafref {
            path "../config/address";
          }
        }
        uses gobgp-rpki-server-set;
      }
    }
  }

  grouping gobgp-bmp-server-config {
    description "additional BMP config";

    leaf address {
      type inet:ip-address;
      description
        "Reference to the address of the BMP server used as
         a key in the BMP server list";
    }

    leaf port {
      type uint32;
      description
        "Reference to the port of the BMP server";
    }

    leaf route-monitoring-policy {
      type bmp-route-monitoring-policy-type;
      default PRE-POLICY;
    }

    leaf statistics-timeout {
      type uint16;
      description
        "Interval seconds of statistics messages sent to BMP server";
    }

    leaf route-mirroring-enabled {
      type boolean;
      description
        "Enable feature for mirroring of received BGP messages
         mainly for debugging purpose";
    }

    leaf sys-name {
      type string;
      description
        "Reference to the SysName of the BMP server";
    }

    leaf sys-descr {
      type string;
      description
        "Reference to the SysDescr of the BMP server";
    }
  }

  grouping gobgp-bmp-server-set {
    description "additional BMP configuration and state";

    container config {
      description
        "Configuration parameters relating to BMP server";
      uses gobgp-bmp-server-config;
    }

    container state {
      description
        "Configuration parameters relating to BMP server";
      uses gobgp-bmp-server-config;
    }
  }

  grouping gobgp-bmp-servers {
    description "BGP Monitoring Protocol servers";

    container bmp-servers {
      list bmp-server {
        key "address";
        description
          "List of BMP servers configured on the local system";
        leaf address {
          type leafref {
            path "../config/address";
          }
        }
        uses gobgp-bmp-server-set;
      }
    }
  }
  grouping gobgp-vrf-common {
    description
      "Common parameters for VRF configuration and state.";

    leaf name {
      description
        "Unique name among all VRF instances.";
      type string;
    }

    leaf id {
      description
        "Unique identifier among all VRF instances.";
      type uint32;
    }

    leaf rd {
      description
        "Route Distinguisher for this VRF.";
      type string;
    }

    leaf-list import-rt {
      description
        "List of import Route Targets for this VRF.";
      type string;
    }

    leaf-list export-rt {
      description
        "List of export Route Targets for this VRF.";
      type string;
    }
  }

  grouping gobgp-vrf-config {
    description
      "Configuration parameters for VRF.";

    leaf-list both-rt {
      description
        "List of both import and export Route Targets for this VRF. Each
        configuration for import and export Route Targets will be preferred.";
      type string;
    }
  }

  grouping gobgp-vrf-set {
    description "Set of VRF instance configuration and state";

    container config {
      description
        "Configuration parameters for VRF.";
      uses gobgp-vrf-common;
      uses gobgp-vrf-config;
    }

    container state {
      description
        "Configured states of VRF.";
      uses gobgp-vrf-common;
    }
  }

  grouping gobgp-vrfs {
    description
      "Virtual Routing and Forwarding (VRF) instances.";

    container vrfs {
      list vrf {
        description
          "VRF instance configurations on the local system.";

        key "name";
        leaf name {
          type leafref {
            path "../config/name";
          }
        }

        uses gobgp-vrf-set;
      }
    }
  }

  grouping long-lived-graceful-restart {
      container long-lived-graceful-restart {
	  container config {
	      leaf enabled {
		  type boolean;
	      }
	      leaf restart-time {
		  type uint32;
	      }
	  }
	  container state {
	      leaf enabled {
		  type boolean;
	      }
	      leaf received {
		  type boolean;
	      }
	      leaf advertised {
		  type boolean;
	      }
	      leaf peer-restart-time {
		  type uint32;
	      }
	      leaf peer-restart-timer-expired {
		  type boolean;
	      }
	  }
      }
  }

  grouping gobgp-ttl-security-config {
    description
      "Configuration parameters for TTL Security";

    leaf enabled {
      type boolean;
      default "false";
      description
        "Enable features for TTL Security";
    }

    leaf ttl-min {
      type uint8;
      description
        "Reference to the port of the BMP server";
    }
  }

  grouping gobgp-ttl-security-config-set {
    description
      "set of configurations for Generalized TTL Security Mechanism (GTSM)";

    container ttl-security {
      description
        "Configure TTL Security feature";

      container config {
        description
          "Configuration parameters for TTL Security";
        uses gobgp-ttl-security-config;
      }

      container state {
        config false;
        description
          "State information for TTL Security";
        uses gobgp-ttl-security-config;
      }
    }
  }

  // augment statements
  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:state/bgp:messages/bgp:sent" {
    description "additional counters";
    uses gobgp-message-counter;
  }

  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:state/bgp:messages/bgp:received" {
    description "additional counters";
    uses gobgp-message-counter;
  }

  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:state" {
    description "additional counters";
    uses gobgp-adjacent-table;
  }

  typedef bgp-capability {
      type uint8;
  }

  typedef bgp-open-message {
      type uint8;
  }

  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:state" {
    leaf-list remote-capability {
      type bgp-capability;
    }
    leaf-list local-capability {
      type bgp-capability;
    }

    leaf received-open-message {
      type bgp-open-message;
    }
  }

  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:config" {
    description "additional state elements";

    leaf admin-down {
      type boolean;
      description
        "The config of administrative operation. If state, indicates the neighbor is disabled by the administrator";
    }
  }

  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:state" {
    description "additional state elements";

    leaf admin-down {
      type boolean;
      description
        "The state of administrative operation. If the state is true, it indicates the neighbor is disabled by the administrator";
    }

    leaf admin-state {
      type enumeration {
        enum UP {
          description "admin state is up";
        }
        enum DOWN {
          description "admin state is down";
        }
        enum PFX_CT {
          description "prefix counter over limit";
        }
      }
    }

    leaf established-count {
      type uint32;
      description
        "The number of how many the peer became established state";
    }

     leaf flops {
      type uint32;
      description
        "The number of flip-flops";
    }


  }

  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:config" {
    leaf neighbor-interface {
      type string;
    }
    leaf vrf {
      type string;
    }
  }

  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:state" {
    leaf neighbor-interface {
      type string;
    }
    leaf vrf {
      type string;
    }
  }

  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:state" {
    leaf remote-router-id {
        type string;
    }
  }

  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:transport/bgp:config" {
    leaf remote-port {
      type inet:port-number;
    }

    leaf ttl {
      description "TTL value for BGP packets";
      type uint8;
    }

    leaf bind-interface {
      description "Interface name for binding.";
      type string;
    }
  }

  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:timers/bgp:config" {
    description "additional timer";
    uses gobgp-timer;
   }

  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:timers/bgp:state" {
    description "additional timers";
    uses gobgp-timer;
    uses gobgp-neighbor-timer;
   }

  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:afi-safis/bgp:afi-safi/bgp:graceful-restart/bgp:state" {
    description "additional graceful-restart status";
    leaf end-of-rib-received {
      type boolean;
    }
    leaf end-of-rib-sent {
      type boolean;
    }
  }

  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:graceful-restart/bgp:config" {
    description "additional graceful-restart status";
    leaf deferral-time {
      type uint16;
    }
    leaf notification-enabled {
      type boolean;
    }
    leaf long-lived-enabled {
      type boolean;
    }
  }

  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor/bgp:graceful-restart/bgp:state" {
    description "additional graceful-restart status";
    leaf deferral-time {
      type uint16;
    }
    leaf notification-enabled {
      type boolean;
    }
    leaf long-lived-enabled {
      type boolean;
    }
  }

  augment "/bgp:bgp/bgp:peer-groups/bgp:peer-group" {
    description "route server configuration for peer-group";
    uses gobgp-route-server-config-set;
  }

  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor" {
    description "route server configuration for neighbor";
    uses gobgp-route-server-config-set;
  }

  augment "/bgp:bgp/bgp:peer-groups/bgp:peer-group" {
    description "TTL Security configuration for peer-group";
    uses gobgp-ttl-security-config-set;
  }

  augment "/bgp:bgp/bgp:neighbors/bgp:neighbor" {
    description "TTL Security configuration for neighbor";
    uses gobgp-ttl-security-config-set;
   }

  augment "/bgp:bgp/bgp:global/bgp:apply-policy/bgp:config" {
    description "addtional policy";
    uses gobgp-in-policy;

  }

  augment "/bgp:bgp/bgp:global/bgp:apply-policy/bgp:state" {
    description "additional policy";
    uses gobgp-in-policy;

  }

  augment "/rpol:routing-policy/rpol:policy-definitions/" +
    "rpol:policy-definition/rpol:statements/rpol:statement/" +
    "rpol:actions/bgp-pol:bgp-actions/bgp-pol:set-as-path-prepend" {
    description "as number used for aspath prepend";

       leaf as {
         type union {
           type inet:as-number;
           type string {
             pattern "last-as";
           }
         }
         description
           "autonomous system number or 'last-as' which means
           the leftmost as number in the AS-path to be prepended";
       }
  }

  augment "/rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/rpol:neighbor-set" {
    description "alternative for the existing neighbor element";

    leaf-list neighbor-info {
      description
            "neighbor ip address or prefix";
      type inet:ip-address;
    }
  }

  augment "/rpol:routing-policy/rpol:defined-sets/" +
    "bgp-pol:bgp-defined-sets/bgp-pol:community-sets/bgp-pol:community-set" {
    description "alternative for the existing community-member";

    leaf-list community {
      description
        "community set member";
      type string;
    }
  }

  augment "/rpol:routing-policy/rpol:defined-sets/" +
    "bgp-pol:bgp-defined-sets/bgp-pol:ext-community-sets/bgp-pol:ext-community-set" {
    description "alternative for the existing ext-community-member";

    leaf-list ext-community {
      type string;
      description
        "extended community set member";
    }
  }

  augment "/rpol:routing-policy/rpol:defined-sets/" +
    "bgp-pol:bgp-defined-sets" {
    container large-community-sets {
      list large-community-set {
        key "large-community-set-name";

        leaf large-community-set-name {
          type string;
        }
        leaf-list large-community {
          type string;
          description
            "extended community set member";
        }
      }
    }
  }

  augment "/rpol:routing-policy/rpol:defined-sets/" +
    "bgp-pol:bgp-defined-sets/bgp-pol:as-path-sets/bgp-pol:as-path-set" {
    description "alternative for the existing as-path-set-member";

    leaf-list as-path {
      type string;
      description
        "AS path expression";
    }
  }

  augment "/rpol:routing-policy/rpol:policy-definitions/" +
    "rpol:policy-definition/rpol:statements/rpol:statement/" +
    "rpol:conditions/bgp-pol:bgp-conditions" {
    description "additional rpki condition";
    uses gobgp-rpki-validation-result;
  }

  deviation "/rpol:routing-policy/rpol:policy-definitions/" +
    "rpol:policy-definition/rpol:statements/rpol:statement/" +
    "rpol:conditions/bgp-pol:bgp-conditions/bgp-pol:route-type" {
    description "alternative route-type condition";
    deviate replace {
        type enumeration {
          enum NONE {
            description "route type is none";
          }
          enum INTERNAL {
            description "route type is internal";
          }
          enum EXTERNAL {
            description "route type is external";
          }
          enum LOCAL {
            description "route type is local";
          }
        }

    }
  }

  augment "/rpol:routing-policy/rpol:policy-definitions/" +
      "rpol:policy-definition/rpol:statements/rpol:statement/" +
      "rpol:conditions/bgp-pol:bgp-conditions" {
    container match-large-community-set {
      leaf large-community-set {
        type string;
      }
      uses rpol:match-set-options-group;
    }
  }

  augment "/rpol:routing-policy/rpol:policy-definitions/" +
    "rpol:policy-definition/rpol:statements/rpol:statement/" +
    "rpol:actions/bgp-pol:bgp-actions" {
    container set-large-community {
      container set-large-community-method {
        leaf-list communities {
          type string;
        }
      }
      leaf options {
        type bgp-pol:bgp-set-community-option-type;
      }
    }
  }

  augment "/bgp:bgp" {
    description "Additional RPKI configuration and state";
    uses gobgp-rpki-servers;
  }

  augment "/bgp:bgp" {
    description "Additional BMP configuration and state";
    uses gobgp-bmp-servers;
  }

  augment "/bgp:bgp" {
    description "Additional VRF configuration and state";
    uses gobgp-vrfs;
  }

  typedef mrt-type {
    type enumeration {
      enum UPDATES {
        description "RPKI disabled";
      }
      enum TABLE {
        description "If the origin AS, prefix, maximum prefix length is
        exist in the range of ROA";
      }
    }
  }

  grouping gobgp-mrt-set {
    container config {
      leaf dump-type {
        type mrt-type;
      }
      leaf file-name {
        type string;
        description
          "Configures a file name to be written";
      }
      leaf table-name {
        type string;
        description
          "specify the table name with route server setup";
      }
      leaf dump-interval {
        type uint64;
      }
      leaf rotation-interval {
        type uint64;
      }
    }
  }

  grouping gobgp-mrt {
    description "additional mrt configuration";
    container mrt-dump {
      list mrt {
        key "file-name";
        leaf file-name {
          type leafref {
            path "../config/file-name";
          }
        }
        uses gobgp-mrt-set;
      }
    }
  }

  augment "/bgp:bgp" {
    description "additional mrt configuration";
    uses gobgp-mrt;
  }

  grouping zebra-config {
    leaf enabled {
      type boolean;
      description
        "Configure enabling to connect to zebra.";
    }
    leaf url {
      type string;
      description
        "Configure url for zebra.";
    }
    leaf-list redistribute-route-type {
      type string;
    }
    leaf version {
      type uint8;
      description
        "Configure version of zebra protocol.  Default is 2.
        Supported version are 2 or 3 for Quagga and 4, 5 or 6 for FRRouting.";
    }
    leaf nexthop-trigger-enable {
      type boolean;
    }
    leaf nexthop-trigger-delay {
      type uint8;
    }
    leaf mpls-label-range-size {
      type uint32;
      description
        "Configure MPLS label range size which will be requested to
        FRR/Zebra.";
    }
    leaf software-name {
      type string;
      description
        "Configure zebra software name.
        frr4, cumulus, frr6, frr7, frr7.2 and frr7.3 can be used.";
    }
  }

  grouping zebra-set {
    container zebra {
      container config {
        uses zebra-config;
      }
      container state {
        uses zebra-config;
      }
    }
  }

  augment "/bgp:bgp" {
    uses zebra-set;
  }

  grouping collector-config {
    leaf url {
      type string;
    }
    leaf db-name {
      type string;
    }
    leaf table-dump-interval {
      type uint64;
    }
  }

  grouping collector-set {
    container collector {
      container config {
        uses collector-config;
      }
      container state {
        uses collector-config;
      }
    }
  }

  augment "/bgp:bgp" {
    uses collector-set;
  }

  grouping listen-config {
    leaf port {
        type int32;
    }
    leaf-list local-address {
        type string;
    }
  }

  augment "/bgp:bgp/bgp:global/bgp:config" {
      uses listen-config;
  }

  augment "/bgp:bgp/bgp:global/bgp:state" {
      uses listen-config;
  }

  grouping dynamic-neighbors {
    container dynamic-neighbors {
      list dynamic-neighbor {
        key "prefix";

        leaf prefix {
          type leafref {
            path "../config/prefix";
          }
        }

        container config {
          uses bgp-global-dynamic-neighbor-config;
        }

        container state {
          config false;
          uses bgp-global-dynamic-neighbor-config;
        }
      }
    }
  }

  grouping bgp-global-dynamic-neighbor-config {
    description "A dynamic neighbor belongs to a peer group.
     This configuration structure was taken from the latest openconfig.";

    leaf prefix {
      type string;
    }
    leaf peer-group {
      type string;
    }
  }

  augment "/bgp:bgp" {
    uses dynamic-neighbors;
  }

  grouping disable-best-path-selection-config {
    leaf disable-best-path-selection {
      type boolean;
      description
        "Disables best path selection process.";
    }
  }

  augment "/bgp:bgp/bgp:global/bgp:route-selection-options/bgp:config" {
    uses disable-best-path-selection-config;
  }

  augment "/bgp:bgp/bgp:global/bgp:route-selection-options/bgp:state" {
    uses disable-best-path-selection-config;
  }

  augment "/bgp:bgp/bgp:global/bgp:afi-safis/bgp:afi-safi" {
      uses bgp-mp:all-afi-safi-common;
  }

  grouping route-target-membership-config {
      leaf deferral-time {
        type uint16;
      }
  }

  grouping afi-safi-state {
    leaf family {
      description
        "Address family value of AFI-SAFI pair translated from afi-safi-name.";
      type route-family;
    }
  }

  augment "/bgp:bgp/bgp:global/bgp:afi-safis/bgp:afi-safi/bgp:state" {
      uses afi-safi-state;
  }

  augment "/bgp:bgp/bgp:global/bgp:afi-safis/bgp:afi-safi" {
    container route-target-membership {
      container config {
          uses route-target-membership-config;
      }
      container state {
          uses route-target-membership-config;
      }
    }

    uses long-lived-graceful-restart;
  }

  augment "/bgp:bgp/bgp:global/bgp:afi-safis/bgp:afi-safi" {
    container add-paths {
      description
        "add-paths configuration options related to a particular AFI-SAFI.";
      container config {
          uses bgp:bgp-neighbor-add-paths_config;
      }
      container state {
          uses bgp:bgp-neighbor-add-paths_config;
      }
    }
  }
}