Container restriction within list

Hi, below is my requirement
I have the yang structure as below:
List L1
Key name
Leaf name
Container c1
Leaf c1l1
Container c2
Leaf c2l2

For this yang when I run show L1, it displays all the leafs and containers both c1 and c2.
But I need to show only the first container c1 when user requests show L1.
Only when they request for show L1 c2 I need to display container c2 details. So by default only. C1 should come when user does show L1.

How can this be achieved. Other commands like below should also work
Show L1 key1 - should display c1 for given key
Show L1 c2 - should display all c2 for all L1key
Show L1 key1 c2 - should display c2 for given key

Thanks,
Sweetlin S

Hi, Can anybody help me with this query.

Only the first command wouldn’t work:
Show L1 key1 - should display c1 for given key

This is not possible as the hierarchy you defined suggests data below L1 is a child to L1 and thus a user requesting L1 will get everything under L1.

If you are interested in CLI customization for a Premium version of ConfD, you might want to look at “show templates”. Basic ConfD doesn’t provide CLI for production.

These ones should work:

Show L1 c2 - should display all c2 for all L1key
Show L1 key1 c2 - should display c2 for given key.

These work because it’s a “natural” filtering command: Adhere to YANG hierarchy of data. Work also via NETCONF.

Hi @nabil
Thanks for the update. We do have the premium version of confd and I tried out the show templates.

But some how when I added show template for the list l1 to make it display only container c1. That worked but the filtering like shoe L1 c2 did not work. For all the filters only the elements mentioned in show templates are coming.

Hi @nabil, Any updated on my comment above.

hi @sweetlin,
I don’t know what the issue might be as I don’t work with templates a lot.
You might want to ask support. The support team is probably more experienced with these scenarios.