Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parse_data with more detailed error #99

Open
smark28 opened this issue Feb 8, 2024 · 0 comments
Open

parse_data with more detailed error #99

smark28 opened this issue Feb 8, 2024 · 0 comments

Comments

@smark28
Copy link

smark28 commented Feb 8, 2024

Hello Team,

I am executing xml validation against yang model.
In the case of yanglint, I see a more detailed description of the error location.
How can I get the same in python?
Thanks

# yanglint openconfig-interfaces.yang logical.xml
libyang err : Invalid identityref "ethernetCsmacd" value - identity not found in module "openconfig-interfaces". (Data location "/openconfig-interfaces:interfaces/interface[name='TenGigE0/0/0/0']/state/type", line number 129.)
# python3 test.py
Traceback (most recent call last):
  File "/libyang_fix/test.py", line 11, in <module>
    dnode = ctx.parse_data_mem(string_component, 'xml', validate_present=True, validate_multi_error=True)
  File "/usr/local/lib/python3.10/site-packages/libyang/context.py", line 411, in parse_data_mem
    return self.parse_data(
  File "/usr/local/lib/python3.10/site-packages/libyang/context.py", line 390, in parse_data
    raise self.error("failed to parse data tree")
libyang.util.LibyangError: failed to parse data tree: Invalid identityref "ethernetCsmacd" value - identity not found in module "openconfig-interfaces".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant