summaryrefslogtreecommitdiffhomepage
path: root/api/gobgp.proto
blob: 5f25e59fdf698108d486d013654efa3eb177ba70 (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
// Copyright (C) 2015-2017 Nippon Telegraph and Telephone Corporation.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation files
// (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

syntax = "proto3";

import "google/protobuf/any.proto";

package gobgpapi;

// Interface exported by the server.

service GobgpApi {
  rpc StartServer(StartServerRequest) returns (StartServerResponse) {}
  rpc StopServer(StopServerRequest) returns (StopServerResponse) {}
  rpc GetServer(GetServerRequest) returns (GetServerResponse) {}
  rpc AddNeighbor(AddNeighborRequest) returns (AddNeighborResponse) {}
  rpc DeleteNeighbor(DeleteNeighborRequest) returns (DeleteNeighborResponse) {}
  rpc UpdateNeighbor(UpdateNeighborRequest) returns (UpdateNeighborResponse) {}
  rpc GetNeighbor(GetNeighborRequest) returns (GetNeighborResponse) {}
  rpc ResetNeighbor(ResetNeighborRequest) returns (ResetNeighborResponse) {}
  rpc SoftResetNeighbor(SoftResetNeighborRequest) returns (SoftResetNeighborResponse) {}
  rpc ShutdownNeighbor(ShutdownNeighborRequest) returns (ShutdownNeighborResponse) {}
  rpc EnableNeighbor(EnableNeighborRequest) returns (EnableNeighborResponse) {}
  rpc DisableNeighbor(DisableNeighborRequest) returns (DisableNeighborResponse) {}
  rpc GetRib(GetRibRequest) returns (GetRibResponse) {}
  rpc GetPath(GetPathRequest) returns (stream Path) {}
  rpc ValidateRib(ValidateRibRequest) returns (ValidateRibResponse) {}
  rpc AddPath(AddPathRequest) returns (AddPathResponse) {}
  rpc DeletePath(DeletePathRequest) returns (DeletePathResponse) {}
  rpc MonitorRib(MonitorRibRequest) returns (stream Destination) {}
  rpc MonitorPeerState(Arguments) returns (stream Peer) {}
  rpc EnableMrt(EnableMrtRequest) returns (EnableMrtResponse) {}
  rpc DisableMrt(DisableMrtRequest) returns (DisableMrtResponse) {}
  rpc InjectMrt(stream InjectMrtRequest) returns (InjectMrtResponse) {}
  rpc AddBmp(AddBmpRequest) returns (AddBmpResponse) {}
  rpc DeleteBmp(DeleteBmpRequest) returns (DeleteBmpResponse) {}
  rpc GetRpki(GetRpkiRequest) returns (GetRpkiResponse) {}
  rpc AddRpki(AddRpkiRequest) returns (AddRpkiResponse) {}
  rpc DeleteRpki(DeleteRpkiRequest) returns (DeleteRpkiResponse) {}
  rpc EnableRpki(EnableRpkiRequest) returns (EnableRpkiResponse) {}
  rpc DisableRpki(DisableRpkiRequest) returns (DisableRpkiResponse) {}
  rpc ResetRpki(ResetRpkiRequest) returns (ResetRpkiResponse) {}
  rpc SoftResetRpki(SoftResetRpkiRequest) returns (SoftResetRpkiResponse) {}
  rpc GetRoa(GetRoaRequest) returns (GetRoaResponse) {}
  rpc EnableZebra(EnableZebraRequest) returns (EnableZebraResponse) {}
  rpc AddVrf(AddVrfRequest) returns (AddVrfResponse) {}
  rpc DeleteVrf(DeleteVrfRequest) returns (DeleteVrfResponse) {}
  rpc GetVrf(GetVrfRequest) returns (GetVrfResponse) {}
  rpc GetDefinedSet(GetDefinedSetRequest) returns (GetDefinedSetResponse) {}
  rpc AddDefinedSet(AddDefinedSetRequest) returns (AddDefinedSetResponse) {}
  rpc DeleteDefinedSet(DeleteDefinedSetRequest) returns (DeleteDefinedSetResponse) {}
  rpc ReplaceDefinedSet(ReplaceDefinedSetRequest) returns (ReplaceDefinedSetResponse) {}
  rpc GetStatement(GetStatementRequest) returns (GetStatementResponse) {}
  rpc AddStatement(AddStatementRequest) returns (AddStatementResponse) {}
  rpc DeleteStatement(DeleteStatementRequest) returns (DeleteStatementResponse) {}
  rpc ReplaceStatement(ReplaceStatementRequest) returns (ReplaceStatementResponse) {}
  rpc GetPolicy(GetPolicyRequest) returns (GetPolicyResponse) {}
  rpc AddPolicy(AddPolicyRequest) returns (AddPolicyResponse) {}
  rpc DeletePolicy(DeletePolicyRequest) returns (DeletePolicyResponse) {}
  rpc ReplacePolicy(ReplacePolicyRequest) returns (ReplacePolicyResponse) {}
  rpc UpdatePolicy(UpdatePolicyRequest) returns (UpdatePolicyResponse) {}
  rpc GetPolicyAssignment(GetPolicyAssignmentRequest) returns (GetPolicyAssignmentResponse) {}
  rpc AddPolicyAssignment(AddPolicyAssignmentRequest) returns (AddPolicyAssignmentResponse) {}
  rpc DeletePolicyAssignment(DeletePolicyAssignmentRequest) returns (DeletePolicyAssignmentResponse) {}
  rpc ReplacePolicyAssignment(ReplacePolicyAssignmentRequest) returns (ReplacePolicyAssignmentResponse) {}
  rpc GetRibInfo(GetRibInfoRequest) returns (GetRibInfoResponse) {}
  rpc AddPeerGroup(AddPeerGroupRequest) returns (AddPeerGroupResponse) {}
  rpc DeletePeerGroup(DeletePeerGroupRequest) returns (DeletePeerGroupResponse) {}
  rpc UpdatePeerGroup(UpdatePeerGroupRequest) returns (UpdatePeerGroupResponse) {}
  rpc AddDynamicNeighbor(AddDynamicNeighborRequest) returns (AddDynamicNeighborResponse) {}
  rpc AddCollector(AddCollectorRequest) returns (AddCollectorResponse) {}
  rpc Shutdown(ShutdownRequest) returns (ShutdownResponse) {}
}

// Constants for address families
enum Family {
  RESERVED = 0;
  IPv4 = 65537;
  IPv6 = 131073;
  IPv4_MC = 65538;
  IPv6_MC = 131074;
  IPv4_MPLS = 65540;
  IPv6_MPLS = 131076;
  IPv4_VPN = 65664;
  IPv6_VPN = 131200;
  IPv4_VPN_MC = 65665;
  IPv6_VPN_MC = 131201;
  VPLS = 1638465;
  EVPN = 1638470;
  RTC = 65668;
  IPv4_ENCAP = 65543;
  IPv6_ENCAP = 131079;
  FLOW_SPEC_IPv4 = 65669;
  FLOW_SPEC_IPv6 = 131205;
  FLOW_SPEC_IPv4_VPN = 65670;
  FLOW_SPEC_IPv6_VPN = 131206;
  FLOW_SPEC_L2_VPN = 1638534;
  OPAQUE = 1074594033;
}

message GetNeighborRequest {
  bool enableAdvertised = 1;
  string address        = 2;
}

message GetNeighborResponse {
  repeated Peer peers = 1;
}

message Arguments {
  Resource resource = 1;
  uint32 family = 2;
  string name = 3;
  bool current = 4;
}

message AddPathRequest {
  Resource resource = 1;
  string vrf_id = 2;
  Path path = 3;
}

message AddPathResponse {
  bytes uuid = 1;
}

message DeletePathRequest {
  Resource resource = 1;
  string vrf_id = 2;
  uint32 family = 3;
  Path path = 4;
  bytes uuid = 5;
}

message DeletePathResponse {
}

message AddNeighborRequest {
  Peer peer = 1;
}

message AddNeighborResponse {
}

message DeleteNeighborRequest {
  Peer peer = 1;
}

message DeleteNeighborResponse {
}

message UpdateNeighborRequest {
  Peer peer = 1;
  // Calls SoftResetIn after updating the neighbor configuration if needed.
  bool do_soft_reset_in = 2;
}

message UpdateNeighborResponse {
  // Indicates whether calling SoftResetIn is required due to this update. If
  // "true" is set, the client should call SoftResetIn manually. If
  // "do_soft_reset_in = true" is set in the request, always returned with
  // "false".
  bool needs_soft_reset_in = 1;
}

message AddPeerGroupRequest {
  PeerGroup peer_group = 1;
}

message AddPeerGroupResponse {
}

message DeletePeerGroupRequest {
  PeerGroup peer_group = 1;
}

message DeletePeerGroupResponse {
}

message UpdatePeerGroupRequest {
  PeerGroup peer_group = 1;
  bool do_soft_reset_in = 2;
}

message UpdatePeerGroupResponse {
  bool needs_soft_reset_in = 1;
}

message AddDynamicNeighborRequest {
  DynamicNeighbor dynamic_neighbor = 1;
}

message AddDynamicNeighborResponse {
}

message ResetNeighborRequest {
  string address = 1;
  string communication = 2;
}

message ResetNeighborResponse {
}

message SoftResetNeighborRequest {
  string address = 1;
  enum SoftResetDirection {
    IN = 0;
    OUT = 1;
    BOTH = 2;
  }
  SoftResetDirection direction = 2;
}

message SoftResetNeighborResponse {
}

message ShutdownNeighborRequest {
  string address = 1;
  string communication = 2;
}

message ShutdownNeighborResponse {
}

message EnableNeighborRequest {
  string address = 1;
}

message EnableNeighborResponse {
}

message DisableNeighborRequest {
  string address = 1;
  string communication = 2;
}

message DisableNeighborResponse {
}

message UpdatePolicyRequest {
  repeated DefinedSet sets = 1;
  repeated Policy policies = 2;
}

message UpdatePolicyResponse {
}

message EnableMrtRequest {
  int32 dump_type = 1;
  string filename = 2;
  uint64 interval = 3;
}

message EnableMrtResponse {
}

message DisableMrtRequest {
}

message DisableMrtResponse {
}

message InjectMrtRequest {
  Resource resource = 1;
  string vrf_id = 2;
  repeated Path paths = 3;
}

message InjectMrtResponse {
}

message AddBmpRequest {
  string address = 1;
  uint32 port = 2;
  enum MonitoringPolicy {
    PRE = 0;
    POST = 1;
    BOTH = 2;
    LOCAL = 3;
    ALL = 4;
  }
  MonitoringPolicy type = 3;
}

message AddBmpResponse {
}

message DeleteBmpRequest {
  string address = 1;
  uint32 port = 2;
}

message DeleteBmpResponse {
}

message MonitorRibRequest {
    Table table = 1;
    bool current = 2;
}

message RPKIConf {
  string address = 1;
  string remote_port = 2;
}

message RPKIState {
  int64 uptime = 1;
  int64 downtime = 2;
  bool  up = 3;
  uint32 record_ipv4 = 4;
  uint32 record_ipv6 = 5;
  uint32 prefix_ipv4 = 6;
  uint32 prefix_ipv6 = 7;
  uint32 serial = 8;
  int64 received_ipv4 = 9;
  int64 received_ipv6 = 10;
  int64 serial_notify = 11;
  int64 cache_reset = 12;
  int64 cache_response = 13;
  int64 end_of_data = 14;
  int64 error = 15;
  int64 serial_query = 16;
  int64 reset_query = 17;
}

message Rpki {
  RPKIConf conf = 1;
  RPKIState state = 2;
}

message GetRpkiRequest {
  uint32 family = 1;
}

message GetRpkiResponse {
  repeated Rpki servers = 1;
}

message AddRpkiRequest {
  string address = 1;
  uint32 port = 2;
  int64 lifetime = 3;
}

message AddRpkiResponse {
}

message DeleteRpkiRequest {
  string address = 1;
  uint32 port = 2;
}

message DeleteRpkiResponse {
}

message EnableRpkiRequest {
  string address = 1;
}

message EnableRpkiResponse {
}

message DisableRpkiRequest {
  string address = 1;
}

message DisableRpkiResponse {
}

message ResetRpkiRequest {
  string address = 1;
}

message ResetRpkiResponse {
}

message SoftResetRpkiRequest {
  string address = 1;
}

message SoftResetRpkiResponse {
}

message EnableZebraRequest {
  string url = 1;
  repeated string route_types = 2;
  uint32 version = 3;
  bool nexthop_trigger_enable = 4;
  uint32 nexthop_trigger_delay = 5;
}

message EnableZebraResponse {
}

message GetVrfRequest {
}

message GetVrfResponse {
  repeated Vrf vrfs = 1;
}

message AddVrfRequest {
  Vrf vrf = 1;
}

message AddVrfResponse {
}

message DeleteVrfRequest {
  Vrf vrf = 1;
}

message DeleteVrfResponse {
}

message GetDefinedSetRequest {
  DefinedType type = 1;
  string name = 2;
}

message GetDefinedSetResponse {
  repeated DefinedSet sets = 1;
}

message AddDefinedSetRequest {
  DefinedSet set = 1;
}

message AddDefinedSetResponse {
}

message DeleteDefinedSetRequest {
  DefinedSet set = 1;
  bool all = 2;
}

message DeleteDefinedSetResponse {
}

message ReplaceDefinedSetRequest {
  DefinedSet set = 1;
}

message ReplaceDefinedSetResponse {
}

message GetStatementRequest {
}

message GetStatementResponse {
  repeated Statement statements = 1;
}

message AddStatementRequest {
  Statement statement = 1;
}

message AddStatementResponse {
}

message DeleteStatementRequest {
  Statement statement = 1;
  bool all = 2;
}

message DeleteStatementResponse {
}

message ReplaceStatementRequest {
  Statement statement = 1;
}

message ReplaceStatementResponse {
}

message GetPolicyRequest {
}

message GetPolicyResponse {
  repeated Policy policies = 1;
}

message AddPolicyRequest {
  Policy policy = 1;
  // if this flag is set, gobgpd won't define new statements
  // but refer existing statements using statement's names in this arguments.
  bool refer_existing_statements = 2;
}

message AddPolicyResponse {
}

message DeletePolicyRequest {
  Policy policy = 1;
  // if this flag is set, gobgpd won't delete any statements
  // even if some statements get not used by any policy by this operation.
  bool preserve_statements = 2;
  bool all = 3;
}

message DeletePolicyResponse {
}

message ReplacePolicyRequest {
  Policy policy = 1;
  // if this flag is set, gobgpd won't define new statements
  // but refer existing statements using statement's names in this arguments.
  bool refer_existing_statements = 2;
  // if this flag is set, gobgpd won't delete any statements
  // even if some statements get not used by any policy by this operation.
  bool preserve_statements = 3;
}

message ReplacePolicyResponse {
}

message GetPolicyAssignmentRequest {
  PolicyAssignment assignment = 1;
}

message GetPolicyAssignmentResponse {
  PolicyAssignment assignment = 1;
}

message AddPolicyAssignmentRequest {
  PolicyAssignment assignment = 1;
}

message AddPolicyAssignmentResponse {
}

message DeletePolicyAssignmentRequest {
  PolicyAssignment assignment = 1;
  bool all = 2;
}

message DeletePolicyAssignmentResponse {
}

message ReplacePolicyAssignmentRequest {
  PolicyAssignment assignment = 1;
}

message ReplacePolicyAssignmentResponse {
}

message GetServerRequest {
}

message GetServerResponse {
  Global global = 1;
}

message StartServerRequest {
  Global global = 1;
}

message StartServerResponse {
}

message StopServerRequest {
}

message StopServerResponse {
}

enum Resource {
  GLOBAL = 0;
  LOCAL = 1;
  ADJ_IN = 2;
  ADJ_OUT = 3;
  VRF = 4;
}

message RPKIValidation{
  enum State {
    STATE_NONE = 0;
    STATE_NOT_FOUND = 1;
    STATE_VALID = 2;
    STATE_INVALID = 3;
  }

  enum Reason {
    REASOT_NONE = 0;
    REASON_AS = 1;
    REASON_LENGTH = 2;
  }

  State state = 1;
  Reason reason = 2;
  repeated Roa matched = 3;
  repeated Roa unmatched_as = 4;
  repeated Roa unmatched_length = 5;
}

message Path {
  bytes nlri = 1;
  repeated bytes pattrs = 2;
  int64 age = 3;
  bool best = 4;
  bool is_withdraw = 5;
  int32 validation = 6; // remains for backword compatibility
  RPKIValidation validation_detail = 7;
  bool no_implicit_withdraw = 8;
  uint32 family = 9;
  uint32 source_asn = 10;
  string source_id = 11;
  bool filtered = 12;
  bool stale = 13;
  bool is_from_external = 14;
  string neighbor_ip = 15;
  bytes uuid = 16; // only paths installed by AddPath API have this
  bool is_nexthop_invalid = 17;
  uint32 identifier = 18;
  uint32 local_identifier = 19;
  // One of the following defined in "api/attribute.proto":
  // - IPAddressPrefix
  // - LabeledIPAddressPrefix
  // - EncapsulationNLRI
  // - EVPNEthernetAutoDiscoveryRoute
  // - EVPNMACIPAdvertisementRoute
  // - EVPNInclusiveMulticastEthernetTagRoute
  // - EVPNEthernetSegmentRoute
  // - EVPNIPPrefixRoute
  // - LabeledVPNIPAddressPrefix
  // - RouteTargetMembershipNLRI
  // - FlowSpecNLRI
  // - VPNFlowSpecNLRI
  // - OpaqueNLRI
  google.protobuf.Any any_nlri = 20;
  // Each attribute must be one of *Attribute defined in
  // "api/attribute.proto".
  repeated google.protobuf.Any any_pattrs = 21;
}

message Destination {
  string prefix = 1;
  repeated Path paths = 2;
  bool longer_prefixes = 3;
  bool shorter_prefixes = 4;
}

message Table {
  Resource type = 1;
  string name = 2;
  uint32 family = 3;
  repeated Destination destinations = 4;
  bool post_policy = 5;
}

message GetRibRequest {
  Table table = 1;
}

message GetRibResponse {
  Table table = 1;
}

// API representation of table.LookupOption
enum TableLookupOption {
  LOOKUP_EXACT = 0;
  LOOKUP_LONGER = 1;
  LOOKUP_SHORTER = 2;
}

// API representation of table.LookupPrefix
message TableLookupPrefix {
  string prefix = 1;
  TableLookupOption lookup_option = 2;
}

message GetPathRequest {
  Resource type = 1;
  string name = 2;
  uint32 family = 3;
  repeated TableLookupPrefix prefixes = 4;
}

message ValidateRibRequest {
  Resource type = 1;
  uint32 family = 2;
  string prefix = 3;
}

message ValidateRibResponse {
}

message Peer {
  // Note: Regarding to the consistency with OpenConfig model, a list of
  // address family should be removed from here, and should be configured with
  // the list of AfiSafi instead.
  repeated uint32 families = 1;
  ApplyPolicy apply_policy = 2;
  PeerConf conf = 3;
  EbgpMultihop ebgp_multihop = 4;
  RouteReflector route_reflector = 5;
  PeerState info = 6;
  Timers timers = 7;
  Transport transport = 8;
  RouteServer route_server = 9;
  GracefulRestart graceful_restart = 10;
  repeated AfiSafi afi_safis = 11;
  AddPaths add_paths = 12;
}

message PeerGroup {
  // Note: Regarding to the consistency with OpenConfig model, a list of
  // address family should be removed from here, and should be configured with
  // the list of AfiSafi instead.
  repeated uint32 families = 1;
  ApplyPolicy apply_policy = 2;
  PeerGroupConf conf = 3;
  EbgpMultihop ebgp_multihop = 4;
  RouteReflector route_reflector = 5;
  PeerGroupState info = 6;
  Timers timers = 7;
  Transport transport = 8;
  RouteServer route_server = 9;
  GracefulRestart graceful_restart = 10;
  repeated AfiSafi afi_safis = 11;
  AddPaths add_paths = 12;
}

message DynamicNeighbor {
  string prefix = 1;
  string peer_group = 2;
}

message ApplyPolicy {
  PolicyAssignment in_policy = 1;
  PolicyAssignment export_policy = 2;
  PolicyAssignment import_policy = 3;
}

message PrefixLimit {
  uint32 family = 1;
  uint32 max_prefixes = 2;
  uint32 shutdown_threshold_pct = 3;
}

message PeerConf {
  string auth_password = 1;
  string description = 2;
  uint32 local_as = 3;
  string neighbor_address = 4;
  uint32 peer_as = 5;
  string peer_group = 6;
  uint32 peer_type = 7;
  enum RemovePrivateAs {
      NONE = 0;
      ALL = 1;
      REPLACE = 2;
  }
  RemovePrivateAs remove_private_as = 8;
  bool route_flap_damping = 9;
  uint32 send_community = 10;
  // Each attribute must be one of *Capability defined in
  // "api/capability.proto".
  repeated google.protobuf.Any remote_cap = 11;
  repeated google.protobuf.Any local_cap = 12;
  string id = 13;
  // Note: Regarding to the consistency with OpenConfig model, list of
  // PrefixLimit should be removed from here, and list of PrefixLimit in
  // AfiSafi should be used instead.
  repeated PrefixLimit prefix_limits = 14;
  string local_address = 15;
  string neighbor_interface = 16;
  string vrf = 17;
  uint32 allow_own_as = 18;
  bool replace_peer_as = 19;
}

message PeerGroupConf {
  string auth_password = 1;
  string description = 2;
  uint32 local_as = 3;
  uint32 peer_as = 5;
  string peer_group_name = 6;
  uint32 peer_type = 7;
  enum RemovePrivateAs {
      NONE = 0;
      ALL = 1;
      REPLACE = 2;
  }
  RemovePrivateAs remove_private_as = 8;
  bool route_flap_damping = 9;
  uint32 send_community = 10;
}

message PeerGroupState {
  string auth_password = 1;
  string description = 2;
  uint32 local_as = 3;
  uint32 peer_as = 5;
  string peer_group_name = 6;
  uint32 peer_type = 7;
  enum RemovePrivateAs {
      NONE = 0;
      ALL = 1;
      REPLACE = 2;
  }
  RemovePrivateAs remove_private_as = 8;
  bool route_flap_damping = 9;
  uint32 send_community = 10;
  uint32 total_paths = 11;
  uint32 total_prefixes = 12;
}

message EbgpMultihop {
  bool enabled = 1;
  uint32 multihop_ttl = 2;
}

message RouteReflector {
  bool route_reflector_client = 1;
  string route_reflector_cluster_id = 2;
}

message PeerState {
  string auth_password = 1;
  string description = 2;
  uint32 local_as = 3;
  Messages messages = 4;
  string neighbor_address = 5;
  uint32 peer_as = 6;
  string peer_group = 7;
  uint32 peer_type = 8;
  Queues queues = 9;
  uint32 remove_private_as = 10;
  bool route_flap_damping = 11;
  uint32 send_community = 12;
  uint32 session_state = 13;
  repeated string supported_capabilities = 14;
  string bgp_state = 15;
  enum AdminState {
      UP = 0;
      DOWN = 1;
      PFX_CT = 2; // prefix counter over limit
  }
  AdminState admin_state = 16;
  uint32 received = 17;
  uint32 accepted = 18;
  uint32 advertised = 19;
  uint32 out_q = 20;
  uint32 flops = 21;
}

message Messages {
  Message received = 1;
  Message sent = 2;
}

message Message {
  uint64 NOTIFICATION = 1;
  uint64 UPDATE = 2;
  uint64 OPEN = 3;
  uint64 KEEPALIVE = 4;
  uint64 REFRESH = 5;
  uint64 DISCARDED = 6;
  uint64 TOTAL = 7;
}

message Queues {
  uint32 input = 1;
  uint32 output = 2;
}

message Timers {
  TimersConfig config =1;
  TimersState state = 2;
}

message TimersConfig{
  uint64 connect_retry = 1;
  uint64 hold_time = 2;
  uint64 keepalive_interval = 3;
  uint64 minimum_advertisement_interval = 4;
}

message TimersState{
  uint64 connect_retry = 1;
  uint64 hold_time = 2;
  uint64 keepalive_interval = 3;
  uint64 minimum_advertisement_interval = 4;
  uint64 negotiated_hold_time = 5;
  uint64 uptime = 6;
  uint64 downtime = 7;
}

message Transport {
  string local_address = 1;
  uint32 local_port = 2;
  bool mtu_discovery = 3;
  bool passive_mode = 4;
  string remote_address = 5;
  uint32 remote_port = 6;
  uint32 tcp_mss = 7;
}

message RouteServer {
  bool route_server_client = 1;
}

message GracefulRestart {
  bool enabled = 1;
  uint32 restart_time = 2;
  bool helper_only = 3;
  uint32 deferral_time = 4;
  bool notification_enabled = 5;
  bool longlived_enabled = 6;
  uint32 stale_routes_time = 7;
  uint32 peer_restart_time = 8;
  bool peer_restarting = 9;
  bool local_restarting = 10;
  string mode = 11;
}

message MpGracefulRestartConfig {
  bool enabled = 1;
}

message MpGracefulRestartState {
  bool enabled = 1;
  bool received = 2;
  bool advertised = 3;
  bool end_of_rib_received = 4;
  bool end_of_rib_sent = 5;
}
message MpGracefulRestart {
  MpGracefulRestartConfig config = 1;
  MpGracefulRestartState state = 2;
}

message AfiSafiConfig {
  uint32 family = 1;
  bool enabled = 2;
}

message AfiSafiState {
  uint32 family = 1;
  bool enabled = 2;
  uint32 total_paths = 3;
  uint32 total_prefixes = 4;
}

message RouteSelectionOptionsConfig {
  bool always_compare_med = 1;
  bool ignore_as_path_length = 2;
  bool external_compare_router_id = 3;
  bool advertise_inactive_routes = 4;
  bool enable_aigp = 5;
  bool ignore_next_hop_igp_metric = 6;
  bool disable_best_path_selection = 7;
}

message RouteSelectionOptionsState {
  bool always_compare_med = 1;
  bool ignore_as_path_length = 2;
  bool external_compare_router_id = 3;
  bool advertise_inactive_routes = 4;
  bool enable_aigp = 5;
  bool ignore_next_hop_igp_metric = 6;
  bool disable_best_path_selection = 7;
}

message RouteSelectionOptions {
  RouteSelectionOptionsConfig config = 1;
  RouteSelectionOptionsState state = 2;
}

message UseMultiplePathsConfig {
  bool enabled = 1;
}

message UseMultiplePathsState {
  bool enabled = 1;
}

message EbgpConfig {
  bool allow_multiple_as = 1;
  uint32 maximum_paths = 2;
}

message EbgpState {
  bool allow_multiple_as = 1;
  uint32 maximum_paths = 2;
}

message Ebgp {
  EbgpConfig config = 1;
  EbgpState state = 2;
}

message IbgpConfig {
  uint32 maximum_paths = 1;
}

message IbgpState {
  uint32 maximum_paths = 1;
}

message Ibgp {
  IbgpConfig config = 1;
  IbgpState state = 2;
}

message UseMultiplePaths {
  UseMultiplePathsConfig config = 1;
  UseMultiplePathsState state = 2;
  Ebgp ebgp = 3;
  Ibgp ibgp = 4;
}

message RouteTargetMembershipConfig {
  uint32 deferral_time = 1;
}

message RouteTargetMembershipState {
  uint32 deferral_time = 1;
}

message RouteTargetMembership {
  RouteTargetMembershipConfig config = 1;
  RouteTargetMembershipState state = 2;
}

message LongLivedGracefulRestartConfig {
  bool enabled = 1;
  uint32 restart_time = 2;
}

message LongLivedGracefulRestartState {
  bool enabled = 1;
  bool received = 2;
  bool advertised = 3;
  uint32 peer_restart_time = 4;
  bool peer_restart_timer_expired = 5;
}

message LongLivedGracefulRestart {
  LongLivedGracefulRestartConfig config = 1;
  LongLivedGracefulRestartState state = 2;
}

message AfiSafi {
  MpGracefulRestart mp_graceful_restart = 1;
  AfiSafiConfig config = 2;
  ApplyPolicy apply_policy = 3;
  // TODO:
  // Support the following structures:
  // - Ipv4Unicast
  // - Ipv6Unicast
  // - Ipv4LabelledUnicast
  // - Ipv6LabelledUnicast
  // - L3vpnIpv4Unicast
  // - L3vpnIpv6Unicast
  // - L3vpnIpv4Multicast
  // - L3vpnIpv6Multicast
  // - L2vpnVpls
  // - L2vpnEvpn
  RouteSelectionOptions route_selection_options = 4;
  UseMultiplePaths use_multiple_paths = 5;
  PrefixLimit prefix_limits = 6;
  RouteTargetMembership route_target_membership = 7;
  LongLivedGracefulRestart long_lived_graceful_restart = 8;
  AddPaths add_paths = 9;
}

message AddPathsConfig {
  bool receive = 1;
  uint32 send_max = 2;
}

message AddPathsState {
  bool receive = 1;
  uint32 send_max = 2;
}

message AddPaths {
  AddPathsConfig config = 1;
  AddPathsState state = 2;
}

message Prefix {
  string ip_prefix  = 1;
  uint32 mask_length_min = 2;
  uint32 mask_length_max = 3;
}

enum DefinedType {
  PREFIX = 0;
  NEIGHBOR = 1;
  TAG = 2;
  AS_PATH = 3;
  COMMUNITY = 4;
  EXT_COMMUNITY = 5;
  LARGE_COMMUNITY = 6;
  NEXT_HOP = 7;
}

message DefinedSet {
  DefinedType type = 1;
  string name = 2;
  repeated string list = 3;
  repeated Prefix prefixes = 4;
}

enum MatchType {
  ANY = 0;
  ALL = 1;
  INVERT = 2;
}

message MatchSet {
  MatchType type = 1;
  string name = 2;
}

enum AsPathLengthType {
  EQ = 0;
  GE = 1;
  LE = 2;
}

message AsPathLength {
  AsPathLengthType type = 1;
  uint32 length = 2;
}

message Conditions {
  MatchSet prefix_set = 1;
  MatchSet neighbor_set = 2;
  AsPathLength as_path_length = 3;
  MatchSet as_path_set = 4;
  MatchSet community_set = 5;
  MatchSet ext_community_set = 6;
  int32 rpki_result = 7;
  enum RouteType {
    ROUTE_TYPE_NONE = 0;
    ROUTE_TYPE_INTERNAL = 1;
    ROUTE_TYPE_EXTERNAL = 2;
    ROUTE_TYPE_LOCAL = 3;
  }
  RouteType route_type = 8;
  MatchSet large_community_set = 9;
  repeated string next_hop_in_list = 10;
  repeated Family afi_safi_in = 11;
}

enum RouteAction {
  NONE = 0;
  ACCEPT = 1;
  REJECT = 2;
}

enum CommunityActionType {
  COMMUNITY_ADD = 0;
  COMMUNITY_REMOVE = 1;
  COMMUNITY_REPLACE = 2;
}

message CommunityAction {
  CommunityActionType type = 1;
  repeated string communities = 2;
}

enum MedActionType {
  MED_MOD = 0;
  MED_REPLACE = 1;
}

message MedAction {
  MedActionType type = 1;
  int64 value = 2;
}

message AsPrependAction {
  uint32 asn = 1;
  uint32 repeat = 2;
  bool use_left_most = 3;
}

message NexthopAction {
  string address = 1;
  bool self = 2;
}

message LocalPrefAction {
  uint32 value = 1;
}

message Actions {
  RouteAction route_action = 1;
  CommunityAction community = 2;
  MedAction med = 3;
  AsPrependAction as_prepend = 4;
  CommunityAction ext_community = 5;
  NexthopAction nexthop = 6;
  LocalPrefAction local_pref = 7;
  CommunityAction large_community = 8;
}

message Statement {
  string name = 1;
  Conditions conditions = 2;
  Actions actions = 3;
}

message Policy {
  string name = 1;
  repeated Statement statements = 2;
}

enum PolicyType {
  IN = 0;
  IMPORT = 1;
  EXPORT = 2;
}

message PolicyAssignment {
  PolicyType type = 1;
  Resource resource = 2;
  string name = 3;
  repeated Policy policies = 4;
  RouteAction default = 5;
}

message RoutingPolicy {
  repeated DefinedSet defined_set = 1;
  repeated Policy policy_definition = 2;
}

message Roa {
  uint32 as = 1;
  uint32 prefixlen = 2;
  uint32 maxlen = 3;
  string prefix = 4;
  RPKIConf conf = 5;
}

message GetRoaRequest {
  uint32 family = 1;
}

message GetRoaResponse {
  repeated Roa roas = 1;
}

message Vrf {
  string name = 1;
  // Route Distinguisher must be one of
  // RouteDistinguisherTwoOctetAS,
  // RouteDistinguisherIPAddressAS,
  // or RouteDistinguisherFourOctetAS.
  google.protobuf.Any rd = 2;
  // List of the Import Route Targets. Each must be one of
  // TwoOctetAsSpecificExtended,
  // IPv4AddressSpecificExtended,
  // or FourOctetAsSpecificExtended.
  repeated google.protobuf.Any import_rt = 3;
  // List of the Export Route Targets. Each must be one of
  // TwoOctetAsSpecificExtended,
  // IPv4AddressSpecificExtended,
  // or FourOctetAsSpecificExtended.
  repeated google.protobuf.Any export_rt = 4;
  uint32 id = 5;
}

message DefaultRouteDistance {
  uint32 external_route_distance = 1;
  uint32 internal_route_distance = 2;
}

message Global {
  uint32 as = 1;
  string router_id = 2;
  int32 listen_port = 3;
  repeated string listen_addresses = 4;
  repeated uint32 families = 5;
  bool use_multiple_paths = 6;
  RouteSelectionOptionsConfig route_selection_options = 7;
  DefaultRouteDistance default_route_distance = 8;
  Confederation confederation = 9;
  GracefulRestart graceful_restart = 10;
  ApplyPolicy apply_policy = 11;
}

message Confederation {
  bool enabled = 1;
  uint32 identifier = 2;
  repeated uint32 member_as_list = 3;
}

message TableInfo {
  Resource type = 1;
  string name = 2;
  uint32 family = 3;
  uint64 num_destination = 4;
  uint64 num_path = 5;
  uint64 num_accepted = 6; // only meaningful when type == ADJ_IN
}

message GetRibInfoRequest {
    TableInfo info  = 1;
}

message GetRibInfoResponse {
    TableInfo info = 1;
}

message AddCollectorRequest {
  string url = 1;
  string db_name = 2;
  uint64 table_dump_interval = 3;
}

message AddCollectorResponse {
}

message ShutdownRequest{
}

message ShutdownResponse{
}