You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using lyd_parse_data_path(const struct ly_ctx *ctx, const char *path, LYD_FORMAT format, uint32_t parse_options, uint32_t validate_options, struct lyd_node **tree) to parse an xml file and validate that its content is conformed to the yang data tree.
But my need is also to return an error when there's a module in the xml that is not installed in sysrepo.
I'm using LYD_PARSE_STRICT but it doesn't work for this type of verification. Is there a way to verify this?
I am not sure I understand, you using LYD_VALIDATE_MULTI_ERROR with LYD_PARSE_STRICT should cause that you get an error on an unknown element but possible get more errors if found in the data.
In this case by executing the function: lyd_parse_data_path(ctx, my_xml_file, LYD_XML, parse_options=**LYD_PARSE_STRICT**, LYD_VALIDATE_MULTI_ERROR, &output);
I expect 2 errors:
1- On o-ran-fan because it has a wrong leaf (wrong-leaf-name) which doesn't exist in the yang schema.
2- On ietf-interfaces because it is not installed (=> doesn't exist in the context against which the validation is done).
But I only get the first error. Is there something I'm missing or is my understanding not correct?
Activity
michalvasko commentedon Jan 23, 2026
I am not sure I understand, you using
LYD_VALIDATE_MULTI_ERRORwithLYD_PARSE_STRICTshould cause that you get an error on an unknown element but possible get more errors if found in the data.yoousra commentedon Jan 27, 2026
Let me clarify my question with an example.
Suppose I have 3 modules in the xml I want to validate, for example:
And suppose I install o-ran-fan and o-ran-hardware modules but not ietf-interfaces module:
In this case by executing the function:
lyd_parse_data_path(ctx, my_xml_file, LYD_XML, parse_options=**LYD_PARSE_STRICT**, LYD_VALIDATE_MULTI_ERROR, &output);I expect 2 errors:
1- On o-ran-fan because it has a wrong leaf (wrong-leaf-name) which doesn't exist in the yang schema.
2- On ietf-interfaces because it is not installed (=> doesn't exist in the context against which the validation is done).
But I only get the first error. Is there something I'm missing or is my understanding not correct?
Thanks a lot for your reply.
michalvasko commentedon Jan 29, 2026
I have tested it with some examples and it worked as expected. Please provide a similar example I can reproduce (with all the required YANG modules).