pyang
pyang copied to clipboard
Translating an augmented module into tree when one of the modules augments multiple modules
@mbj4668
Ubuntu focal/Debian bullseye pyang: 2.2.1 (pip3) python3: 3.8.2-3 (apt) yang repository: https://github.com/YangModels/yang.git
For instance, translating augmented module standard/ietf/RFC/[email protected]
alongside its augmenting modules standard/ietf/RFC/[email protected]
and standard/ietf/RFC/[email protected]
incorporates thye last part of the tree translation of the latter at the end of the composite tree translation, which is not a correct outcome:
pyang --format tree --path standard/ietf --output trees/standard/ietf/RFC/[email protected] standard/ietf/RFC/[email protected] standard/ietf/RFC/[email protected] standard/ietf/RFC/[email protected]
results in [email protected]
:
module: ietf-routing
+--rw routing
...
o--ro routing-state
...
o--ro v4ur:destination-prefix? inet:ipv4-prefix
o--ro v6ur:destination-prefix? inet:ipv6-prefix
module: ietf-ipv6-unicast-routing
augment /if:interfaces/if:interface/ip:ipv6:
+--rw ipv6-router-advertisements
...
Hi Jean @jean-christophe-manciot , I tried your case, but I don't see any incorrect outcome. Would you mind pointing it out more clear?
Hi Fred @fredgan
I tried your case, but I don't see any incorrect outcome. Would you mind pointing it out more clear?
At the end of the augmented translated tree in trees/standard/ietf/RFC/[email protected]
, there are some lines beginning with:
module: ietf-ipv6-unicast-routing
augment /if:interfaces/if:interface/ip:ipv6:
+--rw ipv6-router-advertisements
...
Those lines should not be here: they are extracted from the tree translation of the ietf-ipv6-unicast-routing
module which you can obtain with:
pyang --format tree --path standard/ietf --output trees/standard/ietf/RFC/[email protected] standard/ietf/RFC/[email protected]
Those lines appear starting at line 49.
As you can see, they augment another module (preifx if meaning ietf-interfaces module)..
Those lines are correctly inserted into [email protected]
, which can be obtained with:
pyang --format tree --path standard/ietf --output trees/standard/ietf/RFC/[email protected] standard/ietf/RFC/[email protected] standard/ietf/RFC/[email protected]
The lines appear at lines 69 and below.
They all start with the prefix of the augmenting module, v6ur
.
That's their real purpose.
N.B: To be exact, the last pyang
command is incomplete, as they are many other modules augmenting ietf-interfaces
, but it is enough for the sake of this discussion.