]> git.proxmox.com Git - mirror_frr.git/blob - bfdd/bfdd_nb.c
Merge pull request #5702 from vishaldhingra/bgp_nb
[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_echo_interval,
107 }
108 },
109 {
110 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop",
111 .cbs = {
112 .create = bfdd_bfd_sessions_single_hop_create,
113 .destroy = bfdd_bfd_sessions_single_hop_destroy,
114 .get_next = bfdd_bfd_sessions_single_hop_get_next,
115 .get_keys = bfdd_bfd_sessions_single_hop_get_keys,
116 .lookup_entry = bfdd_bfd_sessions_single_hop_lookup_entry,
117 .cli_show = bfd_cli_show_single_hop_peer,
118 .cli_show_end = bfd_cli_show_peer_end,
119 }
120 },
121 {
122 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/source-addr",
123 .cbs = {
124 .modify = bfdd_bfd_sessions_single_hop_source_addr_modify,
125 .destroy = bfdd_bfd_sessions_single_hop_source_addr_destroy,
126 }
127 },
128 {
129 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/profile",
130 .cbs = {
131 .modify = bfdd_bfd_sessions_single_hop_profile_modify,
132 .destroy = bfdd_bfd_sessions_single_hop_profile_destroy,
133 .cli_show = bfd_cli_peer_profile_show,
134 }
135 },
136 {
137 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/detection-multiplier",
138 .cbs = {
139 .modify = bfdd_bfd_sessions_single_hop_detection_multiplier_modify,
140 .cli_show = bfd_cli_show_mult,
141 }
142 },
143 {
144 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/desired-transmission-interval",
145 .cbs = {
146 .modify = bfdd_bfd_sessions_single_hop_desired_transmission_interval_modify,
147 .cli_show = bfd_cli_show_tx,
148 }
149 },
150 {
151 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/required-receive-interval",
152 .cbs = {
153 .modify = bfdd_bfd_sessions_single_hop_required_receive_interval_modify,
154 .cli_show = bfd_cli_show_rx,
155 }
156 },
157 {
158 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/administrative-down",
159 .cbs = {
160 .modify = bfdd_bfd_sessions_single_hop_administrative_down_modify,
161 .cli_show = bfd_cli_show_shutdown,
162 }
163 },
164 {
165 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/passive-mode",
166 .cbs = {
167 .modify = bfdd_bfd_sessions_single_hop_passive_mode_modify,
168 .cli_show = bfd_cli_show_passive,
169 }
170 },
171 {
172 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/echo-mode",
173 .cbs = {
174 .modify = bfdd_bfd_sessions_single_hop_echo_mode_modify,
175 .cli_show = bfd_cli_show_echo,
176 }
177 },
178 {
179 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/desired-echo-transmission-interval",
180 .cbs = {
181 .modify = bfdd_bfd_sessions_single_hop_desired_echo_transmission_interval_modify,
182 .cli_show = bfd_cli_show_echo_interval,
183 }
184 },
185 {
186 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/local-discriminator",
187 .cbs = {
188 .get_elem = bfdd_bfd_sessions_single_hop_stats_local_discriminator_get_elem,
189 }
190 },
191 {
192 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/local-state",
193 .cbs = {
194 .get_elem = bfdd_bfd_sessions_single_hop_stats_local_state_get_elem,
195 }
196 },
197 {
198 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/local-diagnostic",
199 .cbs = {
200 .get_elem = bfdd_bfd_sessions_single_hop_stats_local_diagnostic_get_elem,
201 }
202 },
203 {
204 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/local-multiplier",
205 .cbs = {
206 .get_elem = bfdd_bfd_sessions_single_hop_stats_local_multiplier_get_elem,
207 }
208 },
209 {
210 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/remote-discriminator",
211 .cbs = {
212 .get_elem = bfdd_bfd_sessions_single_hop_stats_remote_discriminator_get_elem,
213 }
214 },
215 {
216 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/remote-state",
217 .cbs = {
218 .get_elem = bfdd_bfd_sessions_single_hop_stats_remote_state_get_elem,
219 }
220 },
221 {
222 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/remote-diagnostic",
223 .cbs = {
224 .get_elem = bfdd_bfd_sessions_single_hop_stats_remote_diagnostic_get_elem,
225 }
226 },
227 {
228 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/remote-multiplier",
229 .cbs = {
230 .get_elem = bfdd_bfd_sessions_single_hop_stats_remote_multiplier_get_elem,
231 }
232 },
233 {
234 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/negotiated-transmission-interval",
235 .cbs = {
236 .get_elem = bfdd_bfd_sessions_single_hop_stats_negotiated_transmission_interval_get_elem,
237 }
238 },
239 {
240 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/negotiated-receive-interval",
241 .cbs = {
242 .get_elem = bfdd_bfd_sessions_single_hop_stats_negotiated_receive_interval_get_elem,
243 }
244 },
245 {
246 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/detection-mode",
247 .cbs = {
248 .get_elem = bfdd_bfd_sessions_single_hop_stats_detection_mode_get_elem,
249 }
250 },
251 {
252 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/last-down-time",
253 .cbs = {
254 .get_elem = bfdd_bfd_sessions_single_hop_stats_last_down_time_get_elem,
255 }
256 },
257 {
258 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/last-up-time",
259 .cbs = {
260 .get_elem = bfdd_bfd_sessions_single_hop_stats_last_up_time_get_elem,
261 }
262 },
263 {
264 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/session-down-count",
265 .cbs = {
266 .get_elem = bfdd_bfd_sessions_single_hop_stats_session_down_count_get_elem,
267 }
268 },
269 {
270 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/session-up-count",
271 .cbs = {
272 .get_elem = bfdd_bfd_sessions_single_hop_stats_session_up_count_get_elem,
273 }
274 },
275 {
276 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/control-packet-input-count",
277 .cbs = {
278 .get_elem = bfdd_bfd_sessions_single_hop_stats_control_packet_input_count_get_elem,
279 }
280 },
281 {
282 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/control-packet-output-count",
283 .cbs = {
284 .get_elem = bfdd_bfd_sessions_single_hop_stats_control_packet_output_count_get_elem,
285 }
286 },
287 {
288 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/negotiated-echo-transmission-interval",
289 .cbs = {
290 .get_elem = bfdd_bfd_sessions_single_hop_stats_negotiated_echo_transmission_interval_get_elem,
291 }
292 },
293 {
294 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/echo-packet-input-count",
295 .cbs = {
296 .get_elem = bfdd_bfd_sessions_single_hop_stats_echo_packet_input_count_get_elem,
297 }
298 },
299 {
300 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/echo-packet-output-count",
301 .cbs = {
302 .get_elem = bfdd_bfd_sessions_single_hop_stats_echo_packet_output_count_get_elem,
303 }
304 },
305 {
306 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop",
307 .cbs = {
308 .create = bfdd_bfd_sessions_multi_hop_create,
309 .destroy = bfdd_bfd_sessions_multi_hop_destroy,
310 .get_next = bfdd_bfd_sessions_multi_hop_get_next,
311 .get_keys = bfdd_bfd_sessions_multi_hop_get_keys,
312 .lookup_entry = bfdd_bfd_sessions_multi_hop_lookup_entry,
313 .cli_show = bfd_cli_show_multi_hop_peer,
314 .cli_show_end = bfd_cli_show_peer_end,
315 }
316 },
317 {
318 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/profile",
319 .cbs = {
320 .modify = bfdd_bfd_sessions_single_hop_profile_modify,
321 .destroy = bfdd_bfd_sessions_single_hop_profile_destroy,
322 .cli_show = bfd_cli_peer_profile_show,
323 }
324 },
325 {
326 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/detection-multiplier",
327 .cbs = {
328 .modify = bfdd_bfd_sessions_single_hop_detection_multiplier_modify,
329 .cli_show = bfd_cli_show_mult,
330 }
331 },
332 {
333 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/desired-transmission-interval",
334 .cbs = {
335 .modify = bfdd_bfd_sessions_single_hop_desired_transmission_interval_modify,
336 .cli_show = bfd_cli_show_tx,
337 }
338 },
339 {
340 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/required-receive-interval",
341 .cbs = {
342 .modify = bfdd_bfd_sessions_single_hop_required_receive_interval_modify,
343 .cli_show = bfd_cli_show_rx,
344 }
345 },
346 {
347 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/administrative-down",
348 .cbs = {
349 .modify = bfdd_bfd_sessions_single_hop_administrative_down_modify,
350 .cli_show = bfd_cli_show_shutdown,
351 }
352 },
353 {
354 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/passive-mode",
355 .cbs = {
356 .modify = bfdd_bfd_sessions_single_hop_passive_mode_modify,
357 .cli_show = bfd_cli_show_passive,
358 }
359 },
360 {
361 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/minimum-ttl",
362 .cbs = {
363 .modify = bfdd_bfd_sessions_multi_hop_minimum_ttl_modify,
364 .destroy = bfdd_bfd_sessions_multi_hop_minimum_ttl_destroy,
365 .cli_show = bfd_cli_show_minimum_ttl,
366 }
367 },
368 {
369 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/local-discriminator",
370 .cbs = {
371 .get_elem = bfdd_bfd_sessions_single_hop_stats_local_discriminator_get_elem,
372 }
373 },
374 {
375 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/local-state",
376 .cbs = {
377 .get_elem = bfdd_bfd_sessions_single_hop_stats_local_state_get_elem,
378 }
379 },
380 {
381 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/local-diagnostic",
382 .cbs = {
383 .get_elem = bfdd_bfd_sessions_single_hop_stats_local_diagnostic_get_elem,
384 }
385 },
386 {
387 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/local-multiplier",
388 .cbs = {
389 .get_elem = bfdd_bfd_sessions_single_hop_stats_local_multiplier_get_elem,
390 }
391 },
392 {
393 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/remote-discriminator",
394 .cbs = {
395 .get_elem = bfdd_bfd_sessions_single_hop_stats_remote_discriminator_get_elem,
396 }
397 },
398 {
399 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/remote-state",
400 .cbs = {
401 .get_elem = bfdd_bfd_sessions_single_hop_stats_remote_state_get_elem,
402 }
403 },
404 {
405 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/remote-diagnostic",
406 .cbs = {
407 .get_elem = bfdd_bfd_sessions_single_hop_stats_remote_diagnostic_get_elem,
408 }
409 },
410 {
411 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/remote-multiplier",
412 .cbs = {
413 .get_elem = bfdd_bfd_sessions_single_hop_stats_remote_multiplier_get_elem,
414 }
415 },
416 {
417 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/negotiated-transmission-interval",
418 .cbs = {
419 .get_elem = bfdd_bfd_sessions_single_hop_stats_negotiated_transmission_interval_get_elem,
420 }
421 },
422 {
423 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/negotiated-receive-interval",
424 .cbs = {
425 .get_elem = bfdd_bfd_sessions_single_hop_stats_negotiated_receive_interval_get_elem,
426 }
427 },
428 {
429 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/detection-mode",
430 .cbs = {
431 .get_elem = bfdd_bfd_sessions_single_hop_stats_detection_mode_get_elem,
432 }
433 },
434 {
435 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/last-down-time",
436 .cbs = {
437 .get_elem = bfdd_bfd_sessions_single_hop_stats_last_down_time_get_elem,
438 }
439 },
440 {
441 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/last-up-time",
442 .cbs = {
443 .get_elem = bfdd_bfd_sessions_single_hop_stats_last_up_time_get_elem,
444 }
445 },
446 {
447 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/session-down-count",
448 .cbs = {
449 .get_elem = bfdd_bfd_sessions_single_hop_stats_session_down_count_get_elem,
450 }
451 },
452 {
453 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/session-up-count",
454 .cbs = {
455 .get_elem = bfdd_bfd_sessions_single_hop_stats_session_up_count_get_elem,
456 }
457 },
458 {
459 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/control-packet-input-count",
460 .cbs = {
461 .get_elem = bfdd_bfd_sessions_single_hop_stats_control_packet_input_count_get_elem,
462 }
463 },
464 {
465 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/control-packet-output-count",
466 .cbs = {
467 .get_elem = bfdd_bfd_sessions_single_hop_stats_control_packet_output_count_get_elem,
468 }
469 },
470 {
471 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/negotiated-echo-transmission-interval",
472 .cbs = {
473 .get_elem = bfdd_bfd_sessions_single_hop_stats_negotiated_echo_transmission_interval_get_elem,
474 }
475 },
476 {
477 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/echo-packet-input-count",
478 .cbs = {
479 .get_elem = bfdd_bfd_sessions_single_hop_stats_echo_packet_input_count_get_elem,
480 }
481 },
482 {
483 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/echo-packet-output-count",
484 .cbs = {
485 .get_elem = bfdd_bfd_sessions_single_hop_stats_echo_packet_output_count_get_elem,
486 }
487 },
488 {
489 .xpath = NULL,
490 },
491 }
492 };