For the above mentioned yang model,
If I give show A,
It should display 1,2,3
And if I give show A B,
it should display 5,6,7
And if I give show A C
it should display 5,6,7 respective to container C
You can use the show templates feature as described in Chapter 16.27.2, Show templates, of the ConfD 6.0 User Guide to customize the output of the show command to implement your use case.
If you modify your YANG model as follows:
module ABC {
namespace "http://example.com/ns/ABC";
prefix abc;
import tailf-common {
prefix tailf;
}
container A {
config false;
tailf:cli-show-template
"$(/A/l1?$(l1|ljust:1) )"
+"$(/A/l2?$(l2|ljust:1) )"
+"$(/A/l3?$(l3|ljust:1))\n";
leaf l1 {
type int32;
}
leaf l2 {
type int32;
}
leaf l3{
type int32;
}
container B {
tailf:cli-show-template
"$(/A/B/l4?$(l4|ljust:1) )"
+"$(/A/B/l5?$(l5|ljust:1) )"
+"$(/A/B/l6?$(l6|ljust:1))\n";
leaf l4 {
type int32;
}
leaf l5 {
type int32;
}
leaf l6 {
type int32;
}
}
container C {
tailf:cli-show-template
"$(/A/C/l7?$(l7|ljust:1) )"
+"$(/A/C/l8?$(l8|ljust:1) )"
+"$(/A/C/l9?$(l9|ljust:1))\n";
leaf l7 {
type int32;
}
leaf l8 {
type int32;
}
leaf l9 {
type int32;
}
}
}
}
When you run confd with the above YANG model and with the operational data initialized, the cli output will now look as follows:
admin connected from 127.0.0.1 using console on WAITAI-M-K092
admin@WAITAI-M-K092> show A
1 2 3
[ok][2016-01-04 15:36:53]
admin@WAITAI-M-K092> show A B
5 6 7
[ok][2016-01-04 15:37:00]
admin@WAITAI-M-K092> show A C
5 6 7
[ok][2016-01-04 15:37:02]
admin@WAITAI-M-K092>
localhost# show running-config | include mycontainer
mycontainer myname 30
It’s worth mentioning that mycontainer won’t show up as a possible selection when you do “show running-config ?” as it isn’t configuration data, but it will show up as a line item in the output of “show running-config”.