summaryrefslogtreecommitdiff
path: root/eigrpd
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2024-01-23 02:09:25 +0200
committerIgor Ryzhov <iryzhov@nfware.com>2024-01-23 12:33:39 +0200
commita594cda8cec0a67d59ee28d5fb59e958611370c9 (patch)
treec3860517b2672f8785569bf8a10a85ca3a117739 /eigrpd
parent22d1ad786f6961bf4f685599b5fb16a84b802346 (diff)
lib: remove leaf-list xpath hack from northbound
Currently, when editing a leaf-list, `nb_candidate_edit` expects to receive it's xpath without a predicate and the value in a separate argument, and then creates the full xpath. This hack is complicated, because it depends on the operation and on the caller being a backend or not. Instead, let's require to always include the predicate in a leaf-list xpath. Update all the usages in the code accordingly. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'eigrpd')
-rw-r--r--eigrpd/eigrp_cli.c40
1 files changed, 24 insertions, 16 deletions
diff --git a/eigrpd/eigrp_cli.c b/eigrpd/eigrp_cli.c
index b961cde871..6bc024fe0d 100644
--- a/eigrpd/eigrp_cli.c
+++ b/eigrpd/eigrp_cli.c
@@ -131,12 +131,14 @@ DEFPY_YANG(
"Suppress routing updates on an interface\n"
"Interface to suppress on\n")
{
+ char xpath[XPATH_MAXLEN];
+
+ snprintf(xpath, sizeof(xpath), "./passive-interface[.='%s']", ifname);
+
if (no)
- nb_cli_enqueue_change(vty, "./passive-interface",
- NB_OP_DESTROY, ifname);
+ nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
else
- nb_cli_enqueue_change(vty, "./passive-interface",
- NB_OP_CREATE, ifname);
+ nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
return nb_cli_apply_changes(vty, NULL);
}
@@ -354,12 +356,14 @@ DEFPY_YANG(
"Enable routing on an IP network\n"
"EIGRP network prefix\n")
{
+ char xpath[XPATH_MAXLEN];
+
+ snprintf(xpath, sizeof(xpath), "./network[.='%s']", prefix_str);
+
if (no)
- nb_cli_enqueue_change(vty, "./network", NB_OP_DESTROY,
- prefix_str);
+ nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
else
- nb_cli_enqueue_change(vty, "./network", NB_OP_CREATE,
- prefix_str);
+ nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
return nb_cli_apply_changes(vty, NULL);
}
@@ -383,12 +387,14 @@ DEFPY_YANG(
"Specify a neighbor router\n"
"Neighbor address\n")
{
+ char xpath[XPATH_MAXLEN];
+
+ snprintf(xpath, sizeof(xpath), "./neighbor[.='%s']", addr_str);
+
if (no)
- nb_cli_enqueue_change(vty, "./neighbor", NB_OP_DESTROY,
- addr_str);
+ nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
else
- nb_cli_enqueue_change(vty, "./neighbor", NB_OP_CREATE,
- addr_str);
+ nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
return nb_cli_apply_changes(vty, NULL);
}
@@ -658,8 +664,9 @@ DEFPY_YANG(
as_str);
nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
- snprintf(xpath_auth, sizeof(xpath_auth), "%s/summarize-addresses", xpath);
- nb_cli_enqueue_change(vty, xpath_auth, NB_OP_CREATE, prefix_str);
+ snprintf(xpath_auth, sizeof(xpath_auth),
+ "%s/summarize-addresses[.='%s']", xpath, prefix_str);
+ nb_cli_enqueue_change(vty, xpath_auth, NB_OP_CREATE, NULL);
return nb_cli_apply_changes(vty, NULL);
}
@@ -681,8 +688,9 @@ DEFPY_YANG(
as_str);
nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
- snprintf(xpath_auth, sizeof(xpath_auth), "%s/summarize-addresses", xpath);
- nb_cli_enqueue_change(vty, xpath_auth, NB_OP_DESTROY, prefix_str);
+ snprintf(xpath_auth, sizeof(xpath_auth),
+ "%s/summarize-addresses[.='%s']", xpath, prefix_str);
+ nb_cli_enqueue_change(vty, xpath_auth, NB_OP_DESTROY, NULL);
return nb_cli_apply_changes(vty, NULL);
}