09-02-2019 07:30 AM
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.
Solved! Go to Solution.
09-02-2019 08:53 AM
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.
09-02-2019 08:53 AM
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.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide