]> git.proxmox.com Git - mirror_frr.git/commit - lib/northbound_cli.h
lib: avoid expensive operations when editing a candidate config
authorRenato Westphal <renato@opensourcerouting.org>
Sun, 6 Oct 2019 04:16:47 +0000 (01:16 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Sat, 12 Oct 2019 00:18:36 +0000 (21:18 -0300)
commit5e6a9350c16f54113eeedb497c98fe45b8ce6222
treea4931a1274531b4b1d975ff9ca23bc70670b9676
parentc7c9103b01899d316372cc0272c37df9a7e59426
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>
lib/command.c
lib/northbound.c
lib/northbound_cli.c
lib/northbound_cli.h