]> git.proxmox.com Git - mirror_frr.git/blame - bfdd/bfdd_nb.c
Merge pull request #5721 from mjstapp/vty_copy_to_runn
[mirror_frr.git] / bfdd / bfdd_nb.c
CommitLineData
6c574029
RW
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 */
31const 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/sessions/single-hop",
45 .cbs = {
46 .create = bfdd_bfd_sessions_single_hop_create,
47 .destroy = bfdd_bfd_sessions_single_hop_destroy,
48 .get_next = bfdd_bfd_sessions_single_hop_get_next,
49 .get_keys = bfdd_bfd_sessions_single_hop_get_keys,
50 .lookup_entry = bfdd_bfd_sessions_single_hop_lookup_entry,
51 .cli_show = bfd_cli_show_single_hop_peer,
52 .cli_show_end = bfd_cli_show_peer_end,
53 }
54 },
55 {
56 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/source-addr",
57 .cbs = {
58 .modify = bfdd_bfd_sessions_single_hop_source_addr_modify,
59 .destroy = bfdd_bfd_sessions_single_hop_source_addr_destroy,
60 }
61 },
62 {
63 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/detection-multiplier",
64 .cbs = {
65 .modify = bfdd_bfd_sessions_single_hop_detection_multiplier_modify,
66 .cli_show = bfd_cli_show_mult,
67 }
68 },
69 {
70 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/desired-transmission-interval",
71 .cbs = {
72 .modify = bfdd_bfd_sessions_single_hop_desired_transmission_interval_modify,
73 .cli_show = bfd_cli_show_tx,
74 }
75 },
76 {
77 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/required-receive-interval",
78 .cbs = {
79 .modify = bfdd_bfd_sessions_single_hop_required_receive_interval_modify,
80 .cli_show = bfd_cli_show_rx,
81 }
82 },
83 {
84 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/administrative-down",
85 .cbs = {
86 .modify = bfdd_bfd_sessions_single_hop_administrative_down_modify,
87 .cli_show = bfd_cli_show_shutdown,
88 }
89 },
90 {
91 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/echo-mode",
92 .cbs = {
93 .modify = bfdd_bfd_sessions_single_hop_echo_mode_modify,
94 .cli_show = bfd_cli_show_echo,
95 }
96 },
97 {
98 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/desired-echo-transmission-interval",
99 .cbs = {
100 .modify = bfdd_bfd_sessions_single_hop_desired_echo_transmission_interval_modify,
101 .cli_show = bfd_cli_show_echo_interval,
102 }
103 },
104 {
105 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/local-discriminator",
106 .cbs = {
107 .get_elem = bfdd_bfd_sessions_single_hop_stats_local_discriminator_get_elem,
108 }
109 },
110 {
111 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/local-state",
112 .cbs = {
113 .get_elem = bfdd_bfd_sessions_single_hop_stats_local_state_get_elem,
114 }
115 },
116 {
117 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/local-diagnostic",
118 .cbs = {
119 .get_elem = bfdd_bfd_sessions_single_hop_stats_local_diagnostic_get_elem,
120 }
121 },
122 {
123 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/local-multiplier",
124 .cbs = {
125 .get_elem = bfdd_bfd_sessions_single_hop_stats_local_multiplier_get_elem,
126 }
127 },
128 {
129 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/remote-discriminator",
130 .cbs = {
131 .get_elem = bfdd_bfd_sessions_single_hop_stats_remote_discriminator_get_elem,
132 }
133 },
134 {
135 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/remote-state",
136 .cbs = {
137 .get_elem = bfdd_bfd_sessions_single_hop_stats_remote_state_get_elem,
138 }
139 },
140 {
141 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/remote-diagnostic",
142 .cbs = {
143 .get_elem = bfdd_bfd_sessions_single_hop_stats_remote_diagnostic_get_elem,
144 }
145 },
146 {
147 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/remote-multiplier",
148 .cbs = {
149 .get_elem = bfdd_bfd_sessions_single_hop_stats_remote_multiplier_get_elem,
150 }
151 },
152 {
153 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/negotiated-transmission-interval",
154 .cbs = {
155 .get_elem = bfdd_bfd_sessions_single_hop_stats_negotiated_transmission_interval_get_elem,
156 }
157 },
158 {
159 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/negotiated-receive-interval",
160 .cbs = {
161 .get_elem = bfdd_bfd_sessions_single_hop_stats_negotiated_receive_interval_get_elem,
162 }
163 },
164 {
165 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/detection-mode",
166 .cbs = {
167 .get_elem = bfdd_bfd_sessions_single_hop_stats_detection_mode_get_elem,
168 }
169 },
170 {
171 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/last-down-time",
172 .cbs = {
173 .get_elem = bfdd_bfd_sessions_single_hop_stats_last_down_time_get_elem,
174 }
175 },
176 {
177 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/last-up-time",
178 .cbs = {
179 .get_elem = bfdd_bfd_sessions_single_hop_stats_last_up_time_get_elem,
180 }
181 },
182 {
183 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/session-down-count",
184 .cbs = {
185 .get_elem = bfdd_bfd_sessions_single_hop_stats_session_down_count_get_elem,
186 }
187 },
188 {
189 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/session-up-count",
190 .cbs = {
191 .get_elem = bfdd_bfd_sessions_single_hop_stats_session_up_count_get_elem,
192 }
193 },
194 {
195 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/control-packet-input-count",
196 .cbs = {
197 .get_elem = bfdd_bfd_sessions_single_hop_stats_control_packet_input_count_get_elem,
198 }
199 },
200 {
201 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/control-packet-output-count",
202 .cbs = {
203 .get_elem = bfdd_bfd_sessions_single_hop_stats_control_packet_output_count_get_elem,
204 }
205 },
206 {
207 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/negotiated-echo-transmission-interval",
208 .cbs = {
209 .get_elem = bfdd_bfd_sessions_single_hop_stats_negotiated_echo_transmission_interval_get_elem,
210 }
211 },
212 {
213 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/echo-packet-input-count",
214 .cbs = {
215 .get_elem = bfdd_bfd_sessions_single_hop_stats_echo_packet_input_count_get_elem,
216 }
217 },
218 {
219 .xpath = "/frr-bfdd:bfdd/bfd/sessions/single-hop/stats/echo-packet-output-count",
220 .cbs = {
221 .get_elem = bfdd_bfd_sessions_single_hop_stats_echo_packet_output_count_get_elem,
222 }
223 },
224 {
225 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop",
226 .cbs = {
227 .create = bfdd_bfd_sessions_multi_hop_create,
228 .destroy = bfdd_bfd_sessions_multi_hop_destroy,
229 .get_next = bfdd_bfd_sessions_multi_hop_get_next,
230 .get_keys = bfdd_bfd_sessions_multi_hop_get_keys,
231 .lookup_entry = bfdd_bfd_sessions_multi_hop_lookup_entry,
232 .cli_show = bfd_cli_show_multi_hop_peer,
233 .cli_show_end = bfd_cli_show_peer_end,
234 }
235 },
236 {
237 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/detection-multiplier",
238 .cbs = {
239 .modify = bfdd_bfd_sessions_single_hop_detection_multiplier_modify,
240 .cli_show = bfd_cli_show_mult,
241 }
242 },
243 {
244 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/desired-transmission-interval",
245 .cbs = {
246 .modify = bfdd_bfd_sessions_single_hop_desired_transmission_interval_modify,
247 .cli_show = bfd_cli_show_tx,
248 }
249 },
250 {
251 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/required-receive-interval",
252 .cbs = {
253 .modify = bfdd_bfd_sessions_single_hop_required_receive_interval_modify,
254 .cli_show = bfd_cli_show_rx,
255 }
256 },
257 {
258 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/administrative-down",
259 .cbs = {
260 .modify = bfdd_bfd_sessions_single_hop_administrative_down_modify,
261 .cli_show = bfd_cli_show_shutdown,
262 }
263 },
264 {
265 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/local-discriminator",
266 .cbs = {
267 .get_elem = bfdd_bfd_sessions_single_hop_stats_local_discriminator_get_elem,
268 }
269 },
270 {
271 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/local-state",
272 .cbs = {
273 .get_elem = bfdd_bfd_sessions_single_hop_stats_local_state_get_elem,
274 }
275 },
276 {
277 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/local-diagnostic",
278 .cbs = {
279 .get_elem = bfdd_bfd_sessions_single_hop_stats_local_diagnostic_get_elem,
280 }
281 },
282 {
283 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/local-multiplier",
284 .cbs = {
285 .get_elem = bfdd_bfd_sessions_single_hop_stats_local_multiplier_get_elem,
286 }
287 },
288 {
289 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/remote-discriminator",
290 .cbs = {
291 .get_elem = bfdd_bfd_sessions_single_hop_stats_remote_discriminator_get_elem,
292 }
293 },
294 {
295 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/remote-state",
296 .cbs = {
297 .get_elem = bfdd_bfd_sessions_single_hop_stats_remote_state_get_elem,
298 }
299 },
300 {
301 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/remote-diagnostic",
302 .cbs = {
303 .get_elem = bfdd_bfd_sessions_single_hop_stats_remote_diagnostic_get_elem,
304 }
305 },
306 {
307 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/remote-multiplier",
308 .cbs = {
309 .get_elem = bfdd_bfd_sessions_single_hop_stats_remote_multiplier_get_elem,
310 }
311 },
312 {
313 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/negotiated-transmission-interval",
314 .cbs = {
315 .get_elem = bfdd_bfd_sessions_single_hop_stats_negotiated_transmission_interval_get_elem,
316 }
317 },
318 {
319 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/negotiated-receive-interval",
320 .cbs = {
321 .get_elem = bfdd_bfd_sessions_single_hop_stats_negotiated_receive_interval_get_elem,
322 }
323 },
324 {
325 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/detection-mode",
326 .cbs = {
327 .get_elem = bfdd_bfd_sessions_single_hop_stats_detection_mode_get_elem,
328 }
329 },
330 {
331 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/last-down-time",
332 .cbs = {
333 .get_elem = bfdd_bfd_sessions_single_hop_stats_last_down_time_get_elem,
334 }
335 },
336 {
337 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/last-up-time",
338 .cbs = {
339 .get_elem = bfdd_bfd_sessions_single_hop_stats_last_up_time_get_elem,
340 }
341 },
342 {
343 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/session-down-count",
344 .cbs = {
345 .get_elem = bfdd_bfd_sessions_single_hop_stats_session_down_count_get_elem,
346 }
347 },
348 {
349 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/session-up-count",
350 .cbs = {
351 .get_elem = bfdd_bfd_sessions_single_hop_stats_session_up_count_get_elem,
352 }
353 },
354 {
355 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/control-packet-input-count",
356 .cbs = {
357 .get_elem = bfdd_bfd_sessions_single_hop_stats_control_packet_input_count_get_elem,
358 }
359 },
360 {
361 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/control-packet-output-count",
362 .cbs = {
363 .get_elem = bfdd_bfd_sessions_single_hop_stats_control_packet_output_count_get_elem,
364 }
365 },
366 {
367 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/negotiated-echo-transmission-interval",
368 .cbs = {
369 .get_elem = bfdd_bfd_sessions_single_hop_stats_negotiated_echo_transmission_interval_get_elem,
370 }
371 },
372 {
373 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/echo-packet-input-count",
374 .cbs = {
375 .get_elem = bfdd_bfd_sessions_single_hop_stats_echo_packet_input_count_get_elem,
376 }
377 },
378 {
379 .xpath = "/frr-bfdd:bfdd/bfd/sessions/multi-hop/stats/echo-packet-output-count",
380 .cbs = {
381 .get_elem = bfdd_bfd_sessions_single_hop_stats_echo_packet_output_count_get_elem,
382 }
383 },
384 {
385 .xpath = NULL,
386 },
387 }
388};