[YANGTOOLS-1464] Add support for formatting EffectiveModelContext to organization tree Created: 05/Nov/22  Updated: 18/Jan/24

Status: In Review
Project: yangtools
Component/s: model-export
Affects Version/s: None
Fix Version/s: 13.0.2

Type: New Feature Priority: High
Reporter: Robert Varga Assignee: Matúš Matok
Resolution: Unresolved Votes: 0
Labels: pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

YANG-related RFC routinely note an organization tree, such as the one in RFC8341:

   module: ietf-netconf-acm
     +--rw nacm
        +--rw enable-nacm?              boolean
        +--rw read-default?             action-type
        +--rw write-default?            action-type
        +--rw exec-default?             action-type
        +--rw enable-external-groups?   boolean
        +--ro denied-operations         yang:zero-based-counter32
        +--ro denied-data-writes        yang:zero-based-counter32
        +--ro denied-notifications      yang:zero-based-counter32
        +--rw groups
        |  +--rw group* [name]
        |     +--rw name         group-name-type
        |     +--rw user-name*   user-name-type
        +--rw rule-list* [name]
           +--rw name     string
           +--rw group*   union
           +--rw rule* [name]
              +--rw name                 string
              +--rw module-name?         union
              +--rw (rule-type)?
              |  +--:(protocol-operation)
              |  |  +--rw rpc-name?            union
              |  +--:(notification)
              |  |  +--rw notification-name?   union
              |  +--:(data-node)
              |     +--rw path                 node-instance-identifier
              +--rw access-operations?   union
              +--rw action               action-type
              +--rw comment?             string

The format is specified in RFC8340.

Implement this functionality through a DeclaredStatementFormatter.toYangTreeDiagram(), similar to how toYangTextSnippet() creates a YANG snippet.

There are two modes of operation possible: an event stream, or a plain String stream. For the initial impementation consider only a String stream akin to YangTextSnippet.

The canonical implementation used by everyone lives in pyang and supports a multitude of formatting options, but for the initial cut we do not need to support the whole thing. What we need to support is:

  • print groupings by default
  • do not expand 'uses' statements
  • allow controlling the depth of the tree

Also we do not care about mount points right now.


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