Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-1464

Add support for formatting EffectiveModelContext to organization tree

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: High High
    • 13.0.5
    • None
    • model-export

      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.

            matusmatok Matúš Matok
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: