cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1007
Views
0
Helpful
1
Replies

yanger: No pretty format for output format tree

DTtb
Level 1
Level 1

Hi,

 

I want to visualize the yang model from a ncs service as tree format and save it to a file for documentation purpose .
If I use the --output option inside yanger, I got the tree output in one line without pretty format.

But if I am print the tree output to STDOUT, I got the pretty view.

 

Is there a option to get the newlines inside the output file for pretty format?

Or do I need to redirect always the output from stdout to file per Bash I/O redirection with > output.txt ?

 

Create tree output

yanger -f tree -o output.txt testservice/src/yang/testservice.yang

Output

module: testservice
augment /ncs:services:
+--rw testservice* [infra-type infra-location] +---x check-sync | +---w input | | +---w outformat? outformat4 | | +---w (depth)? | | | +--:(deep) | | | | +---w deep? empty | | | +--:(shallow) | | | +---w shallow? empty | | +---w suppress-positive-result? empty | | +---w (choice-lsa)? | | +--:(use-lsa) | | | +---w use-lsa? empty | | +--:(no-lsa) | | +---w no-lsa? empty | +--ro output | +--ro (outformat)? | +--:(in-sync) | | +--ro in-sync? boolean | +--:(case-xml) | | +--ro result-xml | | +--ro local-node | | | +--ro data? <anyxml> | | +--ro lsa-node* | | +--ro name? string | | +--ro data? <anyxml> | +--:(case-cli) | +---w input | | +---w outformat? outformat4 | | +---w (depth)? | | | +--:(deep) | | | | +---w deep? empty | | | +--:(shallow) | | | +---w shallow? empty | | +---w suppress-positive-result? empty | | +---w (choice-lsa)? | | +--:(use-lsa) | | | +---w use-lsa? empty | | +--:(no-lsa) [Omitted output]

If I generate the tree output to STDOUT, it is pretty-formatted:

yanger -f tree testservice/src/yang/testservice.yang

Output:

module: testservice

  augment /ncs:services:
    +--rw testservice* [infra-type infra-location]
       +---x check-sync
       |  +---w input
       |  |  +---w outformat?                  outformat4
       |  |  +---w (depth)?
       |  |  |  +--:(deep)

[Omitted output]

 

Common information:

$ ncs --version
4.7.2.1
$ yanger --version
yanger 1.0

Thanks.

1 Accepted Solution

Accepted Solutions

mvolf
Cisco Employee
Cisco Employee

This is a known problem, fixed in yanger released with nso-5.2. As an alternative, you can use yanger from https://github.com/mbj4668/yanger.

View solution in original post

1 Reply 1

mvolf
Cisco Employee
Cisco Employee

This is a known problem, fixed in yanger released with nso-5.2. As an alternative, you can use yanger from https://github.com/mbj4668/yanger.