]> git.proxmox.com Git - mirror_frr.git/blame - vrrpd/vrrp_northbound.c
tools: improve explanation of 'wrap' options
[mirror_frr.git] / vrrpd / vrrp_northbound.c
CommitLineData
f495425b
QY
1/*
2 * VRRP northbound bindings.
3 * Copyright (C) 2019 Cumulus Networks, Inc.
4 * Quentin Young
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <zebra.h>
22
23#include "if.h"
24#include "log.h"
25#include "prefix.h"
26#include "table.h"
27#include "command.h"
28#include "northbound.h"
29#include "libfrr.h"
30#include "vrrp.h"
31#include "vrrp_vty.h"
32
33/*
34 * XPath: /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group
35 */
60ee8be1 36static int lib_interface_vrrp_vrrp_group_create(struct nb_cb_create_args *args)
f495425b
QY
37{
38 struct interface *ifp;
39 uint8_t vrid;
40 uint8_t version = 3;
41 struct vrrp_vrouter *vr;
42
60ee8be1
RW
43 vrid = yang_dnode_get_uint8(args->dnode, "./virtual-router-id");
44 version = yang_dnode_get_enum(args->dnode, "./version");
ee723e13 45
f4893b09 46 switch (args->event) {
ee723e13 47 case NB_EV_VALIDATE:
8a601eb7 48 ifp = nb_running_get_entry(args->dnode, NULL, false);
f4893b09
QY
49 if (ifp) {
50 vr = vrrp_lookup(ifp, vrid);
8a601eb7
QY
51 if (vr && vr->autoconf) {
52 snprintf(
53 args->errmsg, args->errmsg_len,
54 "Virtual Router with ID %d already exists on interface '%s'; created by VRRP autoconfiguration",
55 vrid, ifp->name);
f4893b09 56 return NB_ERR_VALIDATION;
8a601eb7 57 }
f4893b09
QY
58 }
59 return NB_OK;
ee723e13
QY
60 case NB_EV_PREPARE:
61 case NB_EV_ABORT:
62 return NB_OK;
63 case NB_EV_APPLY:
64 break;
65 }
66
8a601eb7 67 ifp = nb_running_get_entry(args->dnode, NULL, true);
f495425b 68 vr = vrrp_vrouter_create(ifp, vrid, version);
60ee8be1 69 nb_running_set_entry(args->dnode, vr);
f495425b
QY
70
71 return NB_OK;
72}
73
60ee8be1
RW
74static int
75lib_interface_vrrp_vrrp_group_destroy(struct nb_cb_destroy_args *args)
f495425b
QY
76{
77 struct vrrp_vrouter *vr;
78
60ee8be1 79 if (args->event != NB_EV_APPLY)
f495425b
QY
80 return NB_OK;
81
60ee8be1 82 vr = nb_running_unset_entry(args->dnode);
f495425b
QY
83 vrrp_vrouter_destroy(vr);
84
85 return NB_OK;
86}
87
88static const void *
60ee8be1 89lib_interface_vrrp_vrrp_group_get_next(struct nb_cb_get_next_args *args)
f495425b
QY
90{
91 struct list *l = hash_to_list(vrrp_vrouters_hash);
92 struct listnode *ln;
6356b286 93 const struct vrrp_vrouter *curr;
60ee8be1 94 const struct interface *ifp = args->parent_list_entry;
f495425b 95
f495425b
QY
96 /*
97 * If list_entry is null, we return the first vrrp instance with a
98 * matching interface
99 */
60ee8be1 100 bool nextone = args->list_entry ? false : true;
f495425b
QY
101
102 for (ALL_LIST_ELEMENTS_RO(l, ln, curr)) {
60ee8be1 103 if (curr == args->list_entry) {
f495425b
QY
104 nextone = true;
105 continue;
106 }
107
108 if (nextone && curr->ifp == ifp)
109 goto done;
f495425b
QY
110 }
111
112 curr = NULL;
113
114done:
115 list_delete(&l);
116 return curr;
117}
118
60ee8be1
RW
119static int
120lib_interface_vrrp_vrrp_group_get_keys(struct nb_cb_get_keys_args *args)
f495425b 121{
60ee8be1 122 const struct vrrp_vrouter *vr = args->list_entry;
f495425b 123
60ee8be1 124 args->keys->num = 1;
6cde4b45 125 snprintf(args->keys->key[0], sizeof(args->keys->key[0]), "%u",
60ee8be1 126 vr->vrid);
f495425b
QY
127
128 return NB_OK;
129}
130
131static const void *
60ee8be1 132lib_interface_vrrp_vrrp_group_lookup_entry(struct nb_cb_lookup_entry_args *args)
f495425b 133{
60ee8be1
RW
134 uint32_t vrid = strtoul(args->keys->key[0], NULL, 10);
135 const struct interface *ifp = args->parent_list_entry;
f495425b 136
534b98f9 137 return vrrp_lookup(ifp, vrid);
f495425b
QY
138}
139
140/*
141 * XPath: /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/version
142 */
143static int
60ee8be1 144lib_interface_vrrp_vrrp_group_version_modify(struct nb_cb_modify_args *args)
f495425b 145{
60ee8be1 146 if (args->event != NB_EV_APPLY)
f495425b
QY
147 return NB_OK;
148
149 struct vrrp_vrouter *vr;
150 uint8_t version;
151
60ee8be1 152 vr = nb_running_get_entry(args->dnode, NULL, true);
f495425b
QY
153 vrrp_event(vr->v4, VRRP_EVENT_SHUTDOWN);
154 vrrp_event(vr->v6, VRRP_EVENT_SHUTDOWN);
60ee8be1 155 version = yang_dnode_get_enum(args->dnode, NULL);
f495425b
QY
156 vr->version = version;
157
158 vrrp_check_start(vr);
159
160 return NB_OK;
161}
162
534b98f9
QY
163/*
164 * Helper function for address list OP_MODIFY callbacks.
165 */
f495425b
QY
166static void vrrp_yang_add_del_virtual_address(const struct lyd_node *dnode,
167 bool add)
168{
169 struct vrrp_vrouter *vr;
170 struct ipaddr ip;
171
172 vr = nb_running_get_entry(dnode, NULL, true);
173 yang_dnode_get_ip(&ip, dnode, NULL);
174 if (add)
175 vrrp_add_ip(vr, &ip);
176 else
177 vrrp_del_ip(vr, &ip);
178
179 vrrp_check_start(vr);
180}
181
f495425b
QY
182/*
183 * XPath:
184 * /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v4/virtual-address
185 */
186static int lib_interface_vrrp_vrrp_group_v4_virtual_address_create(
60ee8be1 187 struct nb_cb_create_args *args)
f495425b 188{
60ee8be1 189 if (args->event != NB_EV_APPLY)
f495425b
QY
190 return NB_OK;
191
60ee8be1 192 vrrp_yang_add_del_virtual_address(args->dnode, true);
f495425b
QY
193
194 return NB_OK;
195}
196
197static int lib_interface_vrrp_vrrp_group_v4_virtual_address_destroy(
60ee8be1 198 struct nb_cb_destroy_args *args)
f495425b 199{
60ee8be1 200 if (args->event != NB_EV_APPLY)
f495425b
QY
201 return NB_OK;
202
60ee8be1 203 vrrp_yang_add_del_virtual_address(args->dnode, false);
f495425b
QY
204
205 return NB_OK;
206}
207
208/*
209 * XPath:
210 * /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v4/current-priority
211 */
212static struct yang_data *
213lib_interface_vrrp_vrrp_group_v4_current_priority_get_elem(
60ee8be1 214 struct nb_cb_get_elem_args *args)
f495425b 215{
60ee8be1 216 const struct vrrp_vrouter *vr = args->list_entry;
f495425b 217
60ee8be1 218 return yang_data_new_uint8(args->xpath, vr->v4->priority);
f495425b
QY
219}
220
221/*
222 * XPath:
223 * /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v4/vrrp-interface
224 */
225static struct yang_data *
60ee8be1
RW
226lib_interface_vrrp_vrrp_group_v4_vrrp_interface_get_elem(
227 struct nb_cb_get_elem_args *args)
f495425b 228{
60ee8be1 229 const struct vrrp_vrouter *vr = args->list_entry;
f495425b
QY
230
231 struct yang_data *val = NULL;
232
233 if (vr->v4->mvl_ifp)
60ee8be1 234 val = yang_data_new_string(args->xpath, vr->v4->mvl_ifp->name);
f495425b
QY
235
236 return val;
237}
238
239/*
240 * XPath:
241 * /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v4/source-address
242 */
243static struct yang_data *
60ee8be1
RW
244lib_interface_vrrp_vrrp_group_v4_source_address_get_elem(
245 struct nb_cb_get_elem_args *args)
f495425b 246{
60ee8be1 247 const struct vrrp_vrouter *vr = args->list_entry;
f495425b 248 struct yang_data *val = NULL;
f495425b 249
3448a75c 250 if (!ipaddr_is_zero(&vr->v4->src))
60ee8be1 251 val = yang_data_new_ip(args->xpath, &vr->v4->src);
f495425b
QY
252
253 return val;
254}
255
256/*
257 * XPath: /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v4/state
258 */
60ee8be1
RW
259static struct yang_data *lib_interface_vrrp_vrrp_group_v4_state_get_elem(
260 struct nb_cb_get_elem_args *args)
f495425b 261{
60ee8be1 262 const struct vrrp_vrouter *vr = args->list_entry;
f495425b 263
60ee8be1 264 return yang_data_new_enum(args->xpath, vr->v4->fsm.state);
f495425b
QY
265}
266
267/*
268 * XPath:
269 * /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v4/master-advertisement-interval
270 */
271static struct yang_data *
272lib_interface_vrrp_vrrp_group_v4_master_advertisement_interval_get_elem(
60ee8be1 273 struct nb_cb_get_elem_args *args)
f495425b 274{
60ee8be1 275 const struct vrrp_vrouter *vr = args->list_entry;
f495425b 276
60ee8be1 277 return yang_data_new_uint16(args->xpath, vr->v4->master_adver_interval);
f495425b
QY
278}
279
280/*
281 * XPath: /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v4/skew-time
282 */
60ee8be1
RW
283static struct yang_data *lib_interface_vrrp_vrrp_group_v4_skew_time_get_elem(
284 struct nb_cb_get_elem_args *args)
f495425b 285{
60ee8be1 286 const struct vrrp_vrouter *vr = args->list_entry;
f495425b 287
60ee8be1 288 return yang_data_new_uint16(args->xpath, vr->v4->skew_time);
f495425b
QY
289}
290
291/*
292 * XPath:
293 * /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v4/counter/state-transition
294 */
295static struct yang_data *
296lib_interface_vrrp_vrrp_group_v4_counter_state_transition_get_elem(
60ee8be1 297 struct nb_cb_get_elem_args *args)
f495425b 298{
60ee8be1 299 const struct vrrp_vrouter *vr = args->list_entry;
f495425b 300
60ee8be1 301 return yang_data_new_uint32(args->xpath, vr->v4->stats.trans_cnt);
f495425b
QY
302}
303
304/*
305 * XPath:
306 * /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v4/counter/tx/advertisement
307 */
308static struct yang_data *
309lib_interface_vrrp_vrrp_group_v4_counter_tx_advertisement_get_elem(
60ee8be1 310 struct nb_cb_get_elem_args *args)
f495425b 311{
60ee8be1 312 const struct vrrp_vrouter *vr = args->list_entry;
f495425b 313
60ee8be1 314 return yang_data_new_uint32(args->xpath, vr->v4->stats.adver_tx_cnt);
f495425b
QY
315}
316
317/*
318 * XPath:
319 * /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v4/counter/tx/gratuitous-arp
320 */
321static struct yang_data *
322lib_interface_vrrp_vrrp_group_v4_counter_tx_gratuitous_arp_get_elem(
60ee8be1 323 struct nb_cb_get_elem_args *args)
f495425b 324{
60ee8be1 325 const struct vrrp_vrouter *vr = args->list_entry;
f495425b 326
60ee8be1 327 return yang_data_new_uint32(args->xpath, vr->v4->stats.garp_tx_cnt);
f495425b
QY
328}
329
330/*
331 * XPath:
332 * /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v4/counter/rx/advertisement
333 */
334static struct yang_data *
335lib_interface_vrrp_vrrp_group_v4_counter_rx_advertisement_get_elem(
60ee8be1 336 struct nb_cb_get_elem_args *args)
f495425b 337{
60ee8be1 338 const struct vrrp_vrouter *vr = args->list_entry;
f495425b 339
60ee8be1 340 return yang_data_new_uint32(args->xpath, vr->v4->stats.adver_rx_cnt);
f495425b
QY
341}
342
343/*
344 * XPath:
345 * /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v6/virtual-address
346 */
347static int lib_interface_vrrp_vrrp_group_v6_virtual_address_create(
60ee8be1 348 struct nb_cb_create_args *args)
f495425b 349{
60ee8be1 350 if (args->event != NB_EV_APPLY)
f495425b
QY
351 return NB_OK;
352
60ee8be1 353 vrrp_yang_add_del_virtual_address(args->dnode, true);
f495425b
QY
354
355 return NB_OK;
356}
357
358static int lib_interface_vrrp_vrrp_group_v6_virtual_address_destroy(
60ee8be1 359 struct nb_cb_destroy_args *args)
f495425b 360{
60ee8be1 361 if (args->event != NB_EV_APPLY)
f495425b
QY
362 return NB_OK;
363
60ee8be1 364 vrrp_yang_add_del_virtual_address(args->dnode, false);
f495425b
QY
365
366 return NB_OK;
367}
368
369/*
370 * XPath:
371 * /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v6/current-priority
372 */
373static struct yang_data *
374lib_interface_vrrp_vrrp_group_v6_current_priority_get_elem(
60ee8be1 375 struct nb_cb_get_elem_args *args)
f495425b 376{
60ee8be1 377 const struct vrrp_vrouter *vr = args->list_entry;
f495425b 378
60ee8be1 379 return yang_data_new_uint8(args->xpath, vr->v6->priority);
f495425b
QY
380}
381
382/*
383 * XPath:
384 * /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v6/vrrp-interface
385 */
386static struct yang_data *
60ee8be1
RW
387lib_interface_vrrp_vrrp_group_v6_vrrp_interface_get_elem(
388 struct nb_cb_get_elem_args *args)
f495425b 389{
60ee8be1 390 const struct vrrp_vrouter *vr = args->list_entry;
f495425b
QY
391 struct yang_data *val = NULL;
392
393 if (vr->v6->mvl_ifp)
60ee8be1 394 val = yang_data_new_string(args->xpath, vr->v6->mvl_ifp->name);
f495425b
QY
395
396 return val;
397}
398
399/*
400 * XPath:
401 * /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v6/source-address
402 */
403static struct yang_data *
60ee8be1
RW
404lib_interface_vrrp_vrrp_group_v6_source_address_get_elem(
405 struct nb_cb_get_elem_args *args)
f495425b 406{
60ee8be1 407 const struct vrrp_vrouter *vr = args->list_entry;
f495425b 408 struct yang_data *val = NULL;
f495425b 409
3448a75c 410 if (!ipaddr_is_zero(&vr->v6->src))
60ee8be1 411 val = yang_data_new_ip(args->xpath, &vr->v6->src);
f495425b
QY
412
413 return val;
414}
415
416/*
417 * XPath: /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v6/state
418 */
60ee8be1
RW
419static struct yang_data *lib_interface_vrrp_vrrp_group_v6_state_get_elem(
420 struct nb_cb_get_elem_args *args)
f495425b 421{
60ee8be1 422 const struct vrrp_vrouter *vr = args->list_entry;
f495425b 423
60ee8be1 424 return yang_data_new_enum(args->xpath, vr->v6->fsm.state);
f495425b
QY
425}
426
427/*
428 * XPath:
429 * /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v6/master-advertisement-interval
430 */
431static struct yang_data *
432lib_interface_vrrp_vrrp_group_v6_master_advertisement_interval_get_elem(
60ee8be1 433 struct nb_cb_get_elem_args *args)
f495425b 434{
60ee8be1 435 const struct vrrp_vrouter *vr = args->list_entry;
f495425b 436
60ee8be1 437 return yang_data_new_uint16(args->xpath, vr->v6->master_adver_interval);
f495425b
QY
438}
439
440/*
441 * XPath: /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v6/skew-time
442 */
60ee8be1
RW
443static struct yang_data *lib_interface_vrrp_vrrp_group_v6_skew_time_get_elem(
444 struct nb_cb_get_elem_args *args)
f495425b 445{
60ee8be1 446 const struct vrrp_vrouter *vr = args->list_entry;
f495425b 447
60ee8be1 448 return yang_data_new_uint16(args->xpath, vr->v6->skew_time);
f495425b
QY
449}
450
451/*
452 * XPath:
453 * /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v6/counter/state-transition
454 */
455static struct yang_data *
456lib_interface_vrrp_vrrp_group_v6_counter_state_transition_get_elem(
60ee8be1 457 struct nb_cb_get_elem_args *args)
f495425b 458{
60ee8be1 459 const struct vrrp_vrouter *vr = args->list_entry;
f495425b 460
60ee8be1 461 return yang_data_new_uint32(args->xpath, vr->v6->stats.trans_cnt);
f495425b
QY
462}
463
464/*
465 * XPath:
466 * /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v6/counter/tx/advertisement
467 */
468static struct yang_data *
469lib_interface_vrrp_vrrp_group_v6_counter_tx_advertisement_get_elem(
60ee8be1 470 struct nb_cb_get_elem_args *args)
f495425b 471{
60ee8be1 472 const struct vrrp_vrouter *vr = args->list_entry;
f495425b 473
60ee8be1 474 return yang_data_new_uint32(args->xpath, vr->v6->stats.adver_tx_cnt);
f495425b
QY
475}
476
477/*
478 * XPath:
479 * /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v6/counter/tx/neighbor-advertisement
480 */
481static struct yang_data *
482lib_interface_vrrp_vrrp_group_v6_counter_tx_neighbor_advertisement_get_elem(
60ee8be1 483 struct nb_cb_get_elem_args *args)
f495425b
QY
484{
485 /* TODO: implement me. */
486 return NULL;
487}
488
489/*
490 * XPath:
491 * /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v6/counter/rx/advertisement
492 */
493static struct yang_data *
494lib_interface_vrrp_vrrp_group_v6_counter_rx_advertisement_get_elem(
60ee8be1 495 struct nb_cb_get_elem_args *args)
f495425b
QY
496{
497 /* TODO: implement me. */
498 return NULL;
499}
500
501/*
502 * XPath: /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/priority
503 */
504static int
60ee8be1 505lib_interface_vrrp_vrrp_group_priority_modify(struct nb_cb_modify_args *args)
f495425b 506{
60ee8be1 507 if (args->event != NB_EV_APPLY)
f495425b
QY
508 return NB_OK;
509
510 struct vrrp_vrouter *vr;
511 uint8_t priority;
512
60ee8be1
RW
513 vr = nb_running_get_entry(args->dnode, NULL, true);
514 priority = yang_dnode_get_uint8(args->dnode, NULL);
f495425b
QY
515 vrrp_set_priority(vr, priority);
516
517 return NB_OK;
518}
519
520/*
521 * XPath: /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/preempt
522 */
523static int
60ee8be1 524lib_interface_vrrp_vrrp_group_preempt_modify(struct nb_cb_modify_args *args)
f495425b 525{
60ee8be1 526 if (args->event != NB_EV_APPLY)
f495425b
QY
527 return NB_OK;
528
529 struct vrrp_vrouter *vr;
530 bool preempt;
531
60ee8be1
RW
532 vr = nb_running_get_entry(args->dnode, NULL, true);
533 preempt = yang_dnode_get_bool(args->dnode, NULL);
f495425b
QY
534 vr->preempt_mode = preempt;
535
536 return NB_OK;
537}
538
539/*
540 * XPath: /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/accept-mode
541 */
542static int
60ee8be1 543lib_interface_vrrp_vrrp_group_accept_mode_modify(struct nb_cb_modify_args *args)
f495425b 544{
60ee8be1 545 if (args->event != NB_EV_APPLY)
f495425b
QY
546 return NB_OK;
547
548 struct vrrp_vrouter *vr;
549 bool accept;
550
60ee8be1
RW
551 vr = nb_running_get_entry(args->dnode, NULL, true);
552 accept = yang_dnode_get_bool(args->dnode, NULL);
f495425b
QY
553 vr->accept_mode = accept;
554
555 return NB_OK;
556}
557
558/*
559 * XPath:
560 * /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/advertisement-interval
561 */
562static int lib_interface_vrrp_vrrp_group_advertisement_interval_modify(
60ee8be1 563 struct nb_cb_modify_args *args)
f495425b 564{
60ee8be1 565 if (args->event != NB_EV_APPLY)
f495425b
QY
566 return NB_OK;
567
568 struct vrrp_vrouter *vr;
569 uint16_t advert_int;
570
60ee8be1
RW
571 vr = nb_running_get_entry(args->dnode, NULL, true);
572 advert_int = yang_dnode_get_uint16(args->dnode, NULL);
f495425b
QY
573 vrrp_set_advertisement_interval(vr, advert_int);
574
575 return NB_OK;
576}
577
578/*
579 * XPath: /frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/shutdown
580 */
581static int
60ee8be1 582lib_interface_vrrp_vrrp_group_shutdown_modify(struct nb_cb_modify_args *args)
f495425b 583{
60ee8be1 584 if (args->event != NB_EV_APPLY)
f495425b
QY
585 return NB_OK;
586
587 struct vrrp_vrouter *vr;
588 bool shutdown;
589
60ee8be1
RW
590 vr = nb_running_get_entry(args->dnode, NULL, true);
591 shutdown = yang_dnode_get_bool(args->dnode, NULL);
f495425b
QY
592
593 vr->shutdown = shutdown;
594
595 if (shutdown) {
596 vrrp_event(vr->v4, VRRP_EVENT_SHUTDOWN);
597 vrrp_event(vr->v6, VRRP_EVENT_SHUTDOWN);
598 } else {
599 vrrp_check_start(vr);
600 }
601
602 return NB_OK;
603}
604
605/* clang-format off */
606const struct frr_yang_module_info frr_vrrpd_info = {
607 .name = "frr-vrrpd",
608 .nodes = {
609 {
610 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group",
611 .cbs = {
612 .create = lib_interface_vrrp_vrrp_group_create,
613 .destroy = lib_interface_vrrp_vrrp_group_destroy,
614 .get_next = lib_interface_vrrp_vrrp_group_get_next,
615 .get_keys = lib_interface_vrrp_vrrp_group_get_keys,
616 .lookup_entry = lib_interface_vrrp_vrrp_group_lookup_entry,
617 .cli_show = cli_show_vrrp,
618 }
619 },
620 {
621 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/version",
622 .cbs = {
623 .modify = lib_interface_vrrp_vrrp_group_version_modify,
624 }
625 },
626 {
627 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/priority",
628 .cbs = {
629 .modify = lib_interface_vrrp_vrrp_group_priority_modify,
630 .cli_show = cli_show_priority,
631 }
632 },
633 {
634 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/preempt",
635 .cbs = {
636 .modify = lib_interface_vrrp_vrrp_group_preempt_modify,
637 .cli_show = cli_show_preempt,
638 }
639 },
640 {
641 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/accept-mode",
642 .cbs = {
643 .modify = lib_interface_vrrp_vrrp_group_accept_mode_modify,
644 }
645 },
646 {
647 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/advertisement-interval",
648 .cbs = {
649 .modify = lib_interface_vrrp_vrrp_group_advertisement_interval_modify,
650 .cli_show = cli_show_advertisement_interval,
651 }
652 },
653 {
654 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/shutdown",
655 .cbs = {
656 .modify = lib_interface_vrrp_vrrp_group_shutdown_modify,
657 .cli_show = cli_show_shutdown,
658 }
659 },
660 {
661 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v4/virtual-address",
662 .cbs = {
663 .create = lib_interface_vrrp_vrrp_group_v4_virtual_address_create,
664 .destroy = lib_interface_vrrp_vrrp_group_v4_virtual_address_destroy,
665 .cli_show = cli_show_ip,
666 }
667 },
668 {
669 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v4/current-priority",
670 .cbs = {
671 .get_elem = lib_interface_vrrp_vrrp_group_v4_current_priority_get_elem,
672 }
673 },
674 {
675 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v4/vrrp-interface",
676 .cbs = {
677 .get_elem = lib_interface_vrrp_vrrp_group_v4_vrrp_interface_get_elem,
678 }
679 },
680 {
681 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v4/source-address",
682 .cbs = {
683 .get_elem = lib_interface_vrrp_vrrp_group_v4_source_address_get_elem,
684 }
685 },
686 {
687 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v4/state",
688 .cbs = {
689 .get_elem = lib_interface_vrrp_vrrp_group_v4_state_get_elem,
690 }
691 },
692 {
693 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v4/master-advertisement-interval",
694 .cbs = {
695 .get_elem = lib_interface_vrrp_vrrp_group_v4_master_advertisement_interval_get_elem,
696 }
697 },
698 {
699 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v4/skew-time",
700 .cbs = {
701 .get_elem = lib_interface_vrrp_vrrp_group_v4_skew_time_get_elem,
702 }
703 },
704 {
705 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v4/counter/state-transition",
706 .cbs = {
707 .get_elem = lib_interface_vrrp_vrrp_group_v4_counter_state_transition_get_elem,
708 }
709 },
710 {
711 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v4/counter/tx/advertisement",
712 .cbs = {
713 .get_elem = lib_interface_vrrp_vrrp_group_v4_counter_tx_advertisement_get_elem,
714 }
715 },
716 {
717 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v4/counter/tx/gratuitous-arp",
718 .cbs = {
719 .get_elem = lib_interface_vrrp_vrrp_group_v4_counter_tx_gratuitous_arp_get_elem,
720 }
721 },
722 {
723 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v4/counter/rx/advertisement",
724 .cbs = {
725 .get_elem = lib_interface_vrrp_vrrp_group_v4_counter_rx_advertisement_get_elem,
726 }
727 },
728 {
729 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v6/virtual-address",
730 .cbs = {
731 .create = lib_interface_vrrp_vrrp_group_v6_virtual_address_create,
732 .destroy = lib_interface_vrrp_vrrp_group_v6_virtual_address_destroy,
733 .cli_show = cli_show_ipv6,
734 }
735 },
736 {
737 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v6/current-priority",
738 .cbs = {
739 .get_elem = lib_interface_vrrp_vrrp_group_v6_current_priority_get_elem,
740 }
741 },
742 {
743 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v6/vrrp-interface",
744 .cbs = {
745 .get_elem = lib_interface_vrrp_vrrp_group_v6_vrrp_interface_get_elem,
746 }
747 },
748 {
749 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v6/source-address",
750 .cbs = {
751 .get_elem = lib_interface_vrrp_vrrp_group_v6_source_address_get_elem,
752 }
753 },
754 {
755 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v6/state",
756 .cbs = {
757 .get_elem = lib_interface_vrrp_vrrp_group_v6_state_get_elem,
758 }
759 },
760 {
761 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v6/master-advertisement-interval",
762 .cbs = {
763 .get_elem = lib_interface_vrrp_vrrp_group_v6_master_advertisement_interval_get_elem,
764 }
765 },
766 {
767 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v6/skew-time",
768 .cbs = {
769 .get_elem = lib_interface_vrrp_vrrp_group_v6_skew_time_get_elem,
770 }
771 },
772 {
773 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v6/counter/state-transition",
774 .cbs = {
775 .get_elem = lib_interface_vrrp_vrrp_group_v6_counter_state_transition_get_elem,
776 }
777 },
778 {
779 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v6/counter/tx/advertisement",
780 .cbs = {
781 .get_elem = lib_interface_vrrp_vrrp_group_v6_counter_tx_advertisement_get_elem,
782 }
783 },
784 {
785 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v6/counter/tx/neighbor-advertisement",
786 .cbs = {
787 .get_elem = lib_interface_vrrp_vrrp_group_v6_counter_tx_neighbor_advertisement_get_elem,
788 }
789 },
790 {
791 .xpath = "/frr-interface:lib/interface/frr-vrrpd:vrrp/vrrp-group/v6/counter/rx/advertisement",
792 .cbs = {
793 .get_elem = lib_interface_vrrp_vrrp_group_v6_counter_rx_advertisement_get_elem,
794 }
795 },
796 {
797 .xpath = NULL,
798 },
799 }
800};