Git Product home page Git Product logo

Comments (5)

dhubler avatar dhubler commented on July 28, 2024

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.

davidmat50 avatar davidmat50 commented on July 28, 2024

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.

dhubler avatar dhubler commented on July 28, 2024

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.

dhubler avatar dhubler commented on July 28, 2024

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/

https://stackoverflow.com/questions/64464507/how-to-augment-list-from-one-module-to-another-and-add-leafs-yang

from yang.

davidmat50 avatar davidmat50 commented on July 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.