mbj4668 / pyang

An extensible YANG validator and converter in python
ISC License
535 stars 344 forks source link

YANG 1.1: Groupings from sibling submodules not visible without explicit include even though they should #737

Closed sbyx closed 3 years ago

sbyx commented 3 years ago

I have a YANG 1.1 module with a number of submodules (all declared yang-version 1.1). The module includes all submodules however the submodules themselves do not include each other (as is not necessary in YANG 1.1, see below). Now when one submodule tries to reference e.g. a grouping from another this fails with error: grouping "Category" not found in module "...". I believe according to the RFC this should just work:

 A module uses the "include" statement to list all its submodules.  A
 module, or submodule belonging to that module, can reference
 definitions in the module and all submodules included by the module.

[...]

 For backward compatibility with YANG version 1, a submodule MAY use
 the "include" statement to reference other submodules within its
 module, but this is not necessary in YANG version 1.1.  A submodule
 can reference any definition in the module it belongs to and in all
 submodules included by the module.  A submodule MUST NOT include
 different revisions of other submodules than the revisions that its
 module includes.

Note: Error does go away when I manually add the backward-compatibility include-statements into the submodules where pyang complains. However this is more a work-around than a viable solution.

mbj4668 commented 3 years ago

Yes this is a known issue. The workaround is to add the "include" statements.

mbj4668 commented 3 years ago

See also #323.

sbyx commented 3 years ago

Thanks for the clarification. I will close this in favor of #323 then.