/src/frr/zebra/zebra_nb_config.c
Line | Count | Source (jump to first uncovered line) |
1 | | // SPDX-License-Identifier: GPL-2.0-or-later |
2 | | /* |
3 | | * Copyright (C) 2019 Cumulus Networks, Inc. |
4 | | * Chirag Shah |
5 | | */ |
6 | | |
7 | | #include <zebra.h> |
8 | | |
9 | | #include "lib/admin_group.h" |
10 | | #include "lib/affinitymap.h" |
11 | | #include "lib/log.h" |
12 | | #include "lib/northbound.h" |
13 | | #include "lib/printfrr.h" |
14 | | #include "libfrr.h" |
15 | | #include "lib/command.h" |
16 | | #include "lib/routemap.h" |
17 | | #include "zebra/zebra_nb.h" |
18 | | #include "zebra/rib.h" |
19 | | #include "zebra_nb.h" |
20 | | #include "zebra/interface.h" |
21 | | #include "zebra/connected.h" |
22 | | #include "zebra/zebra_router.h" |
23 | | #include "zebra/debug.h" |
24 | | #include "zebra/zebra_vxlan_private.h" |
25 | | #include "zebra/zebra_vxlan.h" |
26 | | |
27 | | /* |
28 | | * XPath: /frr-zebra:zebra/mcast-rpf-lookup |
29 | | */ |
30 | | int zebra_mcast_rpf_lookup_modify(struct nb_cb_modify_args *args) |
31 | 0 | { |
32 | 0 | switch (args->event) { |
33 | 0 | case NB_EV_VALIDATE: |
34 | 0 | case NB_EV_PREPARE: |
35 | 0 | case NB_EV_ABORT: |
36 | 0 | case NB_EV_APPLY: |
37 | | /* TODO: implement me. */ |
38 | 0 | break; |
39 | 0 | } |
40 | | |
41 | 0 | return NB_OK; |
42 | 0 | } |
43 | | |
44 | | /* |
45 | | * XPath: /frr-zebra:zebra/ip-forwarding |
46 | | */ |
47 | | int zebra_ip_forwarding_modify(struct nb_cb_modify_args *args) |
48 | 0 | { |
49 | 0 | switch (args->event) { |
50 | 0 | case NB_EV_VALIDATE: |
51 | 0 | case NB_EV_PREPARE: |
52 | 0 | case NB_EV_ABORT: |
53 | 0 | case NB_EV_APPLY: |
54 | | /* TODO: implement me. */ |
55 | 0 | break; |
56 | 0 | } |
57 | | |
58 | 0 | return NB_OK; |
59 | 0 | } |
60 | | |
61 | | int zebra_ip_forwarding_destroy(struct nb_cb_destroy_args *args) |
62 | 0 | { |
63 | 0 | switch (args->event) { |
64 | 0 | case NB_EV_VALIDATE: |
65 | 0 | case NB_EV_PREPARE: |
66 | 0 | case NB_EV_ABORT: |
67 | 0 | case NB_EV_APPLY: |
68 | | /* TODO: implement me. */ |
69 | 0 | break; |
70 | 0 | } |
71 | | |
72 | 0 | return NB_OK; |
73 | 0 | } |
74 | | |
75 | | /* |
76 | | * XPath: /frr-zebra:zebra/ipv6-forwarding |
77 | | */ |
78 | | int zebra_ipv6_forwarding_modify(struct nb_cb_modify_args *args) |
79 | 0 | { |
80 | 0 | switch (args->event) { |
81 | 0 | case NB_EV_VALIDATE: |
82 | 0 | case NB_EV_PREPARE: |
83 | 0 | case NB_EV_ABORT: |
84 | 0 | case NB_EV_APPLY: |
85 | | /* TODO: implement me. */ |
86 | 0 | break; |
87 | 0 | } |
88 | | |
89 | 0 | return NB_OK; |
90 | 0 | } |
91 | | |
92 | | int zebra_ipv6_forwarding_destroy(struct nb_cb_destroy_args *args) |
93 | 0 | { |
94 | 0 | switch (args->event) { |
95 | 0 | case NB_EV_VALIDATE: |
96 | 0 | case NB_EV_PREPARE: |
97 | 0 | case NB_EV_ABORT: |
98 | 0 | case NB_EV_APPLY: |
99 | | /* TODO: implement me. */ |
100 | 0 | break; |
101 | 0 | } |
102 | | |
103 | 0 | return NB_OK; |
104 | 0 | } |
105 | | |
106 | | /* |
107 | | * XPath: /frr-zebra:zebra/workqueue-hold-timer |
108 | | */ |
109 | | int zebra_workqueue_hold_timer_modify(struct nb_cb_modify_args *args) |
110 | 0 | { |
111 | 0 | switch (args->event) { |
112 | 0 | case NB_EV_VALIDATE: |
113 | 0 | case NB_EV_PREPARE: |
114 | 0 | case NB_EV_ABORT: |
115 | 0 | case NB_EV_APPLY: |
116 | | /* TODO: implement me. */ |
117 | 0 | break; |
118 | 0 | } |
119 | | |
120 | 0 | return NB_OK; |
121 | 0 | } |
122 | | |
123 | | /* |
124 | | * XPath: /frr-zebra:zebra/zapi-packets |
125 | | */ |
126 | | int zebra_zapi_packets_modify(struct nb_cb_modify_args *args) |
127 | 0 | { |
128 | 0 | switch (args->event) { |
129 | 0 | case NB_EV_VALIDATE: |
130 | 0 | case NB_EV_PREPARE: |
131 | 0 | case NB_EV_ABORT: |
132 | 0 | case NB_EV_APPLY: |
133 | | /* TODO: implement me. */ |
134 | 0 | break; |
135 | 0 | } |
136 | | |
137 | 0 | return NB_OK; |
138 | 0 | } |
139 | | |
140 | | /* |
141 | | * XPath: /frr-zebra:zebra/import-kernel-table/table-id |
142 | | */ |
143 | | int zebra_import_kernel_table_table_id_modify(struct nb_cb_modify_args *args) |
144 | 0 | { |
145 | 0 | switch (args->event) { |
146 | 0 | case NB_EV_VALIDATE: |
147 | 0 | case NB_EV_PREPARE: |
148 | 0 | case NB_EV_ABORT: |
149 | 0 | case NB_EV_APPLY: |
150 | | /* TODO: implement me. */ |
151 | 0 | break; |
152 | 0 | } |
153 | | |
154 | 0 | return NB_OK; |
155 | 0 | } |
156 | | |
157 | | int zebra_import_kernel_table_table_id_destroy(struct nb_cb_destroy_args *args) |
158 | 0 | { |
159 | 0 | switch (args->event) { |
160 | 0 | case NB_EV_VALIDATE: |
161 | 0 | case NB_EV_PREPARE: |
162 | 0 | case NB_EV_ABORT: |
163 | 0 | case NB_EV_APPLY: |
164 | | /* TODO: implement me. */ |
165 | 0 | break; |
166 | 0 | } |
167 | | |
168 | 0 | return NB_OK; |
169 | 0 | } |
170 | | |
171 | | /* |
172 | | * XPath: /frr-zebra:zebra/import-kernel-table/distance |
173 | | */ |
174 | | int zebra_import_kernel_table_distance_modify(struct nb_cb_modify_args *args) |
175 | 0 | { |
176 | 0 | switch (args->event) { |
177 | 0 | case NB_EV_VALIDATE: |
178 | 0 | case NB_EV_PREPARE: |
179 | 0 | case NB_EV_ABORT: |
180 | 0 | case NB_EV_APPLY: |
181 | | /* TODO: implement me. */ |
182 | 0 | break; |
183 | 0 | } |
184 | | |
185 | 0 | return NB_OK; |
186 | 0 | } |
187 | | |
188 | | /* |
189 | | * XPath: /frr-zebra:zebra/import-kernel-table/route-map |
190 | | */ |
191 | | int zebra_import_kernel_table_route_map_modify(struct nb_cb_modify_args *args) |
192 | 0 | { |
193 | 0 | switch (args->event) { |
194 | 0 | case NB_EV_VALIDATE: |
195 | 0 | case NB_EV_PREPARE: |
196 | 0 | case NB_EV_ABORT: |
197 | 0 | case NB_EV_APPLY: |
198 | | /* TODO: implement me. */ |
199 | 0 | break; |
200 | 0 | } |
201 | | |
202 | 0 | return NB_OK; |
203 | 0 | } |
204 | | |
205 | | int zebra_import_kernel_table_route_map_destroy(struct nb_cb_destroy_args *args) |
206 | 0 | { |
207 | 0 | switch (args->event) { |
208 | 0 | case NB_EV_VALIDATE: |
209 | 0 | case NB_EV_PREPARE: |
210 | 0 | case NB_EV_ABORT: |
211 | 0 | case NB_EV_APPLY: |
212 | | /* TODO: implement me. */ |
213 | 0 | break; |
214 | 0 | } |
215 | | |
216 | 0 | return NB_OK; |
217 | 0 | } |
218 | | |
219 | | /* |
220 | | * XPath: /frr-zebra:zebra/allow-external-route-update |
221 | | */ |
222 | | int zebra_allow_external_route_update_create(struct nb_cb_create_args *args) |
223 | 0 | { |
224 | 0 | switch (args->event) { |
225 | 0 | case NB_EV_VALIDATE: |
226 | 0 | case NB_EV_PREPARE: |
227 | 0 | case NB_EV_ABORT: |
228 | 0 | case NB_EV_APPLY: |
229 | | /* TODO: implement me. */ |
230 | 0 | break; |
231 | 0 | } |
232 | | |
233 | 0 | return NB_OK; |
234 | 0 | } |
235 | | |
236 | | int zebra_allow_external_route_update_destroy(struct nb_cb_destroy_args *args) |
237 | 0 | { |
238 | 0 | switch (args->event) { |
239 | 0 | case NB_EV_VALIDATE: |
240 | 0 | case NB_EV_PREPARE: |
241 | 0 | case NB_EV_ABORT: |
242 | 0 | case NB_EV_APPLY: |
243 | | /* TODO: implement me. */ |
244 | 0 | break; |
245 | 0 | } |
246 | | |
247 | 0 | return NB_OK; |
248 | 0 | } |
249 | | |
250 | | /* |
251 | | * XPath: /frr-zebra:zebra/dplane-queue-limit |
252 | | */ |
253 | | int zebra_dplane_queue_limit_modify(struct nb_cb_modify_args *args) |
254 | 0 | { |
255 | 0 | switch (args->event) { |
256 | 0 | case NB_EV_VALIDATE: |
257 | 0 | case NB_EV_PREPARE: |
258 | 0 | case NB_EV_ABORT: |
259 | 0 | case NB_EV_APPLY: |
260 | | /* TODO: implement me. */ |
261 | 0 | break; |
262 | 0 | } |
263 | | |
264 | 0 | return NB_OK; |
265 | 0 | } |
266 | | |
267 | | /* |
268 | | * XPath: /frr-zebra:zebra/debugs/debug-events |
269 | | */ |
270 | | int zebra_debugs_debug_events_modify(struct nb_cb_modify_args *args) |
271 | 0 | { |
272 | 0 | switch (args->event) { |
273 | 0 | case NB_EV_VALIDATE: |
274 | 0 | case NB_EV_PREPARE: |
275 | 0 | case NB_EV_ABORT: |
276 | 0 | case NB_EV_APPLY: |
277 | | /* TODO: implement me. */ |
278 | 0 | break; |
279 | 0 | } |
280 | | |
281 | 0 | return NB_OK; |
282 | 0 | } |
283 | | |
284 | | int zebra_debugs_debug_events_destroy(struct nb_cb_destroy_args *args) |
285 | 0 | { |
286 | 0 | switch (args->event) { |
287 | 0 | case NB_EV_VALIDATE: |
288 | 0 | case NB_EV_PREPARE: |
289 | 0 | case NB_EV_ABORT: |
290 | 0 | case NB_EV_APPLY: |
291 | | /* TODO: implement me. */ |
292 | 0 | break; |
293 | 0 | } |
294 | | |
295 | 0 | return NB_OK; |
296 | 0 | } |
297 | | |
298 | | /* |
299 | | * XPath: /frr-zebra:zebra/debugs/debug-zapi-send |
300 | | */ |
301 | | int zebra_debugs_debug_zapi_send_modify(struct nb_cb_modify_args *args) |
302 | 0 | { |
303 | 0 | switch (args->event) { |
304 | 0 | case NB_EV_VALIDATE: |
305 | 0 | case NB_EV_PREPARE: |
306 | 0 | case NB_EV_ABORT: |
307 | 0 | case NB_EV_APPLY: |
308 | | /* TODO: implement me. */ |
309 | 0 | break; |
310 | 0 | } |
311 | | |
312 | 0 | return NB_OK; |
313 | 0 | } |
314 | | |
315 | | int zebra_debugs_debug_zapi_send_destroy(struct nb_cb_destroy_args *args) |
316 | 0 | { |
317 | 0 | switch (args->event) { |
318 | 0 | case NB_EV_VALIDATE: |
319 | 0 | case NB_EV_PREPARE: |
320 | 0 | case NB_EV_ABORT: |
321 | 0 | case NB_EV_APPLY: |
322 | | /* TODO: implement me. */ |
323 | 0 | break; |
324 | 0 | } |
325 | | |
326 | 0 | return NB_OK; |
327 | 0 | } |
328 | | |
329 | | /* |
330 | | * XPath: /frr-zebra:zebra/debugs/debug-zapi-recv |
331 | | */ |
332 | | int zebra_debugs_debug_zapi_recv_modify(struct nb_cb_modify_args *args) |
333 | 0 | { |
334 | 0 | switch (args->event) { |
335 | 0 | case NB_EV_VALIDATE: |
336 | 0 | case NB_EV_PREPARE: |
337 | 0 | case NB_EV_ABORT: |
338 | 0 | case NB_EV_APPLY: |
339 | | /* TODO: implement me. */ |
340 | 0 | break; |
341 | 0 | } |
342 | | |
343 | 0 | return NB_OK; |
344 | 0 | } |
345 | | |
346 | | int zebra_debugs_debug_zapi_recv_destroy(struct nb_cb_destroy_args *args) |
347 | 0 | { |
348 | 0 | switch (args->event) { |
349 | 0 | case NB_EV_VALIDATE: |
350 | 0 | case NB_EV_PREPARE: |
351 | 0 | case NB_EV_ABORT: |
352 | 0 | case NB_EV_APPLY: |
353 | | /* TODO: implement me. */ |
354 | 0 | break; |
355 | 0 | } |
356 | | |
357 | 0 | return NB_OK; |
358 | 0 | } |
359 | | |
360 | | /* |
361 | | * XPath: /frr-zebra:zebra/debugs/debug-zapi-detail |
362 | | */ |
363 | | int zebra_debugs_debug_zapi_detail_modify(struct nb_cb_modify_args *args) |
364 | 0 | { |
365 | 0 | switch (args->event) { |
366 | 0 | case NB_EV_VALIDATE: |
367 | 0 | case NB_EV_PREPARE: |
368 | 0 | case NB_EV_ABORT: |
369 | 0 | case NB_EV_APPLY: |
370 | | /* TODO: implement me. */ |
371 | 0 | break; |
372 | 0 | } |
373 | | |
374 | 0 | return NB_OK; |
375 | 0 | } |
376 | | |
377 | | int zebra_debugs_debug_zapi_detail_destroy(struct nb_cb_destroy_args *args) |
378 | 0 | { |
379 | 0 | switch (args->event) { |
380 | 0 | case NB_EV_VALIDATE: |
381 | 0 | case NB_EV_PREPARE: |
382 | 0 | case NB_EV_ABORT: |
383 | 0 | case NB_EV_APPLY: |
384 | | /* TODO: implement me. */ |
385 | 0 | break; |
386 | 0 | } |
387 | | |
388 | 0 | return NB_OK; |
389 | 0 | } |
390 | | |
391 | | /* |
392 | | * XPath: /frr-zebra:zebra/debugs/debug-kernel |
393 | | */ |
394 | | int zebra_debugs_debug_kernel_modify(struct nb_cb_modify_args *args) |
395 | 0 | { |
396 | 0 | switch (args->event) { |
397 | 0 | case NB_EV_VALIDATE: |
398 | 0 | case NB_EV_PREPARE: |
399 | 0 | case NB_EV_ABORT: |
400 | 0 | case NB_EV_APPLY: |
401 | | /* TODO: implement me. */ |
402 | 0 | break; |
403 | 0 | } |
404 | | |
405 | 0 | return NB_OK; |
406 | 0 | } |
407 | | |
408 | | int zebra_debugs_debug_kernel_destroy(struct nb_cb_destroy_args *args) |
409 | 0 | { |
410 | 0 | switch (args->event) { |
411 | 0 | case NB_EV_VALIDATE: |
412 | 0 | case NB_EV_PREPARE: |
413 | 0 | case NB_EV_ABORT: |
414 | 0 | case NB_EV_APPLY: |
415 | | /* TODO: implement me. */ |
416 | 0 | break; |
417 | 0 | } |
418 | | |
419 | 0 | return NB_OK; |
420 | 0 | } |
421 | | |
422 | | /* |
423 | | * XPath: /frr-zebra:zebra/debugs/debug-kernel-msg-send |
424 | | */ |
425 | | int zebra_debugs_debug_kernel_msg_send_modify(struct nb_cb_modify_args *args) |
426 | 0 | { |
427 | 0 | switch (args->event) { |
428 | 0 | case NB_EV_VALIDATE: |
429 | 0 | case NB_EV_PREPARE: |
430 | 0 | case NB_EV_ABORT: |
431 | 0 | case NB_EV_APPLY: |
432 | | /* TODO: implement me. */ |
433 | 0 | break; |
434 | 0 | } |
435 | | |
436 | 0 | return NB_OK; |
437 | 0 | } |
438 | | |
439 | | int zebra_debugs_debug_kernel_msg_send_destroy(struct nb_cb_destroy_args *args) |
440 | 0 | { |
441 | 0 | switch (args->event) { |
442 | 0 | case NB_EV_VALIDATE: |
443 | 0 | case NB_EV_PREPARE: |
444 | 0 | case NB_EV_ABORT: |
445 | 0 | case NB_EV_APPLY: |
446 | | /* TODO: implement me. */ |
447 | 0 | break; |
448 | 0 | } |
449 | | |
450 | 0 | return NB_OK; |
451 | 0 | } |
452 | | |
453 | | /* |
454 | | * XPath: /frr-zebra:zebra/debugs/debug-kernel-msg-recv |
455 | | */ |
456 | | int zebra_debugs_debug_kernel_msg_recv_modify(struct nb_cb_modify_args *args) |
457 | 0 | { |
458 | 0 | switch (args->event) { |
459 | 0 | case NB_EV_VALIDATE: |
460 | 0 | case NB_EV_PREPARE: |
461 | 0 | case NB_EV_ABORT: |
462 | 0 | case NB_EV_APPLY: |
463 | | /* TODO: implement me. */ |
464 | 0 | break; |
465 | 0 | } |
466 | | |
467 | 0 | return NB_OK; |
468 | 0 | } |
469 | | |
470 | | int zebra_debugs_debug_kernel_msg_recv_destroy(struct nb_cb_destroy_args *args) |
471 | 0 | { |
472 | 0 | switch (args->event) { |
473 | 0 | case NB_EV_VALIDATE: |
474 | 0 | case NB_EV_PREPARE: |
475 | 0 | case NB_EV_ABORT: |
476 | 0 | case NB_EV_APPLY: |
477 | | /* TODO: implement me. */ |
478 | 0 | break; |
479 | 0 | } |
480 | | |
481 | 0 | return NB_OK; |
482 | 0 | } |
483 | | |
484 | | /* |
485 | | * XPath: /frr-zebra:zebra/debugs/debug-rib |
486 | | */ |
487 | | int zebra_debugs_debug_rib_modify(struct nb_cb_modify_args *args) |
488 | 0 | { |
489 | 0 | switch (args->event) { |
490 | 0 | case NB_EV_VALIDATE: |
491 | 0 | case NB_EV_PREPARE: |
492 | 0 | case NB_EV_ABORT: |
493 | 0 | case NB_EV_APPLY: |
494 | | /* TODO: implement me. */ |
495 | 0 | break; |
496 | 0 | } |
497 | | |
498 | 0 | return NB_OK; |
499 | 0 | } |
500 | | |
501 | | int zebra_debugs_debug_rib_destroy(struct nb_cb_destroy_args *args) |
502 | 0 | { |
503 | 0 | switch (args->event) { |
504 | 0 | case NB_EV_VALIDATE: |
505 | 0 | case NB_EV_PREPARE: |
506 | 0 | case NB_EV_ABORT: |
507 | 0 | case NB_EV_APPLY: |
508 | | /* TODO: implement me. */ |
509 | 0 | break; |
510 | 0 | } |
511 | | |
512 | 0 | return NB_OK; |
513 | 0 | } |
514 | | |
515 | | /* |
516 | | * XPath: /frr-zebra:zebra/debugs/debug-rib-detail |
517 | | */ |
518 | | int zebra_debugs_debug_rib_detail_modify(struct nb_cb_modify_args *args) |
519 | 0 | { |
520 | 0 | switch (args->event) { |
521 | 0 | case NB_EV_VALIDATE: |
522 | 0 | case NB_EV_PREPARE: |
523 | 0 | case NB_EV_ABORT: |
524 | 0 | case NB_EV_APPLY: |
525 | | /* TODO: implement me. */ |
526 | 0 | break; |
527 | 0 | } |
528 | | |
529 | 0 | return NB_OK; |
530 | 0 | } |
531 | | |
532 | | int zebra_debugs_debug_rib_detail_destroy(struct nb_cb_destroy_args *args) |
533 | 0 | { |
534 | 0 | switch (args->event) { |
535 | 0 | case NB_EV_VALIDATE: |
536 | 0 | case NB_EV_PREPARE: |
537 | 0 | case NB_EV_ABORT: |
538 | 0 | case NB_EV_APPLY: |
539 | | /* TODO: implement me. */ |
540 | 0 | break; |
541 | 0 | } |
542 | | |
543 | 0 | return NB_OK; |
544 | 0 | } |
545 | | |
546 | | /* |
547 | | * XPath: /frr-zebra:zebra/debugs/debug-fpm |
548 | | */ |
549 | | int zebra_debugs_debug_fpm_modify(struct nb_cb_modify_args *args) |
550 | 0 | { |
551 | 0 | switch (args->event) { |
552 | 0 | case NB_EV_VALIDATE: |
553 | 0 | case NB_EV_PREPARE: |
554 | 0 | case NB_EV_ABORT: |
555 | 0 | case NB_EV_APPLY: |
556 | | /* TODO: implement me. */ |
557 | 0 | break; |
558 | 0 | } |
559 | | |
560 | 0 | return NB_OK; |
561 | 0 | } |
562 | | |
563 | | int zebra_debugs_debug_fpm_destroy(struct nb_cb_destroy_args *args) |
564 | 0 | { |
565 | 0 | switch (args->event) { |
566 | 0 | case NB_EV_VALIDATE: |
567 | 0 | case NB_EV_PREPARE: |
568 | 0 | case NB_EV_ABORT: |
569 | 0 | case NB_EV_APPLY: |
570 | | /* TODO: implement me. */ |
571 | 0 | break; |
572 | 0 | } |
573 | | |
574 | 0 | return NB_OK; |
575 | 0 | } |
576 | | |
577 | | /* |
578 | | * XPath: /frr-zebra:zebra/debugs/debug-nht |
579 | | */ |
580 | | int zebra_debugs_debug_nht_modify(struct nb_cb_modify_args *args) |
581 | 0 | { |
582 | 0 | switch (args->event) { |
583 | 0 | case NB_EV_VALIDATE: |
584 | 0 | case NB_EV_PREPARE: |
585 | 0 | case NB_EV_ABORT: |
586 | 0 | case NB_EV_APPLY: |
587 | | /* TODO: implement me. */ |
588 | 0 | break; |
589 | 0 | } |
590 | | |
591 | 0 | return NB_OK; |
592 | 0 | } |
593 | | |
594 | | int zebra_debugs_debug_nht_destroy(struct nb_cb_destroy_args *args) |
595 | 0 | { |
596 | 0 | switch (args->event) { |
597 | 0 | case NB_EV_VALIDATE: |
598 | 0 | case NB_EV_PREPARE: |
599 | 0 | case NB_EV_ABORT: |
600 | 0 | case NB_EV_APPLY: |
601 | | /* TODO: implement me. */ |
602 | 0 | break; |
603 | 0 | } |
604 | | |
605 | 0 | return NB_OK; |
606 | 0 | } |
607 | | |
608 | | /* |
609 | | * XPath: /frr-zebra:zebra/debugs/debug-nht-detail |
610 | | */ |
611 | | int zebra_debugs_debug_nht_detail_modify(struct nb_cb_modify_args *args) |
612 | 0 | { |
613 | 0 | switch (args->event) { |
614 | 0 | case NB_EV_VALIDATE: |
615 | 0 | case NB_EV_PREPARE: |
616 | 0 | case NB_EV_ABORT: |
617 | 0 | case NB_EV_APPLY: |
618 | | /* TODO: implement me. */ |
619 | 0 | break; |
620 | 0 | } |
621 | | |
622 | 0 | return NB_OK; |
623 | 0 | } |
624 | | |
625 | | int zebra_debugs_debug_nht_detail_destroy(struct nb_cb_destroy_args *args) |
626 | 0 | { |
627 | 0 | switch (args->event) { |
628 | 0 | case NB_EV_VALIDATE: |
629 | 0 | case NB_EV_PREPARE: |
630 | 0 | case NB_EV_ABORT: |
631 | 0 | case NB_EV_APPLY: |
632 | | /* TODO: implement me. */ |
633 | 0 | break; |
634 | 0 | } |
635 | | |
636 | 0 | return NB_OK; |
637 | 0 | } |
638 | | |
639 | | /* |
640 | | * XPath: /frr-zebra:zebra/debugs/debug-mpls |
641 | | */ |
642 | | int zebra_debugs_debug_mpls_modify(struct nb_cb_modify_args *args) |
643 | 0 | { |
644 | 0 | switch (args->event) { |
645 | 0 | case NB_EV_VALIDATE: |
646 | 0 | case NB_EV_PREPARE: |
647 | 0 | case NB_EV_ABORT: |
648 | 0 | case NB_EV_APPLY: |
649 | | /* TODO: implement me. */ |
650 | 0 | break; |
651 | 0 | } |
652 | | |
653 | 0 | return NB_OK; |
654 | 0 | } |
655 | | |
656 | | int zebra_debugs_debug_mpls_destroy(struct nb_cb_destroy_args *args) |
657 | 0 | { |
658 | 0 | switch (args->event) { |
659 | 0 | case NB_EV_VALIDATE: |
660 | 0 | case NB_EV_PREPARE: |
661 | 0 | case NB_EV_ABORT: |
662 | 0 | case NB_EV_APPLY: |
663 | | /* TODO: implement me. */ |
664 | 0 | break; |
665 | 0 | } |
666 | | |
667 | 0 | return NB_OK; |
668 | 0 | } |
669 | | |
670 | | /* |
671 | | * XPath: /frr-zebra:zebra/debugs/debug-vxlan |
672 | | */ |
673 | | int zebra_debugs_debug_vxlan_modify(struct nb_cb_modify_args *args) |
674 | 0 | { |
675 | 0 | switch (args->event) { |
676 | 0 | case NB_EV_VALIDATE: |
677 | 0 | case NB_EV_PREPARE: |
678 | 0 | case NB_EV_ABORT: |
679 | 0 | case NB_EV_APPLY: |
680 | | /* TODO: implement me. */ |
681 | 0 | break; |
682 | 0 | } |
683 | | |
684 | 0 | return NB_OK; |
685 | 0 | } |
686 | | |
687 | | int zebra_debugs_debug_vxlan_destroy(struct nb_cb_destroy_args *args) |
688 | 0 | { |
689 | 0 | switch (args->event) { |
690 | 0 | case NB_EV_VALIDATE: |
691 | 0 | case NB_EV_PREPARE: |
692 | 0 | case NB_EV_ABORT: |
693 | 0 | case NB_EV_APPLY: |
694 | | /* TODO: implement me. */ |
695 | 0 | break; |
696 | 0 | } |
697 | | |
698 | 0 | return NB_OK; |
699 | 0 | } |
700 | | |
701 | | /* |
702 | | * XPath: /frr-zebra:zebra/debugs/debug-pw |
703 | | */ |
704 | | int zebra_debugs_debug_pw_modify(struct nb_cb_modify_args *args) |
705 | 0 | { |
706 | 0 | switch (args->event) { |
707 | 0 | case NB_EV_VALIDATE: |
708 | 0 | case NB_EV_PREPARE: |
709 | 0 | case NB_EV_ABORT: |
710 | 0 | case NB_EV_APPLY: |
711 | | /* TODO: implement me. */ |
712 | 0 | break; |
713 | 0 | } |
714 | | |
715 | 0 | return NB_OK; |
716 | 0 | } |
717 | | |
718 | | int zebra_debugs_debug_pw_destroy(struct nb_cb_destroy_args *args) |
719 | 0 | { |
720 | 0 | switch (args->event) { |
721 | 0 | case NB_EV_VALIDATE: |
722 | 0 | case NB_EV_PREPARE: |
723 | 0 | case NB_EV_ABORT: |
724 | 0 | case NB_EV_APPLY: |
725 | | /* TODO: implement me. */ |
726 | 0 | break; |
727 | 0 | } |
728 | | |
729 | 0 | return NB_OK; |
730 | 0 | } |
731 | | |
732 | | /* |
733 | | * XPath: /frr-zebra:zebra/debugs/debug-dplane |
734 | | */ |
735 | | int zebra_debugs_debug_dplane_modify(struct nb_cb_modify_args *args) |
736 | 0 | { |
737 | 0 | switch (args->event) { |
738 | 0 | case NB_EV_VALIDATE: |
739 | 0 | case NB_EV_PREPARE: |
740 | 0 | case NB_EV_ABORT: |
741 | 0 | case NB_EV_APPLY: |
742 | | /* TODO: implement me. */ |
743 | 0 | break; |
744 | 0 | } |
745 | | |
746 | 0 | return NB_OK; |
747 | 0 | } |
748 | | |
749 | | int zebra_debugs_debug_dplane_destroy(struct nb_cb_destroy_args *args) |
750 | 0 | { |
751 | 0 | switch (args->event) { |
752 | 0 | case NB_EV_VALIDATE: |
753 | 0 | case NB_EV_PREPARE: |
754 | 0 | case NB_EV_ABORT: |
755 | 0 | case NB_EV_APPLY: |
756 | | /* TODO: implement me. */ |
757 | 0 | break; |
758 | 0 | } |
759 | | |
760 | 0 | return NB_OK; |
761 | 0 | } |
762 | | |
763 | | /* |
764 | | * XPath: /frr-zebra:zebra/debugs/debug-dplane-detail |
765 | | */ |
766 | | int zebra_debugs_debug_dplane_detail_modify(struct nb_cb_modify_args *args) |
767 | 0 | { |
768 | 0 | switch (args->event) { |
769 | 0 | case NB_EV_VALIDATE: |
770 | 0 | case NB_EV_PREPARE: |
771 | 0 | case NB_EV_ABORT: |
772 | 0 | case NB_EV_APPLY: |
773 | | /* TODO: implement me. */ |
774 | 0 | break; |
775 | 0 | } |
776 | | |
777 | 0 | return NB_OK; |
778 | 0 | } |
779 | | |
780 | | int zebra_debugs_debug_dplane_detail_destroy(struct nb_cb_destroy_args *args) |
781 | 0 | { |
782 | 0 | switch (args->event) { |
783 | 0 | case NB_EV_VALIDATE: |
784 | 0 | case NB_EV_PREPARE: |
785 | 0 | case NB_EV_ABORT: |
786 | 0 | case NB_EV_APPLY: |
787 | | /* TODO: implement me. */ |
788 | 0 | break; |
789 | 0 | } |
790 | | |
791 | 0 | return NB_OK; |
792 | 0 | } |
793 | | |
794 | | /* |
795 | | * XPath: /frr-zebra:zebra/debugs/debug-mlag |
796 | | */ |
797 | | int zebra_debugs_debug_mlag_modify(struct nb_cb_modify_args *args) |
798 | 0 | { |
799 | 0 | switch (args->event) { |
800 | 0 | case NB_EV_VALIDATE: |
801 | 0 | case NB_EV_PREPARE: |
802 | 0 | case NB_EV_ABORT: |
803 | 0 | case NB_EV_APPLY: |
804 | | /* TODO: implement me. */ |
805 | 0 | break; |
806 | 0 | } |
807 | | |
808 | 0 | return NB_OK; |
809 | 0 | } |
810 | | |
811 | | int zebra_debugs_debug_mlag_destroy(struct nb_cb_destroy_args *args) |
812 | 0 | { |
813 | 0 | switch (args->event) { |
814 | 0 | case NB_EV_VALIDATE: |
815 | 0 | case NB_EV_PREPARE: |
816 | 0 | case NB_EV_ABORT: |
817 | 0 | case NB_EV_APPLY: |
818 | | /* TODO: implement me. */ |
819 | 0 | break; |
820 | 0 | } |
821 | | |
822 | 0 | return NB_OK; |
823 | 0 | } |
824 | | |
825 | | /* |
826 | | * XPath: /frr-interface:lib/interface/frr-zebra:zebra/ip-addrs |
827 | | */ |
828 | | int lib_interface_zebra_ip_addrs_create(struct nb_cb_create_args *args) |
829 | 0 | { |
830 | 0 | struct interface *ifp; |
831 | 0 | struct prefix prefix; |
832 | | |
833 | | // addr_family = yang_dnode_get_enum(dnode, "./address-family"); |
834 | 0 | yang_dnode_get_prefix(&prefix, args->dnode, "./ip-prefix"); |
835 | 0 | apply_mask(&prefix); |
836 | |
|
837 | 0 | switch (args->event) { |
838 | 0 | case NB_EV_VALIDATE: |
839 | 0 | if (prefix.family == AF_INET |
840 | 0 | && ipv4_martian(&prefix.u.prefix4)) { |
841 | 0 | snprintfrr(args->errmsg, args->errmsg_len, |
842 | 0 | "invalid address %pFX", &prefix); |
843 | 0 | return NB_ERR_VALIDATION; |
844 | 0 | } else if (prefix.family == AF_INET6 |
845 | 0 | && ipv6_martian(&prefix.u.prefix6)) { |
846 | 0 | snprintfrr(args->errmsg, args->errmsg_len, |
847 | 0 | "invalid address %pFX", &prefix); |
848 | 0 | return NB_ERR_VALIDATION; |
849 | 0 | } |
850 | 0 | break; |
851 | 0 | case NB_EV_PREPARE: |
852 | 0 | case NB_EV_ABORT: |
853 | 0 | break; |
854 | 0 | case NB_EV_APPLY: |
855 | 0 | ifp = nb_running_get_entry(args->dnode, NULL, true); |
856 | 0 | if (prefix.family == AF_INET) |
857 | 0 | if_ip_address_install(ifp, &prefix, NULL, NULL); |
858 | 0 | else if (prefix.family == AF_INET6) |
859 | 0 | if_ipv6_address_install(ifp, &prefix, NULL); |
860 | |
|
861 | 0 | break; |
862 | 0 | } |
863 | | |
864 | 0 | return NB_OK; |
865 | 0 | } |
866 | | |
867 | | int lib_interface_zebra_ip_addrs_destroy(struct nb_cb_destroy_args *args) |
868 | 0 | { |
869 | 0 | struct interface *ifp; |
870 | 0 | struct prefix prefix; |
871 | 0 | struct connected *ifc; |
872 | |
|
873 | 0 | yang_dnode_get_prefix(&prefix, args->dnode, "./ip-prefix"); |
874 | 0 | apply_mask(&prefix); |
875 | |
|
876 | 0 | switch (args->event) { |
877 | 0 | case NB_EV_VALIDATE: |
878 | 0 | ifp = nb_running_get_entry(args->dnode, NULL, false); |
879 | 0 | if (!ifp) |
880 | 0 | return NB_OK; |
881 | | |
882 | 0 | if (prefix.family == AF_INET) { |
883 | | /* Check current interface address. */ |
884 | 0 | ifc = connected_check_ptp(ifp, &prefix, NULL); |
885 | 0 | if (!ifc) { |
886 | 0 | snprintf(args->errmsg, args->errmsg_len, |
887 | 0 | "interface %s Can't find address\n", |
888 | 0 | ifp->name); |
889 | 0 | return NB_ERR_VALIDATION; |
890 | 0 | } |
891 | 0 | } else if (prefix.family == AF_INET6) { |
892 | | /* Check current interface address. */ |
893 | 0 | ifc = connected_check(ifp, &prefix); |
894 | 0 | if (!ifc) { |
895 | 0 | snprintf(args->errmsg, args->errmsg_len, |
896 | 0 | "interface can't find address %s", |
897 | 0 | ifp->name); |
898 | 0 | return NB_ERR_VALIDATION; |
899 | 0 | } |
900 | 0 | } else |
901 | 0 | return NB_ERR_VALIDATION; |
902 | | |
903 | | /* This is not configured address. */ |
904 | 0 | if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_CONFIGURED)) { |
905 | 0 | snprintf(args->errmsg, args->errmsg_len, |
906 | 0 | "interface %s not configured", ifp->name); |
907 | 0 | return NB_ERR_VALIDATION; |
908 | 0 | } |
909 | | |
910 | | /* This is not real address or interface is not active. */ |
911 | 0 | if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_QUEUED) |
912 | 0 | || !CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE)) { |
913 | 0 | listnode_delete(ifp->connected, ifc); |
914 | 0 | connected_free(&ifc); |
915 | 0 | return NB_ERR_VALIDATION; |
916 | 0 | } |
917 | 0 | break; |
918 | 0 | case NB_EV_PREPARE: |
919 | 0 | case NB_EV_ABORT: |
920 | 0 | break; |
921 | 0 | case NB_EV_APPLY: |
922 | 0 | ifp = nb_running_get_entry(args->dnode, NULL, true); |
923 | 0 | if_ip_address_uinstall(ifp, &prefix); |
924 | 0 | break; |
925 | 0 | } |
926 | | |
927 | 0 | return NB_OK; |
928 | 0 | } |
929 | | |
930 | | /* |
931 | | * XPath: /frr-interface:lib/interface/frr-zebra:zebra/ip-addrs/label |
932 | | */ |
933 | | int lib_interface_zebra_ip_addrs_label_modify(struct nb_cb_modify_args *args) |
934 | 0 | { |
935 | 0 | switch (args->event) { |
936 | 0 | case NB_EV_VALIDATE: |
937 | 0 | case NB_EV_PREPARE: |
938 | 0 | case NB_EV_ABORT: |
939 | 0 | case NB_EV_APPLY: |
940 | | /* TODO: implement me. */ |
941 | 0 | break; |
942 | 0 | } |
943 | | |
944 | 0 | return NB_OK; |
945 | 0 | } |
946 | | |
947 | | int lib_interface_zebra_ip_addrs_label_destroy(struct nb_cb_destroy_args *args) |
948 | 0 | { |
949 | 0 | switch (args->event) { |
950 | 0 | case NB_EV_VALIDATE: |
951 | 0 | case NB_EV_PREPARE: |
952 | 0 | case NB_EV_ABORT: |
953 | 0 | case NB_EV_APPLY: |
954 | | /* TODO: implement me. */ |
955 | 0 | break; |
956 | 0 | } |
957 | | |
958 | 0 | return NB_OK; |
959 | 0 | } |
960 | | |
961 | | /* |
962 | | * XPath: /frr-interface:lib/interface/frr-zebra:zebra/ip-addrs/ip4-peer |
963 | | */ |
964 | | int lib_interface_zebra_ip_addrs_ip4_peer_modify(struct nb_cb_modify_args *args) |
965 | 0 | { |
966 | 0 | switch (args->event) { |
967 | 0 | case NB_EV_VALIDATE: |
968 | 0 | case NB_EV_PREPARE: |
969 | 0 | case NB_EV_ABORT: |
970 | 0 | case NB_EV_APPLY: |
971 | | /* TODO: implement me. */ |
972 | 0 | break; |
973 | 0 | } |
974 | | |
975 | 0 | return NB_OK; |
976 | 0 | } |
977 | | |
978 | | int lib_interface_zebra_ip_addrs_ip4_peer_destroy( |
979 | | struct nb_cb_destroy_args *args) |
980 | 0 | { |
981 | 0 | switch (args->event) { |
982 | 0 | case NB_EV_VALIDATE: |
983 | 0 | case NB_EV_PREPARE: |
984 | 0 | case NB_EV_ABORT: |
985 | 0 | case NB_EV_APPLY: |
986 | | /* TODO: implement me. */ |
987 | 0 | break; |
988 | 0 | } |
989 | | |
990 | 0 | return NB_OK; |
991 | 0 | } |
992 | | |
993 | | /* |
994 | | * XPath: /frr-interface:lib/interface/frr-zebra:zebra/multicast |
995 | | */ |
996 | | int lib_interface_zebra_multicast_modify(struct nb_cb_modify_args *args) |
997 | 0 | { |
998 | 0 | if (args->event != NB_EV_APPLY) |
999 | 0 | return NB_OK; |
1000 | | |
1001 | 0 | struct interface *ifp; |
1002 | |
|
1003 | 0 | ifp = nb_running_get_entry(args->dnode, NULL, true); |
1004 | |
|
1005 | 0 | if_multicast_set(ifp); |
1006 | |
|
1007 | 0 | return NB_OK; |
1008 | 0 | } |
1009 | | |
1010 | | int lib_interface_zebra_multicast_destroy(struct nb_cb_destroy_args *args) |
1011 | 0 | { |
1012 | 0 | if (args->event != NB_EV_APPLY) |
1013 | 0 | return NB_OK; |
1014 | | |
1015 | 0 | struct interface *ifp; |
1016 | |
|
1017 | 0 | ifp = nb_running_get_entry(args->dnode, NULL, true); |
1018 | |
|
1019 | 0 | if_multicast_unset(ifp); |
1020 | |
|
1021 | 0 | return NB_OK; |
1022 | 0 | } |
1023 | | |
1024 | | /* |
1025 | | * XPath: /frr-interface:lib/interface/frr-zebra:zebra/link-detect |
1026 | | */ |
1027 | | int lib_interface_zebra_link_detect_modify(struct nb_cb_modify_args *args) |
1028 | 0 | { |
1029 | 0 | if (args->event != NB_EV_APPLY) |
1030 | 0 | return NB_OK; |
1031 | | |
1032 | 0 | struct interface *ifp; |
1033 | 0 | bool link_detect; |
1034 | |
|
1035 | 0 | ifp = nb_running_get_entry(args->dnode, NULL, true); |
1036 | 0 | link_detect = yang_dnode_get_bool(args->dnode, "./link-detect"); |
1037 | |
|
1038 | 0 | if_linkdetect(ifp, link_detect); |
1039 | |
|
1040 | 0 | return NB_OK; |
1041 | 0 | } |
1042 | | |
1043 | | int lib_interface_zebra_link_detect_destroy(struct nb_cb_destroy_args *args) |
1044 | 0 | { |
1045 | 0 | if (args->event != NB_EV_APPLY) |
1046 | 0 | return NB_OK; |
1047 | | |
1048 | 0 | struct interface *ifp; |
1049 | 0 | bool link_detect; |
1050 | |
|
1051 | 0 | ifp = nb_running_get_entry(args->dnode, NULL, true); |
1052 | 0 | link_detect = yang_dnode_get_bool(args->dnode, "./link-detect"); |
1053 | |
|
1054 | 0 | if_linkdetect(ifp, link_detect); |
1055 | |
|
1056 | 0 | return NB_OK; |
1057 | 0 | } |
1058 | | |
1059 | | /* |
1060 | | * XPath: /frr-interface:lib/interface/frr-zebra:zebra/shutdown |
1061 | | */ |
1062 | | int lib_interface_zebra_shutdown_modify(struct nb_cb_modify_args *args) |
1063 | 0 | { |
1064 | 0 | if (args->event != NB_EV_APPLY) |
1065 | 0 | return NB_OK; |
1066 | | |
1067 | 0 | struct interface *ifp; |
1068 | |
|
1069 | 0 | ifp = nb_running_get_entry(args->dnode, NULL, true); |
1070 | |
|
1071 | 0 | if_shutdown(ifp); |
1072 | |
|
1073 | 0 | return NB_OK; |
1074 | 0 | } |
1075 | | |
1076 | | int lib_interface_zebra_shutdown_destroy(struct nb_cb_destroy_args *args) |
1077 | 0 | { |
1078 | 0 | if (args->event != NB_EV_APPLY) |
1079 | 0 | return NB_OK; |
1080 | | |
1081 | 0 | struct interface *ifp; |
1082 | |
|
1083 | 0 | ifp = nb_running_get_entry(args->dnode, NULL, true); |
1084 | |
|
1085 | 0 | if_no_shutdown(ifp); |
1086 | |
|
1087 | 0 | return NB_OK; |
1088 | 0 | } |
1089 | | |
1090 | | /* |
1091 | | * XPath: /frr-interface:lib/interface/frr-zebra:zebra/bandwidth |
1092 | | */ |
1093 | | int lib_interface_zebra_bandwidth_modify(struct nb_cb_modify_args *args) |
1094 | 0 | { |
1095 | 0 | if (args->event != NB_EV_APPLY) |
1096 | 0 | return NB_OK; |
1097 | | |
1098 | 0 | struct interface *ifp; |
1099 | 0 | uint32_t bandwidth; |
1100 | |
|
1101 | 0 | ifp = nb_running_get_entry(args->dnode, NULL, true); |
1102 | 0 | bandwidth = yang_dnode_get_uint32(args->dnode, "./bandwidth"); |
1103 | |
|
1104 | 0 | ifp->bandwidth = bandwidth; |
1105 | | |
1106 | | /* force protocols to recalculate routes due to cost change */ |
1107 | 0 | if (if_is_operative(ifp)) |
1108 | 0 | zebra_interface_up_update(ifp); |
1109 | |
|
1110 | 0 | return NB_OK; |
1111 | 0 | } |
1112 | | |
1113 | | int lib_interface_zebra_bandwidth_destroy(struct nb_cb_destroy_args *args) |
1114 | 0 | { |
1115 | 0 | if (args->event != NB_EV_APPLY) |
1116 | 0 | return NB_OK; |
1117 | | |
1118 | 0 | struct interface *ifp; |
1119 | |
|
1120 | 0 | ifp = nb_running_get_entry(args->dnode, NULL, true); |
1121 | |
|
1122 | 0 | ifp->bandwidth = 0; |
1123 | | |
1124 | | /* force protocols to recalculate routes due to cost change */ |
1125 | 0 | if (if_is_operative(ifp)) |
1126 | 0 | zebra_interface_up_update(ifp); |
1127 | |
|
1128 | 0 | return NB_OK; |
1129 | 0 | } |
1130 | | |
1131 | | /* |
1132 | | * XPath: |
1133 | | * /frr-interface:lib/interface/frr-zebra:zebra/link-params/legacy-admin-group |
1134 | | */ |
1135 | | int lib_interface_zebra_legacy_admin_group_modify( |
1136 | | struct nb_cb_modify_args *args) |
1137 | 0 | { |
1138 | 0 | struct interface *ifp; |
1139 | 0 | struct if_link_params *iflp; |
1140 | 0 | uint32_t admin_group_value; |
1141 | |
|
1142 | 0 | ifp = nb_running_get_entry(args->dnode, NULL, true); |
1143 | 0 | admin_group_value = yang_dnode_get_uint32(args->dnode, "."); |
1144 | |
|
1145 | 0 | if (!ifp) |
1146 | 0 | return NB_ERR_RESOURCE; |
1147 | | |
1148 | 0 | iflp = if_link_params_get(ifp); |
1149 | |
|
1150 | 0 | switch (args->event) { |
1151 | 0 | case NB_EV_VALIDATE: |
1152 | 0 | case NB_EV_PREPARE: |
1153 | 0 | case NB_EV_ABORT: |
1154 | 0 | break; |
1155 | 0 | case NB_EV_APPLY: |
1156 | 0 | if (!iflp) |
1157 | 0 | iflp = if_link_params_enable(ifp); |
1158 | |
|
1159 | 0 | iflp->admin_grp = admin_group_value; |
1160 | 0 | SET_PARAM(iflp, LP_ADM_GRP); |
1161 | |
|
1162 | 0 | admin_group_clear(&iflp->ext_admin_grp); |
1163 | 0 | UNSET_PARAM(iflp, LP_EXTEND_ADM_GRP); |
1164 | |
|
1165 | 0 | if (if_is_operative(ifp)) |
1166 | 0 | zebra_interface_parameters_update(ifp); |
1167 | 0 | break; |
1168 | 0 | } |
1169 | 0 | return NB_OK; |
1170 | 0 | } |
1171 | | |
1172 | | int lib_interface_zebra_legacy_admin_group_destroy( |
1173 | | struct nb_cb_destroy_args *args) |
1174 | 0 | { |
1175 | 0 | struct interface *ifp; |
1176 | 0 | struct if_link_params *iflp; |
1177 | |
|
1178 | 0 | ifp = nb_running_get_entry(args->dnode, NULL, true); |
1179 | |
|
1180 | 0 | if (!ifp) |
1181 | 0 | return NB_ERR_RESOURCE; |
1182 | | |
1183 | 0 | iflp = if_link_params_get(ifp); |
1184 | |
|
1185 | 0 | switch (args->event) { |
1186 | 0 | case NB_EV_VALIDATE: |
1187 | 0 | case NB_EV_PREPARE: |
1188 | 0 | case NB_EV_ABORT: |
1189 | 0 | break; |
1190 | 0 | case NB_EV_APPLY: |
1191 | 0 | if (!iflp) |
1192 | 0 | iflp = if_link_params_enable(ifp); |
1193 | |
|
1194 | 0 | iflp->admin_grp = 0; |
1195 | 0 | UNSET_PARAM(iflp, LP_ADM_GRP); |
1196 | |
|
1197 | 0 | if (if_is_operative(ifp)) |
1198 | 0 | zebra_interface_parameters_update(ifp); |
1199 | 0 | break; |
1200 | 0 | } |
1201 | 0 | return NB_OK; |
1202 | 0 | } |
1203 | | |
1204 | | /* |
1205 | | * XPath: |
1206 | | * /frr-interface:lib/interface/frr-zebra:zebra/link-params/affinities/affinity |
1207 | | */ |
1208 | | int lib_interface_zebra_affinity_create(struct nb_cb_create_args *args) |
1209 | 0 | { |
1210 | 0 | struct interface *ifp; |
1211 | 0 | const char *affname; |
1212 | 0 | struct if_link_params *iflp; |
1213 | 0 | struct affinity_map *affmap; |
1214 | 0 | enum affinity_mode affinity_mode; |
1215 | | |
1216 | |
|
1217 | 0 | ifp = nb_running_get_entry(args->dnode, NULL, true); |
1218 | 0 | affname = yang_dnode_get_string(args->dnode, "."); |
1219 | 0 | affinity_mode = yang_dnode_get_enum(args->dnode, "../../affinity-mode"); |
1220 | |
|
1221 | 0 | if (!ifp) |
1222 | 0 | return NB_ERR_RESOURCE; |
1223 | | |
1224 | 0 | affmap = affinity_map_get(affname); |
1225 | 0 | iflp = if_link_params_get(ifp); |
1226 | |
|
1227 | 0 | switch (args->event) { |
1228 | 0 | case NB_EV_VALIDATE: |
1229 | 0 | if (!affmap) { |
1230 | 0 | snprintf(args->errmsg, args->errmsg_len, |
1231 | 0 | "affinity-map %s not found.", affname); |
1232 | 0 | return NB_ERR_VALIDATION; |
1233 | 0 | } |
1234 | 0 | if (affinity_mode == AFFINITY_MODE_STANDARD && |
1235 | 0 | affmap->bit_position > 31) { |
1236 | 0 | snprintf( |
1237 | 0 | args->errmsg, args->errmsg_len, |
1238 | 0 | "affinity %s bit-position %d is not compatible with affinity-mode standard (bit-position > 31).", |
1239 | 0 | affname, affmap->bit_position); |
1240 | 0 | return NB_ERR_VALIDATION; |
1241 | 0 | } |
1242 | 0 | break; |
1243 | 0 | case NB_EV_PREPARE: |
1244 | 0 | case NB_EV_ABORT: |
1245 | 0 | break; |
1246 | 0 | case NB_EV_APPLY: |
1247 | 0 | if (!iflp) |
1248 | 0 | iflp = if_link_params_enable(ifp); |
1249 | |
|
1250 | 0 | if (affmap->bit_position < 32 && |
1251 | 0 | (affinity_mode == AFFINITY_MODE_STANDARD || |
1252 | 0 | affinity_mode == AFFINITY_MODE_BOTH)) { |
1253 | 0 | iflp->admin_grp |= 1 << affmap->bit_position; |
1254 | 0 | SET_PARAM(iflp, LP_ADM_GRP); |
1255 | 0 | } |
1256 | 0 | if (affinity_mode == AFFINITY_MODE_EXTENDED || |
1257 | 0 | affinity_mode == AFFINITY_MODE_BOTH) { |
1258 | 0 | admin_group_set(&iflp->ext_admin_grp, |
1259 | 0 | affmap->bit_position); |
1260 | 0 | SET_PARAM(iflp, LP_EXTEND_ADM_GRP); |
1261 | 0 | } |
1262 | |
|
1263 | 0 | if (if_is_operative(ifp)) |
1264 | 0 | zebra_interface_parameters_update(ifp); |
1265 | 0 | break; |
1266 | 0 | } |
1267 | 0 | return NB_OK; |
1268 | 0 | } |
1269 | | |
1270 | | int lib_interface_zebra_affinity_destroy(struct nb_cb_destroy_args *args) |
1271 | 0 | { |
1272 | 0 | struct interface *ifp; |
1273 | 0 | const char *affname; |
1274 | 0 | struct if_link_params *iflp; |
1275 | 0 | struct affinity_map *affmap; |
1276 | 0 | enum affinity_mode affinity_mode; |
1277 | |
|
1278 | 0 | ifp = nb_running_get_entry(args->dnode, NULL, true); |
1279 | 0 | affname = yang_dnode_get_string(args->dnode, "."); |
1280 | 0 | affinity_mode = yang_dnode_get_enum(args->dnode, "../../affinity-mode"); |
1281 | |
|
1282 | 0 | if (!ifp) |
1283 | 0 | return NB_ERR_RESOURCE; |
1284 | | |
1285 | 0 | affmap = affinity_map_get(affname); |
1286 | 0 | iflp = if_link_params_get(ifp); |
1287 | |
|
1288 | 0 | switch (args->event) { |
1289 | 0 | case NB_EV_VALIDATE: |
1290 | 0 | if (!affmap) { |
1291 | 0 | snprintf(args->errmsg, args->errmsg_len, |
1292 | 0 | "affinity-map %s not found.", affname); |
1293 | 0 | return NB_ERR_VALIDATION; |
1294 | 0 | } |
1295 | 0 | break; |
1296 | 0 | case NB_EV_PREPARE: |
1297 | 0 | case NB_EV_ABORT: |
1298 | 0 | break; |
1299 | 0 | case NB_EV_APPLY: |
1300 | 0 | if (!iflp) |
1301 | 0 | return NB_OK; |
1302 | 0 | if (affmap->bit_position < 32 && |
1303 | 0 | (affinity_mode == AFFINITY_MODE_STANDARD || |
1304 | 0 | affinity_mode == AFFINITY_MODE_BOTH)) { |
1305 | 0 | iflp->admin_grp &= ~(1 << affmap->bit_position); |
1306 | 0 | if (iflp->admin_grp == 0) |
1307 | 0 | UNSET_PARAM(iflp, LP_ADM_GRP); |
1308 | 0 | } |
1309 | 0 | if (affinity_mode == AFFINITY_MODE_EXTENDED || |
1310 | 0 | affinity_mode == AFFINITY_MODE_BOTH) { |
1311 | 0 | admin_group_unset(&iflp->ext_admin_grp, |
1312 | 0 | affmap->bit_position); |
1313 | 0 | if (admin_group_zero(&iflp->ext_admin_grp)) |
1314 | 0 | UNSET_PARAM(iflp, LP_EXTEND_ADM_GRP); |
1315 | 0 | } |
1316 | |
|
1317 | 0 | if (if_is_operative(ifp)) |
1318 | 0 | zebra_interface_parameters_update(ifp); |
1319 | 0 | break; |
1320 | 0 | } |
1321 | 0 | return NB_OK; |
1322 | 0 | } |
1323 | | |
1324 | | /* |
1325 | | * XPath: |
1326 | | * /frr-interface:lib/interface/frr-zebra:zebra/link-params/affinity-mode |
1327 | | */ |
1328 | | int lib_interface_zebra_affinity_mode_modify(struct nb_cb_modify_args *args) |
1329 | 0 | { |
1330 | 0 | struct interface *ifp; |
1331 | 0 | struct if_link_params *iflp; |
1332 | 0 | enum affinity_mode affinity_mode; |
1333 | | |
1334 | |
|
1335 | 0 | ifp = nb_running_get_entry(args->dnode, NULL, true); |
1336 | 0 | affinity_mode = yang_dnode_get_enum(args->dnode, "."); |
1337 | |
|
1338 | 0 | if (!ifp) |
1339 | 0 | return NB_ERR_RESOURCE; |
1340 | | |
1341 | 0 | iflp = if_link_params_get(ifp); |
1342 | |
|
1343 | 0 | switch (args->event) { |
1344 | 0 | case NB_EV_VALIDATE: |
1345 | 0 | if (affinity_mode == AFFINITY_MODE_STANDARD && |
1346 | 0 | admin_group_nb_words(&iflp->ext_admin_grp) > 1) { |
1347 | 0 | snprintf( |
1348 | 0 | args->errmsg, args->errmsg_len, |
1349 | 0 | "affinity-mode standard cannot be set when a bit-position > 31 is set."); |
1350 | 0 | return NB_ERR_VALIDATION; |
1351 | 0 | } |
1352 | 0 | break; |
1353 | 0 | case NB_EV_PREPARE: |
1354 | 0 | case NB_EV_ABORT: |
1355 | 0 | break; |
1356 | 0 | case NB_EV_APPLY: |
1357 | 0 | if (!iflp) |
1358 | 0 | iflp = if_link_params_enable(ifp); |
1359 | 0 | if (affinity_mode == AFFINITY_MODE_STANDARD) { |
1360 | 0 | if (!IS_PARAM_SET(iflp, LP_ADM_GRP) && |
1361 | 0 | IS_PARAM_SET(iflp, LP_EXTEND_ADM_GRP)) { |
1362 | 0 | iflp->admin_grp = admin_group_get_offset( |
1363 | 0 | &iflp->ext_admin_grp, 0); |
1364 | 0 | SET_PARAM(iflp, LP_ADM_GRP); |
1365 | 0 | } |
1366 | 0 | admin_group_clear(&iflp->ext_admin_grp); |
1367 | 0 | UNSET_PARAM(iflp, LP_EXTEND_ADM_GRP); |
1368 | 0 | } |
1369 | 0 | if (affinity_mode == AFFINITY_MODE_EXTENDED) { |
1370 | 0 | if (!IS_PARAM_SET(iflp, LP_EXTEND_ADM_GRP) && |
1371 | 0 | IS_PARAM_SET(iflp, LP_ADM_GRP)) { |
1372 | 0 | admin_group_bulk_set(&iflp->ext_admin_grp, |
1373 | 0 | iflp->admin_grp, 0); |
1374 | 0 | SET_PARAM(iflp, LP_EXTEND_ADM_GRP); |
1375 | 0 | } |
1376 | 0 | iflp->admin_grp = 0; |
1377 | 0 | UNSET_PARAM(iflp, LP_ADM_GRP); |
1378 | 0 | } |
1379 | 0 | if (affinity_mode == AFFINITY_MODE_BOTH) { |
1380 | 0 | if (!IS_PARAM_SET(iflp, LP_EXTEND_ADM_GRP) && |
1381 | 0 | IS_PARAM_SET(iflp, LP_ADM_GRP)) { |
1382 | 0 | admin_group_bulk_set(&iflp->ext_admin_grp, |
1383 | 0 | iflp->admin_grp, 0); |
1384 | 0 | SET_PARAM(iflp, LP_EXTEND_ADM_GRP); |
1385 | 0 | } else if (!IS_PARAM_SET(iflp, LP_ADM_GRP) && |
1386 | 0 | IS_PARAM_SET(iflp, LP_EXTEND_ADM_GRP)) { |
1387 | 0 | iflp->admin_grp = admin_group_get_offset( |
1388 | 0 | &iflp->ext_admin_grp, 0); |
1389 | 0 | SET_PARAM(iflp, LP_ADM_GRP); |
1390 | 0 | } |
1391 | 0 | } |
1392 | |
|
1393 | 0 | if (if_is_operative(ifp)) |
1394 | 0 | zebra_interface_parameters_update(ifp); |
1395 | 0 | break; |
1396 | 0 | } |
1397 | 0 | return NB_OK; |
1398 | 0 | } |
1399 | | |
1400 | | /* |
1401 | | * XPath: /frr-vrf:lib/vrf/frr-zebra:zebra/l3vni-id |
1402 | | */ |
1403 | | int lib_vrf_zebra_l3vni_id_modify(struct nb_cb_modify_args *args) |
1404 | 0 | { |
1405 | 0 | struct vrf *vrf; |
1406 | 0 | struct zebra_vrf *zvrf; |
1407 | 0 | vni_t vni = 0; |
1408 | 0 | struct zebra_l3vni *zl3vni = NULL; |
1409 | 0 | char err[ERR_STR_SZ]; |
1410 | 0 | bool pfx_only = false; |
1411 | 0 | const struct lyd_node *pn_dnode; |
1412 | 0 | const char *vrfname; |
1413 | |
|
1414 | 0 | switch (args->event) { |
1415 | 0 | case NB_EV_PREPARE: |
1416 | 0 | case NB_EV_ABORT: |
1417 | 0 | return NB_OK; |
1418 | 0 | case NB_EV_VALIDATE: |
1419 | 0 | vni = yang_dnode_get_uint32(args->dnode, NULL); |
1420 | | /* Get vrf info from parent node, reject configuration |
1421 | | * if zebra vrf already mapped to different vni id. |
1422 | | */ |
1423 | 0 | pn_dnode = yang_dnode_get_parent(args->dnode, "vrf"); |
1424 | 0 | vrfname = yang_dnode_get_string(pn_dnode, "./name"); |
1425 | 0 | zvrf = zebra_vrf_lookup_by_name(vrfname); |
1426 | 0 | if (!zvrf) { |
1427 | 0 | snprintf(args->errmsg, args->errmsg_len, |
1428 | 0 | "zebra vrf info not found for vrf:%s.", |
1429 | 0 | vrfname); |
1430 | 0 | return NB_ERR_VALIDATION; |
1431 | 0 | } |
1432 | 0 | if (zvrf->l3vni && zvrf->l3vni != vni) { |
1433 | 0 | snprintf( |
1434 | 0 | args->errmsg, args->errmsg_len, |
1435 | 0 | "vni %u cannot be configured as vni %u is already configured under the vrf", |
1436 | 0 | vni, zvrf->l3vni); |
1437 | 0 | return NB_ERR_VALIDATION; |
1438 | 0 | } |
1439 | | |
1440 | | /* Check if this VNI is already present in the system */ |
1441 | 0 | zl3vni = zl3vni_lookup(vni); |
1442 | 0 | if (zl3vni) { |
1443 | 0 | snprintf(args->errmsg, args->errmsg_len, |
1444 | 0 | "VNI %u is already configured as L3-VNI", vni); |
1445 | 0 | return NB_ERR_VALIDATION; |
1446 | 0 | } |
1447 | | |
1448 | 0 | break; |
1449 | 0 | case NB_EV_APPLY: |
1450 | |
|
1451 | 0 | vrf = nb_running_get_entry(args->dnode, NULL, true); |
1452 | 0 | zvrf = zebra_vrf_lookup_by_name(vrf->name); |
1453 | 0 | vni = yang_dnode_get_uint32(args->dnode, NULL); |
1454 | | /* Note: This covers lib_vrf_zebra_prefix_only_modify() config |
1455 | | * along with l3vni config |
1456 | | */ |
1457 | 0 | pfx_only = yang_dnode_get_bool(args->dnode, "../prefix-only"); |
1458 | |
|
1459 | 0 | if (zebra_vxlan_process_vrf_vni_cmd(zvrf, vni, err, ERR_STR_SZ, |
1460 | 0 | pfx_only ? 1 : 0, 1) |
1461 | 0 | != 0) { |
1462 | 0 | if (IS_ZEBRA_DEBUG_VXLAN) |
1463 | 0 | snprintf( |
1464 | 0 | args->errmsg, args->errmsg_len, |
1465 | 0 | "vrf vni %u mapping failed with error: %s", |
1466 | 0 | vni, err); |
1467 | 0 | return NB_ERR; |
1468 | 0 | } |
1469 | | |
1470 | 0 | break; |
1471 | 0 | } |
1472 | | |
1473 | 0 | return NB_OK; |
1474 | 0 | } |
1475 | | |
1476 | | int lib_vrf_zebra_l3vni_id_destroy(struct nb_cb_destroy_args *args) |
1477 | 0 | { |
1478 | 0 | struct vrf *vrf; |
1479 | 0 | struct zebra_vrf *zvrf; |
1480 | 0 | vni_t vni = 0; |
1481 | 0 | char err[ERR_STR_SZ]; |
1482 | 0 | uint8_t filter = 0; |
1483 | |
|
1484 | 0 | switch (args->event) { |
1485 | 0 | case NB_EV_PREPARE: |
1486 | 0 | case NB_EV_ABORT: |
1487 | 0 | case NB_EV_VALIDATE: |
1488 | 0 | return NB_OK; |
1489 | 0 | case NB_EV_APPLY: |
1490 | 0 | vrf = nb_running_get_entry(args->dnode, NULL, true); |
1491 | 0 | zvrf = zebra_vrf_lookup_by_name(vrf->name); |
1492 | 0 | vni = yang_dnode_get_uint32(args->dnode, NULL); |
1493 | |
|
1494 | 0 | if (!zl3vni_lookup(vni)) |
1495 | 0 | return NB_OK; |
1496 | | |
1497 | 0 | if (zvrf->l3vni != vni) { |
1498 | 0 | snprintf(args->errmsg, args->errmsg_len, |
1499 | 0 | "vrf %s has different vni %u mapped", |
1500 | 0 | vrf->name, zvrf->l3vni); |
1501 | 0 | return NB_ERR; |
1502 | 0 | } |
1503 | | |
1504 | 0 | if (is_l3vni_for_prefix_routes_only(zvrf->l3vni)) |
1505 | 0 | filter = 1; |
1506 | |
|
1507 | 0 | if (zebra_vxlan_process_vrf_vni_cmd(zvrf, vni, err, ERR_STR_SZ, |
1508 | 0 | filter, 0) |
1509 | 0 | != 0) { |
1510 | 0 | if (IS_ZEBRA_DEBUG_VXLAN) |
1511 | 0 | zlog_debug( |
1512 | 0 | "vrf vni %u unmapping failed with error: %s", |
1513 | 0 | vni, err); |
1514 | 0 | return NB_ERR; |
1515 | 0 | } |
1516 | | |
1517 | 0 | break; |
1518 | 0 | } |
1519 | | |
1520 | 0 | return NB_OK; |
1521 | 0 | } |
1522 | | |
1523 | | /* |
1524 | | * XPath: /frr-vrf:lib/vrf/frr-zebra:zebra/prefix-only |
1525 | | */ |
1526 | | int lib_vrf_zebra_prefix_only_modify(struct nb_cb_modify_args *args) |
1527 | 0 | { |
1528 | 0 | switch (args->event) { |
1529 | 0 | case NB_EV_VALIDATE: |
1530 | 0 | case NB_EV_PREPARE: |
1531 | 0 | case NB_EV_ABORT: |
1532 | 0 | case NB_EV_APPLY: |
1533 | | /* TODO: implement me. */ |
1534 | 0 | break; |
1535 | 0 | } |
1536 | | |
1537 | 0 | return NB_OK; |
1538 | 0 | } |