summaryrefslogtreecommitdiffhomepage
path: root/api/gobgp.proto
blob: 95ebeb8b579cc8d0bf2ea84c888d7f0855b975bf (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
// Copyright (C) 2015 Nippon Telegraph and Telephone Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package gobgpapi;

// Interface exported by the server.

service GobgpApi {
  rpc GetGlobalConfig(Arguments) returns (Global) {}
  rpc ModGlobalConfig(ModGlobalConfigArguments) returns (Error) {}
  rpc GetNeighbors(Arguments) returns (stream Peer) {}
  rpc GetNeighbor(Arguments) returns (Peer) {}
  rpc ModNeighbor(ModNeighborArguments) returns(Error) {}
  rpc GetRib(Arguments) returns (stream Destination) {}
  rpc Reset(Arguments) returns (Error) {}
  rpc SoftReset(Arguments) returns (Error) {}
  rpc SoftResetIn(Arguments) returns (Error) {}
  rpc SoftResetOut(Arguments) returns (Error) {}
  rpc Shutdown(Arguments) returns (Error) {}
  rpc Enable(Arguments) returns (Error) {}
  rpc Disable(Arguments) returns (Error) {}
  rpc ModPath(stream ModPathArguments) returns (Error) {}
  rpc MonitorBestChanged(Arguments) returns (stream Destination) {}
  rpc MonitorPeerState(Arguments) returns (stream Peer) {}
  rpc GetMrt(MrtArguments) returns (stream MrtMessage) {}
  rpc GetRPKI(Arguments) returns (stream RPKI) {}
  rpc GetROA(Arguments) returns (stream ROA) {}
  rpc GetVrfs(Arguments) returns (stream Vrf) {}
  rpc ModVrf(ModVrfArguments) returns (Error) {}
  rpc GetDefinedSet(DefinedSet) returns (DefinedSet) {}
  rpc GetDefinedSets(DefinedSet) returns (stream DefinedSet) {}
  rpc ModDefinedSet(ModDefinedSetArguments) returns (Error) {}
  rpc GetStatement(Statement) returns (Statement) {}
  rpc GetStatements(Statement) returns (stream Statement) {}
  rpc ModStatement(ModStatementArguments) returns (Error) {}
  rpc GetPolicy(Policy) returns (Policy) {}
  rpc GetPolicies(Policy) returns (stream Policy) {}
  rpc ModPolicy(ModPolicyArguments) returns (Error) {}
  rpc GetPolicyAssignment(PolicyAssignment) returns (PolicyAssignment) {}
  rpc ModPolicyAssignment(ModPolicyAssignmentArguments) returns (Error) {}
}

message Error {
    enum ErrorCode {
        SUCCESS = 0;
        FAIL = 1;
    }
    ErrorCode code = 1;
    string msg = 2;
}

message Arguments {
    Resource resource = 1;
    uint32 rf = 2;
    string name = 3;
}

message ModPathArguments {
    Resource resource = 1;
    string name = 2;
    repeated Path paths = 3;
}

message ModNeighborArguments {
    Operation operation = 1;
    Peer peer = 2;
}
message MrtArguments {
    Resource resource = 1;
    uint32 rf = 2;
    uint64 interval = 3;
    string neighbor_address = 4;
}

message ModVrfArguments {
    Operation operation = 1;
    Vrf vrf = 2;
}

message ModDefinedSetArguments {
    Operation operation = 1;
    DefinedSet set = 2;
}

message ModStatementArguments {
    Operation operation = 1;
    Statement statement = 2;
}

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

message ModPolicyAssignmentArguments {
    Operation operation = 1;
    PolicyAssignment assignment = 2;
}

message ModGlobalConfigArguments {
    Operation operation = 1;
    Global global = 2;
}

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

enum Operation {
    ADD = 0;
    DEL = 1;
    DEL_ALL = 2;
    REPLACE = 3;
}

message Path {
    bytes nlri = 1;
    repeated bytes pattrs = 2;
    int64 age = 3;
    bool best = 4;
    bool is_withdraw = 5;
    int32 validation = 6;
    bool no_implicit_withdraw = 7;
    uint32 rf = 8;
    uint32 source_asn = 9;
    string source_id = 10;
    bool filtered = 11;
}

message Destination {
    string prefix = 1;
    repeated Path paths = 2;
}

message Peer {
  AddPaths addpaths = 1;
  AfiSafis afisafis = 2;
  ApplyPolicy apply_policy = 3;
  AsPathOptions as_path_options = 4;
  PeerConf conf = 5;
  EbgpMultihop ebgp_multihop = 6;
  ErrorHandling error_handling = 7;
  PeerGracefulRestart graceful_restart = 8;
  LoggingOptions logging_options = 9;
  string nighbor_address = 10;
  RouteReflector route_reflector = 11;
  PeerState info = 12;
  Timers timers = 13;
  Transport transport = 14;
  UseMultiplePaths use_multiple_paths = 15;
  RouteServer route_server = 16;
}

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

message AfiSafis {
  repeated AfiSafi afisafi = 1;
}

message AfiSafi {
  string name = 1;
  ApplyPolicy apply_policy = 2;
  bool enabled = 3;
  AfiSafiGracefulRestart graceful_restart = 4;
  LabelledUnicast ipv4_labelled_unicast = 5;
  Unicast ipv4_unicast = 6;
  LabelledUnicast ipv6_labelled_unicast = 7;
  Unicast ipv6_unicast = 8;
  Vpn l2_vpn_evpn = 9;
  Vpn l2_vpn_vpls = 10;
  Vpn l3_vpn_ipv4_multicast = 11;
  Vpn l3_vpn_ipv4_unicast = 12;
  Vpn l3_vpn_ipv6_multicast = 13;
  Vpn l3_vpn_ipv6_unicast = 14;
  UseMultiplePaths use_multiple_paths = 15;
  bool active = 16;
  Prefixes prefixes = 17;
 }

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

message AfiSafiGracefulRestart {
  bool advertised = 1;
  bool enabled = 2;
  bool received = 3;
}

message LabelledUnicast {
  PrefixLimit prefix_limit = 1;
}

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

message Unicast {
  bool send_default_route = 1;
  PrefixLimit prefix_limit = 2;
}

message Vpn {
  PrefixLimit prefix_limit = 1;
}

message Prefixes {
  uint32 installed = 1;
  uint32 received = 2;
  uint32 sent = 3;
}

message UseMultiplePaths {
  bool enabled = 1;
  Ebgp ebgp = 2;
}

message Ebgp {
  bool allow_multiple_as = 1;
}

message AsPathOptions {
  uint32 allow_own_as = 1;
  bool replace_peer_as = 2;
}

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;
  uint32 remove_private_as = 8;
  bool route_flap_damping = 9;
  uint32 send_community = 10;
  repeated bytes remote_cap = 11;
  repeated bytes local_cap = 12;
}

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

message ErrorHandling {
  uint32 erroneous_update_messages = 1;
  bool treat_as_withdraw = 2;
}

message PeerGracefulRestart {
  bool enabled = 1;
  bool helper_only = 2;
  bool local_restarting = 3;
  uint32 mode = 4;
  uint32 peer_restart_time = 5;
  bool peer_restarting = 6;
  uint32 restart_time = 7;
  uint64 stale_routes_time = 8;
}

message LoggingOptions {
  bool logNeighbor_state_changes = 1;
}

message RouteReflector {
  bool route_reflector_client = 1;
  uint32 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;
  string admin_state = 16;
  uint32 received = 17;
  uint32 accepted = 18;
  uint32 advertized = 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 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;
}

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 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 Actions {
    RouteAction route_action = 1;
    CommunityAction community = 2;
    MedAction med = 3;
    AsPrependAction as_prepend = 4;
    CommunityAction ext_community = 5;
}

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 MrtMessage {
    bytes data = 1;
}

message RPKIConf {
    string address = 1;
}

message RPKIState {
    int64 uptime = 1;
    int64 downtime = 2;
    int32 received_ipv4 = 3;
    int32 received_ipv6 = 4;
}

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

message ROA {
    uint32 as = 1;
    uint32 prefixlen = 2;
    uint32 maxlen = 3;
    string prefix = 4;
}

message Vrf {
    string name = 1;
    bytes rd = 2;
    repeated bytes import_rt = 3;
    repeated bytes export_rt = 4;
}

message Global {
    uint32 as = 1;
    string router_id = 2;
}