mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-16 02:30:52 +00:00
lib: fix a couple of yang validation issues
libyang-0.16-r3 contains a commit[1] that changed the autodelete behavior of subtrees when validating data. A few FRR commands were affected by this change since they relied on the old autodelete behavior. To fix these commands, use the LYD_OPT_WHENAUTODEL flag when validating data to restore the old autodelete behavior (which adds a lot of convenience for us). [1] https://github.com/CESNET/libyang/commit/bbc43b1b4 Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This commit is contained in:
parent
a123bd4ad6
commit
cd327983bd
@ -504,7 +504,9 @@ int nb_candidate_edit(struct nb_config *candidate,
|
|||||||
*/
|
*/
|
||||||
if (dnode) {
|
if (dnode) {
|
||||||
lyd_schema_sort(dnode, 0);
|
lyd_schema_sort(dnode, 0);
|
||||||
lyd_validate(&dnode, LYD_OPT_CONFIG, ly_native_ctx);
|
lyd_validate(&dnode,
|
||||||
|
LYD_OPT_CONFIG | LYD_OPT_WHENAUTODEL,
|
||||||
|
ly_native_ctx);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NB_OP_DESTROY:
|
case NB_OP_DESTROY:
|
||||||
@ -570,7 +572,8 @@ int nb_candidate_update(struct nb_config *candidate)
|
|||||||
*/
|
*/
|
||||||
static int nb_candidate_validate_yang(struct nb_config *candidate)
|
static int nb_candidate_validate_yang(struct nb_config *candidate)
|
||||||
{
|
{
|
||||||
if (lyd_validate(&candidate->dnode, LYD_OPT_STRICT | LYD_OPT_CONFIG,
|
if (lyd_validate(&candidate->dnode,
|
||||||
|
LYD_OPT_STRICT | LYD_OPT_CONFIG | LYD_OPT_WHENAUTODEL,
|
||||||
ly_native_ctx)
|
ly_native_ctx)
|
||||||
!= 0)
|
!= 0)
|
||||||
return NB_ERR_VALIDATION;
|
return NB_ERR_VALIDATION;
|
||||||
|
Loading…
Reference in New Issue
Block a user