]> git.proxmox.com Git - mirror_frr.git/blob - bfdd/bfdd_nb.c
doc: Add `show ipv6 rpf X:X::X:X` command to docs
[mirror_frr.git] / bfdd / bfdd_nb.c
1 /*
2 * BFD daemon northbound implementation.
3 *
4 * Copyright (C) 2019 Network Device Education Foundation, Inc. ("NetDEF")
5 * Rafael Zalamena
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301 USA.
21 */
22
23 #include <zebra.h>
24
25 #include "lib/log.h"
26 #include "lib/northbound.h"
27
28 #include "bfdd_nb.h"
29
30 /* clang-format off */
31 const struct frr_yang_module_info frr_bfdd_info = {
32 .name = "frr-bfdd",
33 .nodes = {
34 {
35 .xpath = "/frr-bfdd:bfdd/bfd",
36 .cbs = {
37 .create = bfdd_bfd_create,
38 .destroy = bfdd_bfd_destroy,
39 .cli_show = bfd_cli_show_header,
40 .cli_show_end = bfd_cli_show_header_end,
41 }
42 },
43 {
44 .xpath = "/frr-bfdd:bfdd/bfd/profile",
45 .cbs = {
46 .create = bfdd_bfd_profile_create,
47 .destroy = bfdd_bfd_profile_destroy,
48 .cli_show = bfd_cli_show_profile,
49 .cli_show_end = bfd_cli_show_peer_end,
50 }
51 },
52 {
53 .xpath = "/frr-bfdd:bfdd/bfd/profile/detection-multiplier",
54 .cbs = {
55 .modify = bfdd_bfd_profile_detection_multiplier_modify,
56 .cli_show = bfd_cli_show_mult,
57 }
58 },
59 {
60 .xpath = "/frr-bfdd:bfdd/bfd/profile/desired-transmission-interval",
61 .cbs = {
62 .modify = bfdd_bfd_profile_desired_transmission_interval_modify,
63 .cli_show = bfd_cli_show_tx,
64 }
65 },
66 {
67 .xpath = "/frr-bfdd:bfdd/bfd/profile/required-receive-interval",
68 .cbs = {
69 .modify = bfdd_bfd_profile_required_receive_interval_modify,
70 .cli_show = bfd_cli_show_rx,
71 }
72 },
73 {
74 .xpath = "/frr-bfdd:bfdd/bfd/profile/administrative-down",
75 .cbs = {
76 .modify = bfdd_bfd_profile_administrative_down_modify,
77 .cli_show = bfd_cli_show_shutdown,
78 }
79 },
80 {
81 .xpath = "/frr-bfdd:bfdd/bfd/profile/passive-mode",
82 .cbs = {
83 .modify = bfdd_bfd_profile_passive_mode_modify,
84 .cli_show = bfd_cli_show_passive,
85 }
86 },
87 {
88 .xpath = "/frr-bfdd:bfdd/bfd/profile/minimum-ttl",
89 .cbs = {
90 .modify = bfdd_bfd_profile_minimum_ttl_modify,
91 .destroy = bfdd_bfd_profile_minimum_ttl_destroy,
92 .cli_show = bfd_cli_show_minimum_ttl,
93 }
94 },
95 {
96 .xpath = "/frr-bfdd:bfdd/bfd/profile/echo-mode",
97 .cbs = {
98 .modify = bfdd_bfd_profile_echo_mode_modify,
99 .cli_show = bfd_cli_show_echo,
100 }
101 },
102 {
103 .xpath = "/frr-bfdd:bfdd/bfd/profile/desired-echo-transmission-interval",
104 .cbs = {
105 .modify = bfdd_bfd_profile_desired_echo_transmission_interval_modify,
106 .cli_show = bfd_cli_show_desired_echo_transmission_interval,
107 }
108 },
109 {
110 .xpath = "/frr-bfdd:bfdd/bfd/profile/required-echo-receive-interval",
111 .cbs = {
112 .modify = bfdd_bfd_profile_required_echo_receive_interval_modify,
113 .cli_show = bfd_cli_show_required_echo_receive_interval,
114 }
115 },
116 {
117 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop",
118 .cbs = {
119 .create = bfdd_bfd_sessions_single_hop_create,
120 .destroy = bfdd_bfd_sessions_single_hop_destroy,
121 .get_next = bfdd_bfd_sessions_single_hop_get_next,
122 .get_keys = bfdd_bfd_sessions_single_hop_get_keys,
123 .lookup_entry = bfdd_bfd_sessions_single_hop_lookup_entry,
124 .cli_show = bfd_cli_show_single_hop_peer,
125 .cli_show_end = bfd_cli_show_peer_end,
126 }
127 },
128 {
129 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/source-addr",
130 .cbs = {
131 .modify = bfdd_bfd_sessions_single_hop_source_addr_modify,
132 .destroy = bfdd_bfd_sessions_single_hop_source_addr_destroy,
133 }
134 },
135 {
136 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/profile",
137 .cbs = {
138 .modify = bfdd_bfd_sessions_single_hop_profile_modify,
139 .destroy = bfdd_bfd_sessions_single_hop_profile_destroy,
140 .cli_show = bfd_cli_peer_profile_show,
141 }
142 },
143 {
144 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/detection-multiplier",
145 .cbs = {
146 .modify = bfdd_bfd_sessions_single_hop_detection_multiplier_modify,
147 .cli_show = bfd_cli_show_mult,
148 }
149 },
150 {
151 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/desired-transmission-interval",
152 .cbs = {
153 .modify = bfdd_bfd_sessions_single_hop_desired_transmission_interval_modify,
154 .cli_show = bfd_cli_show_tx,
155 }
156 },
157 {
158 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/required-receive-interval",
159 .cbs = {
160 .modify = bfdd_bfd_sessions_single_hop_required_receive_interval_modify,
161 .cli_show = bfd_cli_show_rx,
162 }
163 },
164 {
165 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/administrative-down",
166 .cbs = {
167 .modify = bfdd_bfd_sessions_single_hop_administrative_down_modify,
168 .cli_show = bfd_cli_show_shutdown,
169 }
170 },
171 {
172 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/passive-mode",
173 .cbs = {
174 .modify = bfdd_bfd_sessions_single_hop_passive_mode_modify,
175 .cli_show = bfd_cli_show_passive,
176 }
177 },
178 {
179 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/echo-mode",
180 .cbs = {
181 .modify = bfdd_bfd_sessions_single_hop_echo_mode_modify,
182 .cli_show = bfd_cli_show_echo,
183 }
184 },
185 {
186 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/desired-echo-transmission-interval",
187 .cbs = {
188 .modify = bfdd_bfd_sessions_single_hop_desired_echo_transmission_interval_modify,
189 .cli_show = bfd_cli_show_desired_echo_transmission_interval,
190 }
191 },
192 {
193 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/required-echo-receive-interval",
194 .cbs = {
195 .modify = bfdd_bfd_sessions_single_hop_required_echo_receive_interval_modify,
196 .cli_show = bfd_cli_show_required_echo_receive_interval,
197 }
198 },
199 {
200 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/local-discriminator",
201 .cbs = {
202 .get_elem = bfdd_bfd_sessions_single_hop_stats_local_discriminator_get_elem,
203 }
204 },
205 {
206 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/local-state",
207 .cbs = {
208 .get_elem = bfdd_bfd_sessions_single_hop_stats_local_state_get_elem,
209 }
210 },
211 {
212 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/local-diagnostic",
213 .cbs = {
214 .get_elem = bfdd_bfd_sessions_single_hop_stats_local_diagnostic_get_elem,
215 }
216 },
217 {
218 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/local-multiplier",
219 .cbs = {
220 .get_elem = bfdd_bfd_sessions_single_hop_stats_local_multiplier_get_elem,
221 }
222 },
223 {
224 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/remote-discriminator",
225 .cbs = {
226 .get_elem = bfdd_bfd_sessions_single_hop_stats_remote_discriminator_get_elem,
227 }
228 },
229 {
230 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/remote-state",
231 .cbs = {
232 .get_elem = bfdd_bfd_sessions_single_hop_stats_remote_state_get_elem,
233 }
234 },
235 {
236 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/remote-diagnostic",
237 .cbs = {
238 .get_elem = bfdd_bfd_sessions_single_hop_stats_remote_diagnostic_get_elem,
239 }
240 },
241 {
242 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/remote-multiplier",
243 .cbs = {
244 .get_elem = bfdd_bfd_sessions_single_hop_stats_remote_multiplier_get_elem,
245 }
246 },
247 {
248 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/negotiated-transmission-interval",
249 .cbs = {
250 .get_elem = bfdd_bfd_sessions_single_hop_stats_negotiated_transmission_interval_get_elem,
251 }
252 },
253 {
254 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/negotiated-receive-interval",
255 .cbs = {
256 .get_elem = bfdd_bfd_sessions_single_hop_stats_negotiated_receive_interval_get_elem,
257 }
258 },
259 {
260 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/detection-mode",
261 .cbs = {
262 .get_elem = bfdd_bfd_sessions_single_hop_stats_detection_mode_get_elem,
263 }
264 },
265 {
266 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/last-down-time",
267 .cbs = {
268 .get_elem = bfdd_bfd_sessions_single_hop_stats_last_down_time_get_elem,
269 }
270 },
271 {
272 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/last-up-time",
273 .cbs = {
274 .get_elem = bfdd_bfd_sessions_single_hop_stats_last_up_time_get_elem,
275 }
276 },
277 {
278 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/session-down-count",
279 .cbs = {
280 .get_elem = bfdd_bfd_sessions_single_hop_stats_session_down_count_get_elem,
281 }
282 },
283 {
284 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/session-up-count",
285 .cbs = {
286 .get_elem = bfdd_bfd_sessions_single_hop_stats_session_up_count_get_elem,
287 }
288 },
289 {
290 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/control-packet-input-count",
291 .cbs = {
292 .get_elem = bfdd_bfd_sessions_single_hop_stats_control_packet_input_count_get_elem,
293 }
294 },
295 {
296 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/control-packet-output-count",
297 .cbs = {
298 .get_elem = bfdd_bfd_sessions_single_hop_stats_control_packet_output_count_get_elem,
299 }
300 },
301 {
302 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/negotiated-echo-transmission-interval",
303 .cbs = {
304 .get_elem = bfdd_bfd_sessions_single_hop_stats_negotiated_echo_transmission_interval_get_elem,
305 }
306 },
307 {
308 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/echo-packet-input-count",
309 .cbs = {
310 .get_elem = bfdd_bfd_sessions_single_hop_stats_echo_packet_input_count_get_elem,
311 }
312 },
313 {
314 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/echo-packet-output-count",
315 .cbs = {
316 .get_elem = bfdd_bfd_sessions_single_hop_stats_echo_packet_output_count_get_elem,
317 }
318 },
319 {
320 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop",
321 .cbs = {
322 .create = bfdd_bfd_sessions_multi_hop_create,
323 .destroy = bfdd_bfd_sessions_multi_hop_destroy,
324 .get_next = bfdd_bfd_sessions_multi_hop_get_next,
325 .get_keys = bfdd_bfd_sessions_multi_hop_get_keys,
326 .lookup_entry = bfdd_bfd_sessions_multi_hop_lookup_entry,
327 .cli_show = bfd_cli_show_multi_hop_peer,
328 .cli_show_end = bfd_cli_show_peer_end,
329 }
330 },
331 {
332 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/profile",
333 .cbs = {
334 .modify = bfdd_bfd_sessions_single_hop_profile_modify,
335 .destroy = bfdd_bfd_sessions_single_hop_profile_destroy,
336 .cli_show = bfd_cli_peer_profile_show,
337 }
338 },
339 {
340 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/detection-multiplier",
341 .cbs = {
342 .modify = bfdd_bfd_sessions_single_hop_detection_multiplier_modify,
343 .cli_show = bfd_cli_show_mult,
344 }
345 },
346 {
347 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/desired-transmission-interval",
348 .cbs = {
349 .modify = bfdd_bfd_sessions_single_hop_desired_transmission_interval_modify,
350 .cli_show = bfd_cli_show_tx,
351 }
352 },
353 {
354 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/required-receive-interval",
355 .cbs = {
356 .modify = bfdd_bfd_sessions_single_hop_required_receive_interval_modify,
357 .cli_show = bfd_cli_show_rx,
358 }
359 },
360 {
361 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/administrative-down",
362 .cbs = {
363 .modify = bfdd_bfd_sessions_single_hop_administrative_down_modify,
364 .cli_show = bfd_cli_show_shutdown,
365 }
366 },
367 {
368 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/passive-mode",
369 .cbs = {
370 .modify = bfdd_bfd_sessions_single_hop_passive_mode_modify,
371 .cli_show = bfd_cli_show_passive,
372 }
373 },
374 {
375 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/minimum-ttl",
376 .cbs = {
377 .modify = bfdd_bfd_sessions_multi_hop_minimum_ttl_modify,
378 .destroy = bfdd_bfd_sessions_multi_hop_minimum_ttl_destroy,
379 .cli_show = bfd_cli_show_minimum_ttl,
380 }
381 },
382 {
383 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/local-discriminator",
384 .cbs = {
385 .get_elem = bfdd_bfd_sessions_single_hop_stats_local_discriminator_get_elem,
386 }
387 },
388 {
389 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/local-state",
390 .cbs = {
391 .get_elem = bfdd_bfd_sessions_single_hop_stats_local_state_get_elem,
392 }
393 },
394 {
395 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/local-diagnostic",
396 .cbs = {
397 .get_elem = bfdd_bfd_sessions_single_hop_stats_local_diagnostic_get_elem,
398 }
399 },
400 {
401 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/local-multiplier",
402 .cbs = {
403 .get_elem = bfdd_bfd_sessions_single_hop_stats_local_multiplier_get_elem,
404 }
405 },
406 {
407 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/remote-discriminator",
408 .cbs = {
409 .get_elem = bfdd_bfd_sessions_single_hop_stats_remote_discriminator_get_elem,
410 }
411 },
412 {
413 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/remote-state",
414 .cbs = {
415 .get_elem = bfdd_bfd_sessions_single_hop_stats_remote_state_get_elem,
416 }
417 },
418 {
419 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/remote-diagnostic",
420 .cbs = {
421 .get_elem = bfdd_bfd_sessions_single_hop_stats_remote_diagnostic_get_elem,
422 }
423 },
424 {
425 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/remote-multiplier",
426 .cbs = {
427 .get_elem = bfdd_bfd_sessions_single_hop_stats_remote_multiplier_get_elem,
428 }
429 },
430 {
431 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/negotiated-transmission-interval",
432 .cbs = {
433 .get_elem = bfdd_bfd_sessions_single_hop_stats_negotiated_transmission_interval_get_elem,
434 }
435 },
436 {
437 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/negotiated-receive-interval",
438 .cbs = {
439 .get_elem = bfdd_bfd_sessions_single_hop_stats_negotiated_receive_interval_get_elem,
440 }
441 },
442 {
443 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/detection-mode",
444 .cbs = {
445 .get_elem = bfdd_bfd_sessions_single_hop_stats_detection_mode_get_elem,
446 }
447 },
448 {
449 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/last-down-time",
450 .cbs = {
451 .get_elem = bfdd_bfd_sessions_single_hop_stats_last_down_time_get_elem,
452 }
453 },
454 {
455 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/last-up-time",
456 .cbs = {
457 .get_elem = bfdd_bfd_sessions_single_hop_stats_last_up_time_get_elem,
458 }
459 },
460 {
461 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/session-down-count",
462 .cbs = {
463 .get_elem = bfdd_bfd_sessions_single_hop_stats_session_down_count_get_elem,
464 }
465 },
466 {
467 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/session-up-count",
468 .cbs = {
469 .get_elem = bfdd_bfd_sessions_single_hop_stats_session_up_count_get_elem,
470 }
471 },
472 {
473 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/control-packet-input-count",
474 .cbs = {
475 .get_elem = bfdd_bfd_sessions_single_hop_stats_control_packet_input_count_get_elem,
476 }
477 },
478 {
479 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/control-packet-output-count",
480 .cbs = {
481 .get_elem = bfdd_bfd_sessions_single_hop_stats_control_packet_output_count_get_elem,
482 }
483 },
484 {
485 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/negotiated-echo-transmission-interval",
486 .cbs = {
487 .get_elem = bfdd_bfd_sessions_single_hop_stats_negotiated_echo_transmission_interval_get_elem,
488 }
489 },
490 {
491 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/echo-packet-input-count",
492 .cbs = {
493 .get_elem = bfdd_bfd_sessions_single_hop_stats_echo_packet_input_count_get_elem,
494 }
495 },
496 {
497 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/echo-packet-output-count",
498 .cbs = {
499 .get_elem = bfdd_bfd_sessions_single_hop_stats_echo_packet_output_count_get_elem,
500 }
501 },
502 {
503 .xpath = NULL,
504 },
505 }
506 };