Hi,

if we want to standardize tree diagrams, we may want to take a more
critical look at them, in particular the flags (that were created
ad-hoc and in resemblance to MIB tree diagrams). pyang --tree-help
says:

  <flags> is one of:
    rw  for configuration data
    ro  for non-configuration data
    -x  for rpcs and actions
    -n  for notifications

This is (a) incomlete and (b) somewhat confusing since ct does not
equate to readwrite. I am attaching a sample yang file and here is the
output pyang 1.7.1 produces:

module: tree-sample
    +--rw config-true-container
    |  +--rw param?   string
    +--ro config-false-container
    |  +--ro value?   string
    +--rw inline-action
    |  +---x action
    |     +---- oops?     string
    |     +---w input
    |     |  +---w in?   string
    |     +--ro output
    |        +--ro out?   string
    +--rw inline-notification
       +---n notification
          +---- duration?   string

  rpcs:
    +---x rpc
       +---w input
       |  +---w in?   string
       +--ro output
       |  +--ro out?   string
       +--ro oops?     string

  notifications:
    +---n notification
       +--ro boom?   string

I think a better usage of two letter flags would have been this (since
it more naturally aligns with what the YANG definition says):

  <flags> is one of:
    ct  for configuration data
    cf  for non-configuration data
    x-  for rpcs and actions
    xi  for rpc or action input
    xo  for rpc or action output
    n-  for notifications
    nt  for notification tree (this is I think the term 7950 uses)

module: tree-sample
    +--ct config-true-container
    |  +--ct param?   string
    +--cf config-false-container
    |  +--cf value?   string
    +--ct inline-action
    |  +--x- action
    |     +--xi input
    |     |  +--xi in?   string
    |     +--xo output
    |        +--xo out?   string
    +--ct inline-notification
       +--n- notification
          +--nt duration?   string

  rpcs:
    +--x- rpc
       +--xi input
       |  +--xi in?   string
       +--ro output
          +--xo out?   string

  notifications:
    +--n- notification
       +--nt boom?   string

(And I think the oops leafs should have triggered an error.)

/js

-- 
Juergen Schoenwaelder           Jacobs University Bremen gGmbH
Phone: +49 421 200 3587         Campus Ring 1 | 28759 Bremen | Germany
Fax:   +49 421 200 3103         <http://www.jacobs-university.de/>
module tree-sample {

  yang-version 1.1;
  prefix "tree";

  container config-true-container {
    leaf param { type string; }
    config true;
  }

  container config-false-container {
    leaf value { type string; }
    config false;

  }

  container inline-action {
    action action {
      leaf oops { type string; }
      input {
        leaf in { type string; }
      }
      output {
        leaf out { type string; }
      }
    }
  }
  
  container inline-notification {
    notification notification {
      leaf duration { type string; }
    }
  }
  
  rpc rpc {
    input {
      leaf in { type string; }
    }
    output {
      leaf out { type string; }
    }
    leaf oops { type string; }
  }
  
  notification notification {
    leaf boom { type string; }
  }
}
_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod

Reply via email to