summaryrefslogtreecommitdiffstats
path: root/src/vnet/bfd/bfd.api
blob: d3b3ed21a263805203ec256c74a4ce6af220b659 (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
/*
 * Copyright (c) 2015-2016 Cisco and/or its affiliates.
 * 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.
 */

option version = "2.0.0";

import "vnet/interface_types.api";
import "vnet/ip/ip_types.api";

enum bfd_state {
  BFD_STATE_API_ADMIN_DOWN = 0,
  BFD_STATE_API_DOWN = 1,
  BFD_STATE_API_INIT = 2,
  BFD_STATE_API_UP = 3,
};

/** \brief Set BFD echo source
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - interface to use as echo source
*/
autoreply define bfd_udp_set_echo_source
{
  u32 client_index;
  u32 context;
  vl_api_interface_index_t sw_if_index;
};

/** \brief Delete BFD echo source
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
autoreply define bfd_udp_del_echo_source
{
  u32 client_index;
  u32 context;
};

/** \brief Get BFD echo source
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
define bfd_udp_get_echo_source
{
  u32 client_index;
  u32 context;
};

/** \brief Get BFD echo source reply
    @param context - sender context, to match reply w/ request
    @param retval - return code
    @param sw_if_index - interface to use as echo source
    @param is_set - non-zero if set
    @param have_usable_ip4 - non-zero if have usable IPv4 address
    @param ip4_addr - IPv4 address
    @param have_usable_ip6 - non-zero if have usable IPv6 address
    @param ip6_addr - IPv6 address
*/
define bfd_udp_get_echo_source_reply
{
  u32 context;
  i32 retval;
  vl_api_interface_index_t sw_if_index;
  bool is_set;
  bool have_usable_ip4;
  vl_api_ip4_address_t ip4_addr;
  bool have_usable_ip6;
  vl_api_ip6_address_t ip6_addr;
};

/** \brief Add UDP BFD session on interface
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - sw index of the interface
    @param desired_min_tx - desired min transmit interval (microseconds)
    @param required_min_rx - required min receive interval (microseconds)
    @param local_addr - local address
    @param peer_addr - peer address
    @param is_ipv6 - local_addr, peer_addr are IPv6 if non-zero, otherwise IPv4
    @param detect_mult - detect multiplier (# of packets missed before connection goes down)
    @param is_authenticated - non-zero if authentication is required
    @param bfd_key_id - key id sent out in BFD packets (if is_authenticated)
    @param conf_key_id - id of already configured key (if is_authenticated)
*/
autoreply define bfd_udp_add
{
  u32 client_index;
  u32 context;
  vl_api_interface_index_t sw_if_index;
  u32 desired_min_tx;
  u32 required_min_rx;
  vl_api_address_t local_addr;
  vl_api_address_t peer_addr;
  u8 detect_mult;
  bool is_authenticated;
  u8 bfd_key_id;
  u32 conf_key_id;
};
define bfd_udp_upd
{
  u32 client_index;
  u32 context;
  vl_api_interface_index_t sw_if_index;
  u32 desired_min_tx;
  u32 required_min_rx;
  vl_api_address_t local_addr;
  vl_api_address_t peer_addr;
  u8 detect_mult;
  bool is_authenticated;
  u8 bfd_key_id;
  u32 conf_key_id;
};
define bfd_udp_upd_reply
{
  u32 context;
  i32 retval;
  u32 stats_index;
};

/** \brief Modify UDP BFD session on interface
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - sw index of the interface
    @param desired_min_tx - desired min transmit interval (microseconds)
    @param required_min_rx - required min receive interval (microseconds)
    @param local_addr - local address
    @param peer_addr - peer address
    @param is_ipv6 - local_addr, peer_addr are IPv6 if non-zero, otherwise IPv4
    @param detect_mult - detect multiplier (# of packets missed before connection goes down)
*/
autoreply define bfd_udp_mod
{
  u32 client_index;
  u32 context;
  vl_api_interface_index_t sw_if_index;
  u32 desired_min_tx;
  u32 required_min_rx;
  vl_api_address_t local_addr;
  vl_api_address_t peer_addr;
  u8 detect_mult;
};

/** \brief Delete UDP BFD session on interface
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - sw index of the interface
    @param local_addr - local address
    @param peer_addr - peer address
    @param is_ipv6 - local_addr, peer_addr are IPv6 if non-zero, otherwise IPv4
*/
autoreply define bfd_udp_del
{
  u32 client_index;
  u32 context;
  vl_api_interface_index_t sw_if_index;
  vl_api_address_t local_addr;
  vl_api_address_t peer_addr;
};

/** \brief Get all BFD sessions
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
define bfd_udp_session_dump
{
  u32 client_index;
  u32 context;
};

/** \brief BFD session details structure
    @param context - sender context, to match reply w/ request
    @param sw_if_index - sw index of the interface
    @param local_addr - local address
    @param peer_addr - peer address
    @param is_ipv6 - local_addr, peer_addr are IPv6 if non-zero, otherwise IPv4
    @param state - session state
    @param is_authenticated - non-zero if authentication in-use, zero otherwise
    @param bfd_key_id - ID of key currently in-use if auth is on
    @param conf_key_id - configured key ID for this session
    @param required_min_rx - required min receive interval (microseconds)
    @param desired_min_tx - desired min transmit interval (microseconds)
    @param detect_mult - detect multiplier (# of packets missed before connection goes down)
*/
define bfd_udp_session_details
{
  u32 context;
  vl_api_interface_index_t sw_if_index;
  vl_api_address_t local_addr;
  vl_api_address_t peer_addr;
  vl_api_bfd_state_t state;
  bool is_authenticated;
  u8 bfd_key_id;
  u32 conf_key_id;
  u32 required_min_rx;
  u32 desired_min_tx;
  u8 detect_mult;
};

/** \brief Set flags of BFD UDP session
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - sw index of the interface
    @param local_addr - local address
    @param peer_addr - peer address
    @param is_ipv6 - local_addr, peer_addr are IPv6 if non-zero, otherwise IPv4
    @param flags - set the admin state, 1 = up, 0 = down
*/
autoreply define bfd_udp_session_set_flags
{
  u32 client_index;
  u32 context;
  vl_api_interface_index_t sw_if_index;
  vl_api_address_t local_addr;
  vl_api_address_t peer_addr;
  vl_api_if_status_flags_t flags;
};

service {
  rpc want_bfd_events returns want_bfd_events_reply
    events bfd_udp_session_event;
};

/** \brief Register for BFD events
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param enable_disable - 1 => register for events, 0 => cancel registration
    @param pid - sender's pid
*/
autoreply define want_bfd_events
{
  u32 client_index;
  u32 context;
  bool enable_disable;
  u32 pid;
};

define bfd_udp_session_event
{
  u32 client_index;
  u32 pid;
  vl_api_interface_index_t sw_if_index;
  vl_api_address_t local_addr;
  vl_api_address_t peer_addr;
  vl_api_bfd_state_t state;
  bool is_authenticated;
  u8 bfd_key_id;
  u32 conf_key_id;
  u32 required_min_rx;
  u32 desired_min_tx;
  u8 detect_mult;
};

/** \brief BFD UDP - add/replace key to configuration
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param conf_key_id - key ID to add/replace/delete
    @param key_len - length of key (must be non-zero)
    @param auth_type - authentication type (RFC 5880/4.1/Auth Type)
    @param key - key data
*/
autoreply define bfd_auth_set_key
{
  u32 client_index;
  u32 context;
  u32 conf_key_id;
  u8 key_len;
  u8 auth_type;
  u8 key[20];
};

/** \brief BFD UDP - delete key from configuration
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param conf_key_id - key ID to add/replace/delete
    @param key_len - length of key (must be non-zero)
    @param key - key data
*/
autoreply define bfd_auth_del_key
{
  u32 client_index;
  u32 context;
  u32 conf_key_id;
};

/** \brief Get a list of configured authentication keys
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
define bfd_auth_keys_dump
{
  u32 client_index;
  u32 context;
};

/** \brief BFD authentication key details
    @param context - sender context, to match reply w/ request
    @param conf_key_id - configured key ID
    @param use_count - how many BFD sessions currently use this key
    @param auth_type - authentication type (RFC 5880/4.1/Auth Type)
*/
define bfd_auth_keys_details
{
  u32 context;
  u32 conf_key_id;
  u32 use_count;
  u8 auth_type;
};

/** \brief BFD UDP - activate/change authentication
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - sw index of the interface
    @param local_addr - local address
    @param peer_addr - peer address
    @param is_ipv6 - local_addr, peer_addr are IPv6 if non-zero, otherwise IPv4
    @param is_delayed - change is applied once peer applies the change (on first received packet with this auth)
    @param bfd_key_id - key id sent out in BFD packets
    @param conf_key_id - id of already configured key
*/
autoreply define bfd_udp_auth_activate
{
  u32 client_index;
  u32 context;
  vl_api_interface_index_t sw_if_index;
  vl_api_address_t local_addr;
  vl_api_address_t peer_addr;
  bool is_delayed;
  u8 bfd_key_id;
  u32 conf_key_id;
};

/** \brief BFD UDP - deactivate authentication
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - sw index of the interface
    @param local_addr - local address
    @param peer_addr - peer address
    @param is_ipv6 - local_addr, peer_addr are IPv6 if non-zero, otherwise IPv4
    @param is_delayed - change is applied once peer applies the change (on first received non-authenticated packet)
*/
autoreply define bfd_udp_auth_deactivate
{
  u32 client_index;
  u32 context;
  vl_api_interface_index_t sw_if_index;
  vl_api_address_t local_addr;
  vl_api_address_t peer_addr;
  bool is_delayed;
};

/* must be compatible with bfd_error_t */
counters bfd_udp {
  none {
    severity info;
    type counter64;
    units "packets";
    description "OK";
  };
  bad {
    severity error;
    type counter64;
    units "packets";
    description "bad packet";
  };
  disabled {
    severity error;
    type counter64;
    units "packets";
    description "bfd packets received on disabled interfaces";
  };
  version {
    severity error;
    type counter64;
    units "packets";
    description "version";
  };
  length {
    severity error;
    type counter64;
    units "packets";
    description "too short";
  };
  detect_multi {
    severity error;
    type counter64;
    units "packets";
    description "detect-multi";
  };
  multi_point {
    severity error;
    type counter64;
    units "packets";
    description "multi-point";
  };
  my_disc {
    severity error;
    type counter64;
    units "packets";
    description "my-disc";
  };
  your_disc {
    severity error;
    type counter64;
    units "packets";
    description "your-disc";
  };
  admin_down {
    severity error;
    type counter64;
    units "packets";
    description "session admin-down";
  };
  no_session {
    severity error;
    type counter64;
    units "packets";
    description "no-session";
  };
  failed_verification {
    severity error;
    type counter64;
    units "packets";
    description "failed-verification";
  };
  src_mismatch {
    severity error;
    type counter64;
    units "packets";
    description "src-mismatch";
  };
  dst_mismatch {
    severity error;
    type counter64;
    units "packets";
    description "dst-mismatch";
  };
  ttl {
    severity error;
    type counter64;
    units "packets";
    description "ttl";
  };
};

paths {
  "/err/bfd-udp4-input" "bfd";
  "/err/bfd-udp6-input" "bfd";
  "/err/bfd-udp4-echo-input" "bfd";
  "/err/bfd-udp6-echo-input" "bfd";
};

/*
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */