Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yanglint print tree of augment-module does NOT work #24

Closed
classcwnd opened this issue Feb 10, 2016 · 4 comments
Closed

yanglint print tree of augment-module does NOT work #24

classcwnd opened this issue Feb 10, 2016 · 4 comments
Assignees

Comments

@classcwnd
Copy link

I added some modules and found the model tree of augment module can not be printed out. Is this normal? I am afraid that the augment models are not added successfully.
The models.tar was uploaded in #22
Following are the log of my steps.
ietf-interfaces & ericsson-contexts-ipos are main models, and ericsson-context-ipos & ericsson-interfaces-ext-ipos are augment models.

(gdb) r
Starting program: /project/swbuild82/eyyuppg/libnetconf/integration/new4/netopeer/libyang/build/yanglint 
[Thread debugging using libthread_db enabled]
> add [email protected]
> add iana-if-type.yin
> add [email protected]
> add [email protected]
> add [email protected]
> print -f tree ericsson-contexts-ipos
module: ericsson-contexts-ipos
   +--rw contexts
   |  +--rw service
   |  |  +--rw multiple-contexts?       boolean <true>
   |  |  +--rw inter-context-routing?   empty
   |  |  +--rw load-balance
   |  |     +--rw ip
   |  |     |  +--rw (ip)?
   |  |     |     +--:(layer-3)
   |  |     |     |  +--rw layer-3?       empty
   |  |     |     +--:(layer-4)
   |  |     |     |  +--rw layer-4?       empty
   |  |     |     +--:(source-only)
   |  |     |        +--rw source-only?   empty
   |  |     +--rw link-group
   |  |        +--rw (link-group)?
   |  |           +--:(layer-3)
   |  |           |  +--rw layer-3?       empty
   |  |           +--:(layer-4)
   |  |           |  +--rw layer-4?       empty
   |  |           +--:(source-only)
   |  |              +--rw source-only?   empty
   |  +--rw system!
   |  |  +--rw lacp
   |  |     +--rw priority?   uint16
   |  |     +--rw mac-addr?   ietf-yang-types:mac-address
   |  +--rw ctxipos:context* [context-name]
   |  |  +--rw ctxipos:context-name     string
   |  |  +--rw ctxipos:vpn-rd?          string
   |  |  +--rw ctxipos:ippm!
   |  |  |  +--rw ctxipos:twamp-light
   |  |  +--rw ctxipos:description?     string
   |  |  +--rw ctxipos:subscriber
   |  |  |  +--rw ctxipos:name* [name]
   |  |  |  |  +--rw ctxipos:name              string
   |  |  |  |  +--rw ctxipos:ipv6!
   |  |  |  |  |  +--rw ctxipos:nd-profile    string
   |  |  |  |  +--rw ctxipos:forward-policy!
   |  |  |  |     +--rw ctxipos:pol-name    string
   |  |  |  |     +--rw ctxipos:in          empty
   |  |  |  +--rw ctxipos:profile* [profile]
   |  |  |     +--rw ctxipos:profile           string
   |  |  |     +--rw ctxipos:ipv6!
   |  |  |     |  +--rw ctxipos:nd-profile    string
   |  |  |     +--rw ctxipos:forward-policy!
   |  |  |        +--rw ctxipos:pol-name    string
   |  |  |        +--rw ctxipos:in          empty
   |  |  +--rw ctxipos:route-map* [route-map]
   |  |  |  +--rw ctxipos:route-map      string
   |  |  |  +--rw ctxipos:description?   string
   |  |  +--rw ctxipos:router
   |  |  |  +--rw ctxipos:msdp?              empty
   |  |  +--rw ctxipos:ospf3-maximum!
   |  |  |  +--rw (ctxipos:ospf3-maximum)?
   |  |  |     +--:(ctxipos:paths)
   |  |  |     |  +--rw ctxipos:paths?               uint8
   |  |  |     +--:(ctxipos:neighbor-exchange)
   |  |  |        +--rw ctxipos:neighbor-exchange?   uint32
   |  |  +--rw ctxipos:ip
   |  |  +--rw ctxipos:ipv6
   |  +--rw ctxipos:dot1q* [profile]
   |     +--rw ctxipos:profile        string
   |     +--rw ctxipos:description?   string
   +--ro contexts-state
> print -f tree ericsson-context-ipos
module: ericsson-context-ipos
> 
> 
> 
> 
> 
> print -f tree ericsson-interfaces-ext-ipos
module: ericsson-interfaces-ext-ipos
> print -f tree ericsson-context
ericsson-contexts-ipos  ericsson-context-ipos 
@rkrejci rkrejci self-assigned this Feb 11, 2016
@rkrejci
Copy link
Collaborator

rkrejci commented Feb 11, 2016

Augments should be correct in the internal structures, but I see some issues with the tree printer:

  1. augments are printed only in the target module, not in the module where they are defined
  2. in the target module, the augments data are printed with the prefix of the module where they are defined. pyang does it this way, but we print module names as prefix (in your output, see type of /contexts/system/lacp/mac-addr)

rkrejci added a commit that referenced this issue Feb 11, 2016
prefix of the module is not unique, so in the tree output, use module
names instead the module prefix.

Relates to #24
rkrejci added a commit that referenced this issue Feb 11, 2016
rkrejci added a commit that referenced this issue Feb 11, 2016
prefix of the module is not unique, so in the tree output, use module
names instead the module prefix.

Relates to #24
rkrejci added a commit that referenced this issue Feb 11, 2016
@rkrejci rkrejci closed this as completed Feb 11, 2016
@classcwnd
Copy link
Author

hi

I found the fixed version still uses module name as the prefix not using defined prefix.

@rkrejci
Copy link
Collaborator

rkrejci commented Feb 12, 2016

That's correct. The defined prefixes are not necessarily unique (in contrast to module names), so, as I wrote, we want to use module names as prefixes in tree output - they are longer, but it is much more clear from which module data comes.

Unfortunatelly, this differs libyang's tree output from pyang, but it is intended.

@classcwnd
Copy link
Author

Ok, I see. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants