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

Leaf in when constraint not found in combination with augment and choice/case #650

Closed
verthezpw opened this issue Jul 1, 2020 · 5 comments
Labels

Comments

@verthezpw
Copy link

verthezpw commented Jul 1, 2020

See the following example model, which I minimized as far as possible from the case we encounter:
example.zip

pyang gives the following warning for this:
example.yang:30: warning: node "example::type" is not found in "example::inline-frame-processing"

This is occurring in 2.3.0, and also already in 2.2.1, but not in 1.7.5.

Note that it succeeds if:

  • you switch the order of the augments at the end of the file -> but this should not depend on this order
  • or if you remove the choice/case levels from the last augment (the when constraint stays the same) -> so this is related to choice/case handling
@fredgan
Copy link
Collaborator

fredgan commented Jul 2, 2020

Hi, It's a known issue since xpath parser added. XPath parser was added in 1755bf1 a bit earlier than version 2.0

@fredgan fredgan added the bug label Jul 2, 2020
@hyberdk
Copy link

hyberdk commented Oct 31, 2023

hi @fredgan / @mbj4668

do you know if this is something that are being addressed? I think this one is my show stopper for compiling the Cisco native models. Its related to #729 and #836

I know the Cisco yang models are fairly buggy, but I have been going though the problems one-by-one and I have a working set of yang models. At least according to libyang (yanglint).

But this is blocking me for compiling the models. Like the others I am getting a ton of these faults

Cisco-IOS-XE-interfaces.yang:3231: error: "Cisco-IOS-XE-interfaces:native" in the path for AppNav-Compress at Cisco-IOS-XE-bgp.yang:12237 (at Cisco-IOS-XE-interfaces.yang:3227) is not found
Cisco-IOS-XE-interfaces.yang:3231: error: "Cisco-IOS-XE-interfaces:native" in the path for AppNav-Compress at Cisco-IOS-XE-bgp.yang:12237 (at Cisco-IOS-XE-interfaces.yang:3227) is not found
Cisco-IOS-XE-interfaces.yang:3231: error: "Cisco-IOS-XE-interfaces:native" in the path for AppNav-Compress at Cisco-IOS-XE-bgp.yang:12237 (at Cisco-IOS-XE-interfaces.yang:3227) is not found
Cisco-IOS-XE-interfaces.yang:3231: error: "Cisco-IOS-XE-interfaces:native" in the path for AppNav-Compress at Cisco-IOS-XE-bgp.yang:12237 (at Cisco-IOS-XE-interfaces.yang:3227) is not found
Cisco-IOS-XE-interfaces.yang:3231: error: "Cisco-IOS-XE-interfaces:native" in the path for AppNav-Compress at Cisco-IOS-XE-bgp.yang:12237 (at Cisco-IOS-XE-interfaces.yang:3227) is not found

Im pretty sure its this problem as its augments the interfaces in the Cisco-IOS-XE-bgp.yang from the native model and its also using choices..

What can I do to help this along?

Esben

@mbj4668
Copy link
Owner

mbj4668 commented Nov 1, 2023

@hyberdk please verify this fix on the modules you have.

@hyberdk
Copy link

hyberdk commented Nov 1, 2023

Hi @mbj4668,

thank you so much for your feedback! I tested it again, but unfortunately my model is still failing with the same fault.

I have been stepping through the code and I am not too sure, but looking at this:

image

In line 2757 i searches for the "ptr" (is that pointer?), it does not find any as there are no children in the pmodule. This sets ptr = None.

In line 2762 it searches for includes again

image

but, since its searching in the "Cisco-IOS-XE-interfaces" submodule, there are no "includes" there.. I think the problem is that the reference to /native/interface/* are in the upstream native module, but it does not search that one only the sub-module..

From what I can tell, we need to instruct pyang that if the current module is a "sub-module" it needs to include the "belongs-to" module in the search and not only the submodule and its includes..

does that make sense?

I will try and clean up the models a bit and push it to my github so you can test with the same files.. I have tried to make a test-case but I have not been able to do so yet.. ;-(

but again, many many thanks for reaching out.. I have been stuck on this for months now..

Esben

@mbj4668
Copy link
Owner

mbj4668 commented Nov 1, 2023

See my comment in #729 as well. The XE models are "broken" in the sense that they don't follow the scoping rules for YANG 1.

I just pushed another fix to the branch mbj/submodules-xpath. You can test that one with the modules you have - but note that your modules and submodules must have yang-version 1.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants