[MDSAL-17] Simplify InstanceIdentifer creation Created: 28/May/14 Updated: 13/Sep/18 Resolved: 13/Sep/18 |
|
| Status: | Resolved |
| Project: | mdsal |
| Component/s: | Binding V2 codegen |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | ||
| Reporter: | Devin Avery | Assignee: | Jie Han |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: Mac OS |
||
| Issue Links: |
|
||||||||||||||||
| Description |
|
Creating instance identifiers to identify particular nodes has proved cumbersome enough that most projects which have to create an instance identifier end up using helper classes. We should look at ways to simplify the instance ID creation, possibly by providing helper or utilities. Suggestion: Start by looking at the helper classes that have been created and consider consolidating them. |
| Comments |
| Comment by Tony Tkacik [ 15/Jul/14 ] |
|
Instance IDentifier provides utilities Instance Identifier allows for fluent APIs and creating child identifiers from parent ones: |
| Comment by Tom Pantelis [ 30/Jul/14 ] |
|
I don't think Devin is referring to the InstanceIdentifier API but figuring out how to build correct a IID from a yang data model, i.e. what generated classes to use and how to stitch them together. One thing is to eliminate the need for explicitly specifying augmentation, Eg instead of: InstanceIdentifier.create(Nodes.class) possibly: InstanceIdentifier.create(Nodes.class) The API could implicitly figure out that NodeAugmentation augments Node. It would be really cool if the generated code had a static getInstanceIdentifier() method. So one could simply call NodeAugmentation.getInstanceIdentifier(NodeKey nodeKey) and let that build it for you. At the very least, we could add helper classes for the common boilerplate stuff, eg NodeInstanceIdentifier.create(NodeKey nodeKey). |
| Comment by Robert Varga [ 13/Nov/15 ] |
|
Move to MD-SAL, as it requires support from the binding spec. |
| Comment by Jie Han [ 05/Feb/18 ] |
|
https://git.opendaylight.org/gerrit/67909 |
| Comment by Robert Varga [ 28/Jun/18 ] |
|
Problem here is that we really need that Node.class, which means we need to reflect/cache NodeAugmentation.class shape, so we know to derive the type from 'implements Augmentation<Node>. That is doable. Getting getInstanceIdentifier() ... I am not sure that's possible with the current state of affairs – I am afraid all we can do is getPathArgument(NodeKey) due to groupings and nested lists, but the problem is that:
|