summaryrefslogtreecommitdiffstats
path: root/ripd/rip_cli.c
diff options
context:
space:
mode:
authorDonald Sharp <donaldsharp72@gmail.com>2024-01-24 16:49:52 +0100
committerGitHub <noreply@github.com>2024-01-24 16:49:52 +0100
commit16406a31d388b6fdbf3d7445f8a4f0cedce0f926 (patch)
treee695af8b514955276700ffe7fb7844cf0bf35100 /ripd/rip_cli.c
parentMerge pull request #15209 from opensourcerouting/fix/whitespaces (diff)
parentlib: remove leaf-list xpath hack from northbound (diff)
downloadfrr-16406a31d388b6fdbf3d7445f8a4f0cedce0f926.tar.xz
frr-16406a31d388b6fdbf3d7445f8a4f0cedce0f926.zip
Merge pull request #15196 from idryzhov/nb-leaf-list
lib: remove leaf-list xpath hack from northbound
Diffstat (limited to 'ripd/rip_cli.c')
-rw-r--r--ripd/rip_cli.c49
1 files changed, 35 insertions, 14 deletions
diff --git a/ripd/rip_cli.c b/ripd/rip_cli.c
index daa83dd05..fbe647c5c 100644
--- a/ripd/rip_cli.c
+++ b/ripd/rip_cli.c
@@ -273,8 +273,13 @@ DEFPY_YANG (rip_neighbor,
"Specify a neighbor router\n"
"Neighbor address\n")
{
- nb_cli_enqueue_change(vty, "./explicit-neighbor",
- no ? NB_OP_DESTROY : NB_OP_CREATE, neighbor_str);
+ char xpath[XPATH_MAXLEN];
+
+ snprintf(xpath, sizeof(xpath), "./explicit-neighbor[.='%s']",
+ neighbor_str);
+
+ nb_cli_enqueue_change(vty, xpath, no ? NB_OP_DESTROY : NB_OP_CREATE,
+ NULL);
return nb_cli_apply_changes(vty, NULL);
}
@@ -295,8 +300,12 @@ DEFPY_YANG (rip_network_prefix,
"Enable routing on an IP network\n"
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
{
- nb_cli_enqueue_change(vty, "./network",
- no ? NB_OP_DESTROY : NB_OP_CREATE, network_str);
+ char xpath[XPATH_MAXLEN];
+
+ snprintf(xpath, sizeof(xpath), "./network[.='%s']", network_str);
+
+ nb_cli_enqueue_change(vty, xpath, no ? NB_OP_DESTROY : NB_OP_CREATE,
+ NULL);
return nb_cli_apply_changes(vty, NULL);
}
@@ -317,8 +326,12 @@ DEFPY_YANG (rip_network_if,
"Enable routing on an IP network\n"
"Interface name\n")
{
- nb_cli_enqueue_change(vty, "./interface",
- no ? NB_OP_DESTROY : NB_OP_CREATE, network);
+ char xpath[XPATH_MAXLEN];
+
+ snprintf(xpath, sizeof(xpath), "./interface[.='%s']", network);
+
+ nb_cli_enqueue_change(vty, xpath, no ? NB_OP_DESTROY : NB_OP_CREATE,
+ NULL);
return nb_cli_apply_changes(vty, NULL);
}
@@ -412,17 +425,21 @@ DEFPY_YANG (rip_passive_interface,
bool passive_default =
yang_dnode_get_bool(vty->candidate_config->dnode, "%s%s",
VTY_CURR_XPATH, "/passive-default");
+ char xpath[XPATH_MAXLEN];
+ enum nb_operation op;
if (passive_default) {
- nb_cli_enqueue_change(vty, "./non-passive-interface",
- no ? NB_OP_CREATE : NB_OP_DESTROY,
- ifname);
+ snprintf(xpath, sizeof(xpath),
+ "./non-passive-interface[.='%s']", ifname);
+ op = no ? NB_OP_CREATE : NB_OP_DESTROY;
} else {
- nb_cli_enqueue_change(vty, "./passive-interface",
- no ? NB_OP_DESTROY : NB_OP_CREATE,
- ifname);
+ snprintf(xpath, sizeof(xpath), "./passive-interface[.='%s']",
+ ifname);
+ op = no ? NB_OP_DESTROY : NB_OP_CREATE;
}
+ nb_cli_enqueue_change(vty, xpath, op, NULL);
+
return nb_cli_apply_changes(vty, NULL);
}
@@ -495,8 +512,12 @@ DEFPY_YANG (rip_route,
"RIP static route configuration\n"
"IP prefix <network>/<length>\n")
{
- nb_cli_enqueue_change(vty, "./static-route",
- no ? NB_OP_DESTROY : NB_OP_CREATE, route_str);
+ char xpath[XPATH_MAXLEN];
+
+ snprintf(xpath, sizeof(xpath), "./static-route[.='%s']", route_str);
+
+ nb_cli_enqueue_change(vty, xpath, no ? NB_OP_DESTROY : NB_OP_CREATE,
+ NULL);
return nb_cli_apply_changes(vty, NULL);
}