From 3bb513c399c2e7c8dd597b7399dd7c0f064842d0 Mon Sep 17 00:00:00 2001 From: Christian Hopps Date: Tue, 4 May 2021 10:41:58 -0400 Subject: lib: adapt to version 2 of libyang Compile with v2.0.0 tag of `libyang2` branch of: https://github.com/CESNET/libyang staticd init load time of 10k routes now 6s vs ly1 time of 150s Signed-off-by: Christian Hopps --- ripd/rip_cli.c | 12 ++++++------ ripd/rip_interface.c | 2 +- ripd/ripd.c | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'ripd') diff --git a/ripd/rip_cli.c b/ripd/rip_cli.c index 43e5b21fa..0c5730b4d 100644 --- a/ripd/rip_cli.c +++ b/ripd/rip_cli.c @@ -903,9 +903,9 @@ DEFPY_YANG (ip_rip_authentication_string, return CMD_WARNING_CONFIG_FAILED; } - if (yang_dnode_exists(vty->candidate_config->dnode, "%s%s", - VTY_CURR_XPATH, - "/frr-ripd:rip/authentication-key-chain")) { + if (yang_dnode_existsf(vty->candidate_config->dnode, "%s%s", + VTY_CURR_XPATH, + "/frr-ripd:rip/authentication-key-chain")) { vty_out(vty, "%% key-chain configuration exists\n"); return CMD_WARNING_CONFIG_FAILED; } @@ -952,9 +952,9 @@ DEFPY_YANG (ip_rip_authentication_key_chain, "Authentication key-chain\n" "name of key-chain\n") { - if (yang_dnode_exists(vty->candidate_config->dnode, "%s%s", - VTY_CURR_XPATH, - "/frr-ripd:rip/authentication-password")) { + if (yang_dnode_existsf(vty->candidate_config->dnode, "%s%s", + VTY_CURR_XPATH, + "/frr-ripd:rip/authentication-password")) { vty_out(vty, "%% authentication string configuration exists\n"); return CMD_WARNING_CONFIG_FAILED; } diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index 1ef64ff0d..0b927c76f 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -1113,7 +1113,7 @@ static int rip_interface_config_write(struct vty *vty) FOR_ALL_INTERFACES (vrf, ifp) { struct lyd_node *dnode; - dnode = yang_dnode_get( + dnode = yang_dnode_getf( running_config->dnode, "/frr-interface:lib/interface[name='%s'][vrf='%s']", ifp->name, vrf->name); diff --git a/ripd/ripd.c b/ripd/ripd.c index 9832c7c52..c6c82fb65 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -3632,16 +3632,16 @@ static int rip_vrf_enable(struct vrf *vrf) char oldpath[XPATH_MAXLEN]; char newpath[XPATH_MAXLEN]; - rip_dnode = yang_dnode_get( + rip_dnode = yang_dnode_getf( running_config->dnode, "/frr-ripd:ripd/instance[vrf='%s']/vrf", old_vrf_name); if (rip_dnode) { - yang_dnode_get_path(rip_dnode->parent, oldpath, - sizeof(oldpath)); + yang_dnode_get_path(lyd_parent(rip_dnode), + oldpath, sizeof(oldpath)); yang_dnode_change_leaf(rip_dnode, vrf->name); - yang_dnode_get_path(rip_dnode->parent, newpath, - sizeof(newpath)); + yang_dnode_get_path(lyd_parent(rip_dnode), + newpath, sizeof(newpath)); nb_running_move_tree(oldpath, newpath); running_config->version++; } -- cgit v1.2.3