diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2019-10-06 06:16:47 +0200 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2019-10-12 02:18:36 +0200 |
commit | 5e6a9350c16f54113eeedb497c98fe45b8ce6222 (patch) | |
tree | a4931a1274531b4b1d975ff9ca23bc70670b9676 /lib/northbound_cli.h | |
parent | lib: remove expensive error handling in the northbound CLI client (diff) | |
download | frr-5e6a9350c16f54113eeedb497c98fe45b8ce6222.tar.xz frr-5e6a9350c16f54113eeedb497c98fe45b8ce6222.zip |
lib: avoid expensive operations when editing a candidate config
nb_candidate_edit() was calling both the lyd_schema_sort() and
lyd_validate() functions whenever a new node was added to the
candidate configuration. This was done to ensure the candidate
is always ready to be displayed correctly (libyang only creates
default child nodes during the validation process, and data nodes
aren't guaranteed to be ordered by default).
The problem is that the two aforementioned functions are too
expensive to be called in the northbound hot path. Instead, it makes
more sense to call them only before displaying the configuration
(in which case a recursive sort needs to be done). Introduce the
nb_cli_show_config_prepare() to achieve that purpose.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/northbound_cli.h')
-rw-r--r-- | lib/northbound_cli.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/northbound_cli.h b/lib/northbound_cli.h index 209239ca6..b2d8c8f03 100644 --- a/lib/northbound_cli.h +++ b/lib/northbound_cli.h @@ -109,6 +109,8 @@ extern void nb_cli_show_dnode_cmds(struct vty *vty, struct lyd_node *dnode, bool show_defaults); /* Prototypes of internal functions. */ +extern void nb_cli_show_config_prepare(struct nb_config *config, + bool with_defaults); extern void nb_cli_confirmed_commit_clean(struct vty *vty); extern int nb_cli_confirmed_commit_rollback(struct vty *vty); extern void nb_cli_install_default(int node); |