summaryrefslogtreecommitdiffhomepage
path: root/api/gobgp.proto
blob: 8484421418a06caf242ba9cbd437bb57b5dc1ace (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
// 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 api;

// Interface exported by the server.

service Grpc {
  rpc GetNeighbors(Arguments) returns (stream Peer) {}
  rpc GetNeighbor(Arguments) returns (Peer) {}
  rpc GetRib(Arguments) returns (stream Destination) {}
  rpc GetAdjRib(Arguments) returns (stream Path) {}
  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 GetNeighborPolicy(Arguments) returns (ApplyPolicy) {}
  rpc ModNeighborPolicy(stream PolicyArguments) returns (stream Error) {}
  rpc GetPolicyRoutePolicies(PolicyArguments) returns (stream PolicyDefinition) {}
  rpc GetPolicyRoutePolicy(PolicyArguments) returns (PolicyDefinition) {}
  rpc ModPolicyRoutePolicy(stream PolicyArguments) returns (stream Error) {}
  rpc MonitorBestChanged(Arguments) returns (stream Path) {}
  rpc MonitorPeerState(Arguments) returns (stream Peer) {}
  rpc GetMrt(MrtArguments) returns (stream MrtMessage) {}
  rpc GetRPKI(Arguments) returns (stream ROA) {}
}

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

message Arguments {
    Resource resource = 1;
    AddressFamily af = 2;
    string neighbor_address = 3;
}

message ModPathArguments {
    Resource resource = 1;
    bool is_withdraw = 2;
    bytes raw_nlri = 3;
    repeated bytes raw_pattrs = 4;
    bool no_implicit_withdraw = 5;
}

message PolicyArguments {
    Resource resource = 1;
    Operation operation = 2;
    string neighbor_address = 3;
    string name = 4;
    PolicyDefinition policy_definition = 6;
    ApplyPolicy apply_policy = 7;
}

message MrtArguments {
    Resource resource = 1;
    AddressFamily af = 2;
    uint64 interval = 3;
    string neighbor_address = 4;
}

enum Resource {
    GLOBAL = 0;
    LOCAL = 1;
    ADJ_IN = 2;
    ADJ_OUT = 3;
    POLICY_PREFIX = 4;
    POLICY_NEIGHBOR = 5;
    POLICY_ASPATH = 6;
    POLICY_COMMUNITY = 7;
    POLICY_ROUTEPOLICY = 8;
    POLICY_EXTCOMMUNITY = 9;
}

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

enum AFI {
    UNKNOWN_AFI = 0;
    IP = 1;
    IP6 = 2;
    L2VPN = 25;
}

enum SAFI {
    UNKNOWN_SAFI = 0;
    UNICAST = 1;
    MULTICAST = 2;
    MPLS_LABEL = 4;
    ENCAP = 7;
    VPLS = 65;
    EVPN = 70;
    MPLS_VPN = 128;
    MPLS_VPN_MULTICAST = 129;
    ROUTE_TARGET_CONSTRAINTS = 132;
}

message AddressFamily {
    AFI Afi = 1;
    SAFI Safi = 2;
}

enum ROUTE_DISTINGUISHER_TYPE {
    TWO_OCTET_AS = 0;
    IP4 = 1;
    FOUR_OCTET_AS = 2;
}

message RouteDistinguisher {
    ROUTE_DISTINGUISHER_TYPE type = 1;
    string admin = 2;
    uint32 assigned = 3;
}

enum BGP_CAPABILITY {
    UNKNOWN_CAP = 0;
    MULTIPROTOCOL = 1;
    ROUTE_REFRESH = 2;
    CARRYING_LABEL_INFO = 4;
    GRACEFUL_RESTART = 64;
    FOUR_OCTET_AS_NUMBER = 65;
    ENHANCED_ROUTE_REFRESH = 70;
    ROUTE_REFRESH_CISCO = 128;
}

message GracefulRestartTuple {
    AddressFamily af = 1;
    uint32 flags = 2;
}

message GracefulRestart {
    uint32 flags = 1;
    uint32 time = 2;
    repeated GracefulRestartTuple tuples = 3;
}

message Capability {
    BGP_CAPABILITY code = 1;
    AddressFamily multi_protocol = 2;
    GracefulRestart graceful_restart = 3;
    uint32 asn = 4;
}

enum Origin {
    IGP = 0;
    EGP = 1;
    INCOMPLETE = 2;
}

message Aggregator {
    uint32 as = 1;
    string address = 2;
}

enum EXTENDED_COMMUNITIE_TYPE {
    TWO_OCTET_AS_SPECIFIC = 0;
    IP4_SPECIFIC = 1;
    FOUR_OCTET_AS_SPECIFIC = 2;
    OPAQUE = 3;
}

enum EXTENDED_COMMUNITIE_SUBTYPE {
    ORIGIN_VALIDATION = 0;
    ROUTE_TARGET = 2;
    ROUTE_ORIGIN = 3;
}

message ExtendedCommunity {
    EXTENDED_COMMUNITIE_TYPE type = 1;
    EXTENDED_COMMUNITIE_SUBTYPE subtype = 2;
    bool is_transitive = 3;
    uint32 asn = 4;
    string ipv4 = 5;
    uint32 local_admin = 6;
}

enum TUNNEL_TYPE {
    UNKNOWN_TUNNEL_TYPE = 0;
    L2TPV3_OVER_IP = 1;
    GRE = 2;
    IP_IN_IP = 7;
    VXLAN = 8;
    NVGRE = 9;
    MPLS = 10;
    MPLS_IN_GRE = 11;
    VXLAN_GRE = 12;
}

enum PMSI_TUNNEL_TYPE {
    NO_TUNNEL = 0;
    RSVP_TE_P2MP = 1;
    MLDP_P2MP = 2;
    PIM_SSM_TREE = 3;
    PIM_SM_TREE = 4;
    BIDIR_PIM_TREE = 5;
    INGRESS_REPL = 6;
    MLDP_MP2MP = 7;
}

enum EVPN_TYPE {
    UNKNOWN_EVPN_TYPE = 0;
    ROUTE_TYPE_ETHERNET_AUTO_DISCOVERY = 1;
    ROUTE_TYPE_MAC_IP_ADVERTISEMENT    = 2;
    INCLUSIVE_MULTICAST_ETHERNET_TAG   = 3;
    ETHERNET_SEGMENT_ROUTE             = 4;
}

message EVPNNlri {
    EVPN_TYPE type = 1;
//    EvpnAutoDiscoveryRoute = 2;
    EvpnMacIpAdvertisement mac_ip_adv = 3;
    EvpnInclusiveMulticastEthernetTag multicast_etag = 4;
//    EvpnEthernetSegmentRoute = 5;
}

message EvpnMacIpAdvertisement {
    string mac_addr = 1;
    uint32 mac_addr_len = 2;
    string ip_addr = 3;
    uint32 ip_addr_len = 4;
    string rd = 5;
    string esi = 6;
    uint32 etag = 7;
    repeated uint32 labels = 8;
}

message EvpnInclusiveMulticastEthernetTag {
    string rd = 1;
    uint32 etag = 2;
    string ip_addr = 3;
    uint32 ip_addr_len = 4;
}

message RTNlri {
    uint32 asn = 1;
    ExtendedCommunity target = 2;
    uint32 length = 3;
}

message VPNNlri {
    RouteDistinguisher rd = 1;
    repeated uint32 labels = 2;
    string ip_addr = 3;
    uint32 ip_addr_len = 4;
}

message Nlri {
    AddressFamily af = 1;
    string prefix = 2;
    string nexthop = 3;
    EVPNNlri evpn_nlri = 4;
    RTNlri rt_nlri = 5;
    VPNNlri vpn_nlri = 6;
}

enum ENCAP_SUBTLV_TYPE {
    UNKNOWN_SUBTLV_TYPE = 0;
    ENCAPSULATION = 1;
    PROTOCOL = 2;
    COLOR = 4;
}

message TunnelEncapSubTLV {
    ENCAP_SUBTLV_TYPE type = 1;
    string value = 2;
    uint32 key = 3;
    string cookie = 4;
    uint32 protocol = 5;
    uint32 color = 6;
}

message TunnelEncapTLV {
    TUNNEL_TYPE type = 1;
    repeated TunnelEncapSubTLV sub_tlv = 2;
}

message PmsiTunnel {
    bool is_leaf_info_required = 1;
    PMSI_TUNNEL_TYPE type = 2;
    uint32 label = 3;
    string tunnel_id = 4;
}

enum BGP_ATTR_TYPE {
    UNKNOWN_ATTR = 0;
    ORIGIN = 1;
    AS_PATH = 2;
    NEXT_HOP = 3;
    MULTI_EXIT_DISC = 4;
    LOCAL_PREF = 5;
    ATOMIC_AGGREGATE = 6;
    AGGREGATOR = 7;
    COMMUNITIES = 8;
    ORIGINATOR_ID = 9;
    CLUSTER_LIST = 10;
    MP_REACH_NLRI = 14;
    MP_UNREACH_NLRI = 15;
    EXTENDED_COMMUNITIES = 16;
    AS4_PATH = 17;
    AS4_AGGREGATOR = 18;
    PMSI_TUNNEL = 22;
    TUNNEL_ENCAP = 23;
}

message PathAttr {
    BGP_ATTR_TYPE type = 1;
    repeated string value = 2;
    Origin origin = 3;
    repeated AsPath as_paths = 4;
    string nexthop = 5;
    uint32 metric = 6;
    uint32 pref = 7;
    Aggregator aggregator = 8;
    repeated uint32 communites = 9;
    string originator = 10;
    repeated string cluster = 11;
    repeated Nlri nlri = 12;
    repeated TunnelEncapTLV tunnel_encap = 13;
    PmsiTunnel pmsi_tunnel = 14;
}

message AsPath {
    uint32 segment_type = 1;
    repeated uint32 asns = 2;
}

message Path {
    Nlri nlri = 1;
    string nexthop = 2;
    int64 age = 3;
    repeated PathAttr attrs = 4;
    bool best = 5;
    bool is_withdraw = 6;
}

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

message PeerConf {
    string remote_ip = 1;
    string id = 2;
    uint32 remote_as = 3;
    bool cap_refresh = 4;
    bool cap_enhanced_refresh = 5;
    repeated Capability remote_cap = 6;
    repeated Capability local_cap = 7;
    uint32 holdtime = 8;
    uint32 keepalive_interval = 9;
}

message PeerInfo {
    string bgp_state = 1;
    string admin_state = 2;
    uint32 fsm_established_transitions = 3;
    uint64 total_message_out = 4;
    uint64 total_message_in = 5;
    uint64 update_message_out = 6;
    uint64 update_message_in = 7;
    uint64 keep_alive_message_out = 8;
    uint64 keep_alive_message_in = 9;
    uint64 open_message_out = 10;
    uint64 open_message_in = 11;
    uint64 notification_out = 12;
    uint64 notification_in = 13;
    uint64 refresh_message_out = 14;
    uint64 refresh_message_in = 15;
    uint64 discarded_out = 16;
    uint64 discarded_in = 17;
    int64 uptime = 18;
    int64 downtime = 19;
    string last_error = 20;
    uint32 received = 21;
    uint32 accepted = 22;
    uint32 advertized = 23;
    uint32 out_q = 24;
    uint32 flops = 25;
    uint32 negotiated_holdtime = 26;
    uint32 keepalive_interval = 27;
}

message Peer {
    PeerConf conf = 1;
    PeerInfo info = 2;
}

message Prefix {
    string address  = 1;
    uint32 mask_length = 2;
    string mask_length_range = 3;
}

message PrefixSet {
    string prefix_set_name = 1;
    repeated Prefix prefix_list = 2;
    string match_set_options = 3;
}

message Neighbor {
    string address = 1;
}

message NeighborSet {
    string neighbor_set_name = 1;
    repeated Neighbor neighbor_list = 2;
    string match_set_options = 3;
}

message AsPathLength {
    string value = 1;
    string operator = 2;
}

message AsPathSet {
    string as_path_set_name = 1;
    repeated string as_path_members = 2;
    string match_set_options = 3;
}

message CommunitySet {
    string community_set_name = 1;
    repeated string community_members = 2;
    string match_set_options = 3;
}

message ExtCommunitySet {
    string ext_community_set_name = 1;
    repeated string ext_community_members = 2;
    string match_set_options = 3;
}

message Conditions {
    PrefixSet match_prefix_set = 1;
    NeighborSet match_neighbor_set = 2;
    AsPathLength match_as_path_length = 3;
    AsPathSet match_as_path_set = 4;
    CommunitySet match_community_set = 5;
    ExtCommunitySet match_ext_community_set = 6;
}

message CommunityAction {
    repeated string communities = 1;
    string options = 2;
}

message AsPrependAction {
    string as = 1;
    uint32 repeatn = 2;
}

message Actions {
    string route_action = 1;
    CommunityAction community = 2;
    string med = 3;
    AsPrependAction as_prepend = 4;
}

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

message PolicyDefinition {
    string policy_definition_name = 1;
    repeated Statement statement_list = 2;
}

message ApplyPolicy {
    repeated PolicyDefinition import_policies = 1;
    string default_import_policy = 2;
    repeated PolicyDefinition export_policies = 3;
    string default_export_policy = 4;
    repeated PolicyDefinition distribute_policies = 5;
    string default_distribute_policy = 6;
}

message MrtMessage {
    bytes data = 1;
}

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