Below is a sample from yang file
list interface
{
description "The list of configured interfaces on the device";
key "interface-id";
leaf interface-id
{
description "Interface identifier";
type yang:counter32;
}
leaf mtu
{
description "MTU size for this interface";
type yang:counter32;
default 1500;
}
leaf state-enable
{
description "Enable or disable";
type boolean;
default false;
}
leaf num-of-pkts-received
{
config false;
tailf:callpoint interface-stats;
description "Number of packets received in this interface";
type yang:counter64;
}
leaf num-of-pkts-sent
{
config false;
tailf:callpoint interface-stats;
description "Number of packets sent from this interface";
type yang:counter64;
}
}
It contains config elements like mtu,state-enable and non-config(stats) like num-of-pkts-received and num-of-pkts-sent.
If I want to check the interface stats. The below command gives the expected output.
localhost# show interface
INTERFACE NUM OF PKTS NUM OF PKTS
ID RECEIVED SENT
--------------------------------------------
0 2351330 5271474
1 3333907964 1228799628
2 1866302 2293135483
But If I add the display option as json. It shows the entire containter. It does not differentiate the non-config(stats) and config elements.
localhost# show interface | display json
"data": {
"interface": [
{
"interface-id": 0,
"mtu": 1000,
"state-enable" : true,
"num-of-pkts-received" :2351330,
"num-of-pkts-sent":5271474
},
{
"interface-id": 1,
"state-enable" : true,
"num-of-pkts-received" :3333907964,
"num-of-pkts-sent":1228799628
},
{
"interface-id": 2,
"mtu": 1400,
"state-enable" : true,
"num-of-pkts-received" :1866302,
"num-of-pkts-sent":2293135483
},
]
}
The problem is seen with only JSON and XML and not seen in other display options like curly-braces, keypath or xpath.
localhost# show interface | display xpath
/interface[interface-id='0']/num-of-pkts-received 2351330
/interface[interface-id='0']/num-of-pkts-sent 5271474
/interface[interface-id='1']/num-of-pkts-received 3333907964
/interface[interface-id='1']/num-of-pkts-sent 1228799628
/interface[interface-id='2']/num-of-pkts-received 1866302
/interface[interface-id='2']/num-of-pkts-sent 2293135483