-
Notifications
You must be signed in to change notification settings - Fork 86
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
typedefs from a submodule not included in a module #239
Comments
The vendor's YANG is semantically valid, the Note that where and how a definition's identifier is to be found differs between YANG 1.0 and YANG 1.1: the differences in section 5.1 of RFC6020 vs RFC7950 describe exactly how this differs. And this is not only for The tl;dr is: in YANG 1.1, the ultimate parent module's definition namespace includes all top-level identifiers (including those found via a For lookup, in YANG 1.1, the identifier namespace extends up to the parent module, and down recursively to all included submodules (using the same rules within a (sub)module). In YANG 1.0, the namespace extends from the current (sub)module file, recursively down to all included submodules. In YANG 1.0, the definition scope for "local" definitions (whether referenced without a prefix or using the explicit local module prefix, as I understand it) is only those found by traversing the current file (module, submodule) and that of the The first principle approach to that is to search the current module (current statement, all children of each parent statement (either defined locally or available via a YANG 1.1 differs in that any submodule Thus, the first principle approach for (any 6.2.1) identifier lookup is the same for a module, but when performing the lookup in a submodule, if the definition's identifier is not found in the local submodule, one also needs to search the ultimate parent module for identifiers. So a correct solution will need to cover both the One approach, would be to build a namespace per module (only performing the dictionary insert on the parent module's identifier namespace dictionary for YANG 1.1 modules) of all 6.2.1 definitions once all initial modules and their submodules have been resolved and loaded into memory, after the top-level identifiers have been resolved. The "brute force" identifier |
Should entries (i.e. typedef) defined in a submodule be found from a module? It seems currently they're not. I have a yang files from a vendor, that defines typedefs in a submodule, then referes to them using a prefix for a module. And it fails to lookup the typedefs.
For example:
Then in other modules:
It fails when parsing the modules in
findExternal
method. I have modifiedfindExternal
method, adding a loop that checks the submodules of a modules for a typedef:"Found in a Submodule!"
is being printed. Is the vendor wrong defining typedefs in a submodule, the referring to them by module with prefix or is goyang incorectly handling submodules?Given:
4.1
5.1
The text was updated successfully, but these errors were encountered: