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