Skip to content

Commit

Permalink
Merge pull request #18108 from opensourcerouting/fix/zebra_no_vni_val…
Browse files Browse the repository at this point in the history
…idation

zebra: Do not flush an existing vni configuration trying to remove wrong vni
  • Loading branch information
donaldsharp authored Feb 19, 2025
2 parents 23fc4ce + 44fe398 commit 66434fc
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions zebra/zebra_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -2355,12 +2355,32 @@ DEFPY_YANG (vni_mapping,
"VNI-ID\n"
"prefix-routes-only\n")
{
if (!no)
const struct lyd_node *dnode;
const char *vrf;

if (!no) {
nb_cli_enqueue_change(vty, "./frr-zebra:zebra/l3vni-id", NB_OP_MODIFY,
vni_str);
else
nb_cli_enqueue_change(vty, "./frr-zebra:zebra/l3vni-id", NB_OP_DESTROY,
NULL);
} else {
if (vty->node == CONFIG_NODE) {
if (yang_dnode_existsf(vty->candidate_config->dnode,
"/frr-vrf:lib/vrf[name='%s']/frr-zebra:zebra[l3vni-id='%lu']",
VRF_DEFAULT_NAME, vni))
nb_cli_enqueue_change(vty, "./frr-zebra:zebra/l3vni-id",
NB_OP_DESTROY, NULL);
} else {
dnode = yang_dnode_get(vty->candidate_config->dnode, VTY_CURR_XPATH);
if (dnode) {
vrf = yang_dnode_get_string(dnode, "name");

if (yang_dnode_existsf(vty->candidate_config->dnode,
"/frr-vrf:lib/vrf[name='%s']/frr-zebra:zebra[l3vni-id='%lu']",
vrf, vni))
nb_cli_enqueue_change(vty, "./frr-zebra:zebra/l3vni-id",
NB_OP_DESTROY, NULL);
}
}
}

if (filter)
nb_cli_enqueue_change(vty, "./frr-zebra:zebra/prefix-only",
Expand Down

0 comments on commit 66434fc

Please sign in to comment.