[YANGTOOLS-1356] Introduce model.api.stmt.DataNodeIdentifier Created: 26/Oct/21 Updated: 10/Apr/22 Resolved: 31/Oct/21 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Highest |
| Reporter: | Robert Varga | Assignee: | Robert Varga |
| Resolution: | Won't Do | Votes: | 0 |
| Labels: | pt | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||
| Description |
|
We are faced again and again with the problem of interfacing various constructs which boil down to addressing YANG-modeled data. The usual solution involves YangInstanceIdentifier, but that has non-trivial mapping to YANG due to its addressing mode of operation, which takes into account keyed list entries as well as augmentations. It also accumulated weird things like:
In yang-model-api we have had a similar (but different) problem with SchemaPath, which we solved through introduction of SchemaNodeIdentifier and EffectiveStatementInference, each of which has a narrow scope of what it solves and how it operates. At the end of the day, at least where NETCONF/RESTCONF is concerned, we really need an identifier which works strictly on YANG data tree addressing, pure and simple. At the heart of it is something like: class DataTreeStep { QName nodeId; Map<QName, Object> predicates; // may be empty } class DataTreeIdentifier { List<DataTreeStep> steps; // at least one } Taking the YangInstanceIdentifier/wildcard case to heart, though, we need two dedicated specializations of that structure:
We then should provide schema-assisted utilities to covert:
This toolkit should make life a lot easier for our downstreams. |
| Comments |
| Comment by Robert Varga [ 26/Oct/21 ] |
|
So we first need DataTreeIdentifier, as it is a direct counterpart to SchemaNodeIdentifier. Both should live in yang.common. |
| Comment by Robert Varga [ 27/Oct/21 ] |
|
Since SchemaNodeIdentifier already exists, it takes precedence and will be the first to land in yang-common. |
| Comment by Robert Varga [ 30/Oct/21 ] |
|
Actually no, these things do should not live in yang.common. |
| Comment by Robert Varga [ 31/Oct/21 ] |
|
As it turns out we have the correct contract available in yang-xpath-api, and we have a instance-identifier parser available in YangXPathExpression.interpretAsInstanceIdentifier(). |