[YANGTOOLS-843] The schema path should be unique to every schema node inside the module. Created: 09/Jan/18 Updated: 08/Jan/20 Resolved: 08/Jan/20 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | parser |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Medium |
| Reporter: | Jie Han | Assignee: | Jie Han |
| Resolution: | Won't Do | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
The schema path represents unique path to every node inside module. |
| Comments |
| Comment by Jie Han [ 09/Jan/18 ] |
|
https://git.opendaylight.org/gerrit/66848 |
| Comment by Robert Varga [ 09/Jan/18 ] |
|
I think this needs a way better description and justification. What is the precise problem we are trying to solve here? |
| Comment by Robert Varga [ 09/Jan/18 ] |
|
Note that usual run-time users do not concern themselves with groupings (which really are a leak from declared model and should end up being eliminated from the effective model). |
| Comment by Jie Han [ 09/Jan/18 ] |
|
The problem was actually met in class ModuleContext at first, for there're many
See the blocked issue " container test { The generated class Test for container test in grouing test2 (added by uses) would implement the class Test generated by container test in grouping test, but when we try to use an orginal schema path of the uses node to get the original node, it would find the wrong one - the inner container test in container test at the top level. Indeed that usual users don't care about the groupings but data schema nodes. |
| Comment by Jie Han [ 10/Jan/18 ] |
|
Another way to reslove this is to eliminate groupings from effective models, by then the generator would generate classes from uses nodes alone without implementations , and also it would clean everything about groupings. |
| Comment by Jie Han [ 10/Jan/18 ] |
|
As described in RFC7950 section 5.4:
it seems necessary to keep groupings. } |
| Comment by Robert Varga [ 10/Jan/18 ] |
|
Well, from the overall direction at some point we should be ditching SchemaNodes in their current shape and form and we cannot really change the semantic meaning of SchemaPath – no matter how flawed it currently is, as it is used all over the place in contexts which actually work okay, as they simply do not deal with groupings and their instantiations.
Use of SchemaPath in those maps is flawed and was supposed to be fixed (note how these things are essentially copy&pasted from binding v1) – I would suggest binding v2 defining a SchemaNodeIdentifier for non-conflicting identification and construct the tracking maps using that. If/when that approach is qualified as sound we can promote that concept to be the replacement for SchemaPath. |
| Comment by Jie Han [ 11/Jan/18 ] |
|
Defining a SchemaNodeIdentifier in binding v2 would still not work, for the original schema path from uses node which was constructed by yangtools |
| Comment by Robert Varga [ 01/Feb/18 ] |
|
Right. Another question: would it be feasible to use IdentityHashMaps keyed by actual SchemaNodes? A cursory glance shows that that's how they are effective accessed... |
| Comment by Jie Han [ 12/Feb/18 ] |
|
In that way, APIs in yang-model-api such as UsesNode which provides getGroupingPath or AugmentationSchemaNode provides getTargetPath and so on, all these sort of nodes should also provide like 'getGroupingNode' or getTargetNode', in one word, 'getXXXNode' should appear any where getXXXPath appears. |
| Comment by Robert Varga [ 03/Aug/18 ] |
|
Well, SchemaNodes are on their way out, so I do not believe we want to retrofit SchemaPath (or anything else) to fit their twisted model. EffectiveStatement is the replacement, where any statement can be addressed using a combination of:
I do not believe we need addressing beyond the first two items of that list. Hence I am inclined to turn this issue into a 'Define StatementPath to address effective statements'. Binding concerns, such as finding in what grouping a particular definition comes from should really be computed/cached in MD-SAL, not SchemaContext (and its equivalents). |
| Comment by Robert Varga [ 08/Jan/20 ] |
|
This issue centers around SchemaPath, but we have an alternative in This effectively means that instead of having a SchemaNode->Path and SchemaContext->Path->SchemaNode lookup we would maintain the identifier externally, if that is even useful. |