Comments (5)
Good news, this "fix" was intentional so I can easily revert it. Bad news is I may still not have an understanding of augment. In this example you are augmenting a definition you never "use". To that point, I don't understand the point of augmenting anything from imported modules that are not groupings because groupings are the only way to add imported definitions into a module AFAIU.
from yang.
Not really. Grouping are NOT the only way add imported definitions into module.
Augment is used to add an existing model (probabaly a standard model) , into our yang module and also additionally add some extra nodes along with it. The target node of augment cannot be endings nodes like leaf, leaf-list etc. The target node of augment can accomodate more data nodes internally ( eg like container, list, choice etc) . Then, we can add additional nodes as substatements of augment statement.
If a when condition is present as substament of augment, it is applcicable to the additional nodes under augment . It indicates that the new/additional nodes are valid to be added in the yang instance only if the condition is satisfied
Refernce: https://www.rfc-editor.org/rfc/rfc7950.html#section-4.2.8 ,
Grouping is a resuable set/collection of data nodes which can be instantiated using 'uses' .
We can use "uses" under augment if we need to add all the nodes in grouping along with the augment,
But it is not necessary to use "uses" under augment always.
In the example i have given above, the leaf "ds0ChannelNumber" is an additional node under the ifEntry list , and it can present in the yang data instance only if the condition "common:ifIndex = 1"; is satisfied.
The same exmaple is seen in https://www.rfc-editor.org/rfc/rfc7950.html#section-7.17.3
The previous behaviour of implemnation prior to #55 was observred as i explained above. The issue i obsrved there was that i was not able to use "uses" under augment.
Hope this will help.
from yang.
What I find confusing in RFC Section 4.2.8:
" The "augment" statement defines the location in the data model
hierarchy where new nodes are inserted....
It does not mention inserting the nodes AND include a copy of the target where the augment statement is declared. I'm happy to be wrong about this.
from yang.
here are some links that seem to support my understanding, but I admit do not explicitly discount your understanding:
https://1.ieee802.org/yangsters/yang-examples/yang-augment-example/
from yang.
yeah. I see.
I was also having a wrong understanding.
It seems augmenting of additional nodes should happen into the target location's data tree , and target nodes's data tree not needed to be copied to the place where augment statement is declared. OK got it.
from yang.
Related Issues (20)
- Yang loader gets blocked for for an invalid yang file. HOT 1
- Panic in freeconf/yang library when import is missing HOT 1
- No support for mutiple bases for identityref type. HOT 1
- Derived bases of identities are not as expected when muti-level imports are done HOT 4
- [Question] Is Default() method syntax changed intentionally? Is this correct if leaf has value other than string. HOT 3
- Panic in freeconf/yang library if two leaf nodes has the same name. HOT 1
- Panic when 'config:true' is added in yang HOT 3
- Config substatment is not supported under choice statement HOT 1
- Augmenting is failing if target node is any substatment under a choice HOT 7
- Failing to augment if taget node is choice and data to be augmented also is choice HOT 3
- No error thrown is when a duplicate node is added to container using augment. HOT 1
- No error is thrown if cases inside a choice contains child nodes with same name. HOT 2
- Leaf of type union wrongly inherits default and units from typedef HOT 3
- Fraction-digits is not inherited through typedef HOT 2
- Panic when 'config:true' is added inside a choicecase in yang HOT 2
- bit information for 'bits' datatype is not found if a typedef is used. HOT 3
- 'Config'=false setting from parent/grand-parents not getting inherited to data nodes under a choice HOT 4
- Issue with setting default value for list and leaf-list using refine HOT 4
- Setting default value through typedef for leaf-list generates panic HOT 7
- UnionLists overwrite list/leaf type of subtypes HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yang.