]> git.proxmox.com Git - mirror_frr.git/commit
lib: make nb_candidate_edit() more flexible
authorRenato Westphal <renato@opensourcerouting.org>
Mon, 15 Apr 2019 22:04:30 +0000 (19:04 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Thu, 18 Apr 2019 16:15:13 +0000 (13:15 -0300)
commitec3ee0ebb8d3d51a07899356a876b268b3d72eb7
tree8462da819aaca6c4d240d2fc044dcf04af091938
parentc650e48c54c2f524a473781f019b059daf2fd8d0
lib: make nb_candidate_edit() more flexible

Certain operations, like removing non-presence containers or
modifying list keys, are not considered to be valid from the
perspective of the northbound layer. This is because we want to
implement a minimum set of northbound configuration callbacks and
use them to process all possible configuration changes.

The removal of a np-container [1], for example, can be processed by
calling the "delete" callback of all of its child nodes (recursion
is used for np-container child nodes). Similarly, the modification
of a list key can be processed as if the corresponding list entry
was removed and readded with updated key values. This strategy saves
us the burden of implementing lots of extra configuration callbacks.

That said, the nb_operation_is_valid() function shouldn't be used
for anything other than checking which callbacks are valid for
which YANG nodes. Using it in the nb_candidate_edit() function
is inappropriate as we want as much flexibility as possible when
editing a candidate configuration. We should allow CLI commands,
for example, to remove np-containers (the northbound layer will then
figure out which callbacks need to be called when this candidate
is committed). Remove the check.

[1] We can't do the same for presence containers since they have a
"create" callback associated with them.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
lib/northbound.c