Skip to content

Commit

Permalink
lib: print all errors when validating a config
Browse files Browse the repository at this point in the history
Signed-off-by: Igor Ryzhov <[email protected]>
  • Loading branch information
idryzhov committed Nov 15, 2023
1 parent 81cb39a commit e01f62c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/northbound.c
Original file line number Diff line number Diff line change
Expand Up @@ -871,9 +871,14 @@ int nb_candidate_update(struct nb_config *candidate)
int nb_candidate_validate_yang(struct nb_config *candidate, bool no_state,
char *errmsg, size_t errmsg_len)
{
if (lyd_validate_all(&candidate->dnode, ly_native_ctx,
no_state ? LYD_VALIDATE_NO_STATE
: LYD_VALIDATE_PRESENT,
uint32_t options = LYD_VALIDATE_MULTI_ERROR;

if (no_state)
options |= LYD_VALIDATE_NO_STATE;
else
options |= LYD_VALIDATE_PRESENT;

if (lyd_validate_all(&candidate->dnode, ly_native_ctx, options,
NULL) != 0) {
yang_print_errors(ly_native_ctx, errmsg, errmsg_len);
return NB_ERR_VALIDATION;
Expand Down

0 comments on commit e01f62c

Please sign in to comment.