diff options
author | Christian Hopps <chopps@gmail.com> | 2021-05-04 16:41:58 +0200 |
---|---|---|
committer | Christian Hopps <chopps@labn.net> | 2021-05-13 22:24:48 +0200 |
commit | 3bb513c399c2e7c8dd597b7399dd7c0f064842d0 (patch) | |
tree | 14f3e677c49fce272946788f8a8b8f3f8a3e26b5 /staticd | |
parent | Merge pull request #8629 from donaldsharp/parse_rtattr (diff) | |
download | frr-3bb513c399c2e7c8dd597b7399dd7c0f064842d0.tar.xz frr-3bb513c399c2e7c8dd597b7399dd7c0f064842d0.zip |
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 <chopps@labn.net>
Diffstat (limited to 'staticd')
-rw-r--r-- | staticd/static_nb.c | 2 | ||||
-rw-r--r-- | staticd/static_nb.h | 4 | ||||
-rw-r--r-- | staticd/static_nb_config.c | 37 |
3 files changed, 2 insertions, 41 deletions
diff --git a/staticd/static_nb.c b/staticd/static_nb.c index aa9076aa8..c1a6253a1 100644 --- a/staticd/static_nb.c +++ b/staticd/static_nb.c @@ -61,7 +61,6 @@ const struct frr_yang_module_info frr_staticd_info = { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/path-list/frr-nexthops/nexthop/bh-type", .cbs = { .modify = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_bh_type_modify, - .destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_bh_type_destroy, } }, { @@ -139,7 +138,6 @@ const struct frr_yang_module_info frr_staticd_info = { .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-nexthops/nexthop/bh-type", .cbs = { .modify = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_bh_type_modify, - .destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_bh_type_destroy, } }, { diff --git a/staticd/static_nb.h b/staticd/static_nb.h index e85e1d0e9..96dd05c0c 100644 --- a/staticd/static_nb.h +++ b/staticd/static_nb.h @@ -37,8 +37,6 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_pa struct nb_cb_destroy_args *args); int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_bh_type_modify( struct nb_cb_modify_args *args); -int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_bh_type_destroy( - struct nb_cb_destroy_args *args); int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_onlink_modify( struct nb_cb_modify_args *args); int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_color_modify( @@ -77,8 +75,6 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_sr struct nb_cb_destroy_args *args); int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_bh_type_modify( struct nb_cb_modify_args *args); -int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_bh_type_destroy( - struct nb_cb_destroy_args *args); int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_onlink_modify( struct nb_cb_modify_args *args); int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_color_modify( diff --git a/staticd/static_nb_config.c b/staticd/static_nb_config.c index e78f5172a..cd151bfac 100644 --- a/staticd/static_nb_config.c +++ b/staticd/static_nb_config.c @@ -297,7 +297,7 @@ static int static_nexthop_mpls_label_modify(struct nb_cb_modify_args *args) uint8_t index; nh = nb_running_get_entry(args->dnode, NULL, true); - pos = yang_get_list_pos(args->dnode->parent); + pos = yang_get_list_pos(lyd_parent(args->dnode)); if (!pos) { flog_warn(EC_LIB_NB_CB_CONFIG_APPLY, "libyang returns invalid label position"); @@ -457,7 +457,7 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_pa uint32_t count; mls_dnode = yang_dnode_get(args->dnode, "./mpls-label-stack"); - count = yang_get_list_elements_count(yang_dnode_get_child(mls_dnode)); + count = yang_get_list_elements_count(lyd_child(mls_dnode)); if (count > MPLS_MAX_LABELS) { snprintf(args->errmsg, args->errmsg_len, @@ -689,22 +689,6 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_pa return static_nexthop_bh_type_modify(args); } -int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_bh_type_destroy( - struct nb_cb_destroy_args *args) -{ - /* blackhole type has a boolean type with default value, - * so no need to do any operations in destroy callback - */ - switch (args->event) { - case NB_EV_VALIDATE: - case NB_EV_PREPARE: - case NB_EV_ABORT: - case NB_EV_APPLY: - break; - } - return NB_OK; -} - /* * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/path-list/frr-nexthops/nexthop/onlink @@ -1069,23 +1053,6 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_sr return static_nexthop_bh_type_modify(args); } -int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_bh_type_destroy( - struct nb_cb_destroy_args *args) -{ - /* blackhole type has a boolean type with default value, - * so no need to do any operations in destroy callback - */ - switch (args->event) { - case NB_EV_VALIDATE: - case NB_EV_PREPARE: - case NB_EV_ABORT: - case NB_EV_APPLY: - break; - } - - return NB_OK; -} - /* * XPath: * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-nexthops/nexthop/onlink |