Skip to content

fix(netconf-proto): drop augmented-by from built yang library - #140

Open
rodonile wants to merge 1 commit into
network-analytics:mainfrom
rodonile:augmentedby-strip
Open

rodonile wants to merge 1 commit into
network-analytics:mainfrom
rodonile:augmentedby-strip

Conversation

@rodonile

@rodonile rodonile commented Dec 1, 2026

Copy link
Copy Markdown
Member

Strip augmented-by and the ietf-yang-library-augmentedby module from the YANG library that load_from_modules builds. They are anyway only needed to discover augmenting modules on the device.

Reason

Since libyang 6.4.13 (CESNET/libyang 9fbed2d83), ietf-yang-library-augmentedby@2025-05-28 is built in and implemented in every context. Devices listing another revision (e.g. @2026-08-26) make Context::new_from_yang_library_file fail.

augmented-by only lists which modules augment a module, it's only metadata. libyang anyway applies augments because the augmenting modules are implemented in the module-set, not because of this leaf-list. So it is only needed while walking the device's YANG library, and can be dropped from the library used for validation and caching. yang-consumer already builds its library without augmented-by.

Raised upstream as well (option 1: let the listed revision take precedence); this change keeps us independent of the outcome.

Notes

  • keep in mind subscriptions-cache should be cleared
  • known limitation: YANG-Push subscriptions targeting /yang-library would still create conflicts: revisit if we ever need to subscribe to those

Comment thread crates/netconf-proto/src/yanglib.rs Resolved
@rodonile
rodonile enabled auto-merge (rebase) December 3, 2026 16:23
libyang >= 6.4.13 implements ietf-yang-library-augmentedby as a built-in
module. When a device lists a different revision of it in its
yang-library (e.g. 2026-08-26), libyang refuses to load the library,
and removing the module instead breaks the augmented-by leafrefs.

augmented-by is only needed to discover augmenting modules while
walking the device's yang library; libyang applies augments from the
implemented modules, not from this leaf-list. Keep using it for
discovery but strip it from the library we build, and stop pulling in
ietf-yang-library-augmentedby itself. The resulting library loads
regardless of the libyang built-in revision and matches what
yang-consumer already builds.
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

Successfully merging this pull request may close these issues.

2 participants