summaryrefslogtreecommitdiff
path: root/zebra/interface.c
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 /zebra/interface.c
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 'zebra/interface.c')
-rw-r--r--zebra/interface.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/zebra/interface.c b/zebra/interface.c
index 4c6fc8c36a..9f160020a8 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -4701,12 +4701,16 @@ DEFUN (no_link_params_use_bw,
}
static int ag_change(struct vty *vty, int argc, struct cmd_token **argv,
- const char *xpath, bool no, int start_idx)
+ const char *xpath_base, bool no, int start_idx)
{
- for (int i = start_idx; i < argc; i++)
+ char xpath[XPATH_MAXLEN];
+
+ for (int i = start_idx; i < argc; i++) {
+ snprintf(xpath, XPATH_MAXLEN, "%s[.='%s']", xpath_base,
+ argv[i]->arg);
nb_cli_enqueue_change(vty, xpath,
- no ? NB_OP_DESTROY : NB_OP_CREATE,
- argv[i]->arg);
+ no ? NB_OP_DESTROY : NB_OP_CREATE, NULL);
+ }
return nb_cli_apply_changes(vty, NULL);
}