diff options
| author | Igor Ryzhov <iryzhov@nfware.com> | 2024-01-23 02:09:25 +0200 |
|---|---|---|
| committer | Igor Ryzhov <iryzhov@nfware.com> | 2024-01-23 12:33:39 +0200 |
| commit | a594cda8cec0a67d59ee28d5fb59e958611370c9 (patch) | |
| tree | c3860517b2672f8785569bf8a10a85ca3a117739 /vrrpd | |
| parent | 22d1ad786f6961bf4f685599b5fb16a84b802346 (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 'vrrpd')
| -rw-r--r-- | vrrpd/vrrp_vty.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/vrrpd/vrrp_vty.c b/vrrpd/vrrp_vty.c index bbdf48b326..fd6cbc8b67 100644 --- a/vrrpd/vrrp_vty.c +++ b/vrrpd/vrrp_vty.c @@ -200,7 +200,11 @@ DEFPY_YANG(vrrp_ip, VRRP_IP_STR) { int op = no ? NB_OP_DESTROY : NB_OP_CREATE; - nb_cli_enqueue_change(vty, "./v4/virtual-address", op, ip_str); + char xpath[XPATH_MAXLEN]; + + snprintf(xpath, sizeof(xpath), "./v4/virtual-address[.='%s']", ip_str); + + nb_cli_enqueue_change(vty, xpath, op, NULL); return nb_cli_apply_changes(vty, VRRP_XPATH_ENTRY, vrid); } @@ -228,7 +232,11 @@ DEFPY_YANG(vrrp_ip6, VRRP_IP_STR) { int op = no ? NB_OP_DESTROY : NB_OP_CREATE; - nb_cli_enqueue_change(vty, "./v6/virtual-address", op, ipv6_str); + char xpath[XPATH_MAXLEN]; + + snprintf(xpath, sizeof(xpath), "./v6/virtual-address[.='%s']", ipv6_str); + + nb_cli_enqueue_change(vty, xpath, op, NULL); return nb_cli_apply_changes(vty, VRRP_XPATH_ENTRY, vrid); } |
