[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:
Blocks
is blocked by YANGTOOLS-1372 Add support for purely-effective subs... Resolved
is blocked by YANGTOOLS-1371 Expose available StatementSupports fr... Resolved
is blocked by YANGTOOLS-1381 Parser reactor does not support chain... Resolved
Relates
relates to NETCONF-822 Discover RPC operation through RESTCO... Resolved

 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.

Generated at Wed Feb 07 20:55:52 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.