[YANGTOOLS-1338] Generate ietf-restconf operations leaf statements Created: 30/Sep/21 Updated: 04/Jan/22 Resolved: 04/Jan/22 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | parser |
| Affects Version/s: | None |
| Fix Version/s: | 8.0.0 |
| Type: | Improvement | Priority: | Medium |
| Reporter: | Robert Varga | Assignee: | Robert Varga |
| Resolution: | Done | Votes: | 0 |
| Labels: | pt | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Description |
|
ietf-restconf has this modeling beauty:
container operations {
description
"Container for all operation resources.
Each resource is represented as an empty leaf with the
name of the RPC operation from the YANG 'rpc' statement.
For example, the 'system-restart' RPC operation defined
in the 'ietf-system' module would be represented as
an empty leaf in the 'ietf-system' namespace. This is
a conceptual leaf and will not actually be found in
the module:
module ietf-system {
leaf system-reset {
type empty;
}
}
To invoke the 'system-restart' RPC operation:
POST /restconf/operations/ietf-system:system-restart
To discover the RPC operations supported by the server:
GET /restconf/operations
In XML, the YANG module namespace identifies the module:
<system-restart
xmlns='urn:ietf:params:xml:ns:yang:ietf-system'/>
In JSON, the YANG module name identifies the module:
{ 'ietf-system:system-restart' : [null] }
";
}
This special node should not be a container, but rather an explicit extension, so that support can be hooked into YANG parser machinery. Fortunately ietf-restconf defines (and uses) an extension, so we at least have that hook available. Update YangDataStatementSupport to explicitly recognize this feature and perform the required magic – luckily there are no RPCs in that model, hence we should be able to rely on other models finishing full declaration and scraping RPCs from there.
|
| Comments |
| Comment by Robert Varga [ 30/Nov/21 ] |
|
After some amount of prototyping we need a few more features from the reactor and baseline RFC7950 leaf support, so re-targetting to 8.0.0 only. |