How to hide a container when default value is set?

How to hide a container when default value is set ?

        container test {
          presence "";
          leaf value {
            type uint16 {
              range "0..63";
            default "1";

when i set my container with default value, show run print my on my CLI my container without value.
I want to hide my container when the default value is set.
Actualy i print that with show run; I’m looking to have show run empty when default value is set.
conf>test 1
show run>“test”

conf> test 2
show run>“test 2”

See tailf:cli-trim-default in the tailf_yang_cli_extensions man page

my container remains visible without the default with tailf:cli-trim-default

If I understand the model correctly - you have two separate elements - presence container “test” can be created/delete by itself, independently on presence/default-ness of internal leaf “value”…

I assume that cli-trim-default applied to leaf “value” does what you want with “value”, but does not affect "test’ - which is expected.

Do you really need the container to be “present”?

I assume if will follow your desired behavior when it’s just a regular container, with cli-trim-default annotation applied to “value” leaf.

Hi, I am also facing a similar problem, when i set default leaf value then, presence container should be not visible in show running-config.

Any Leads on how to solve this issue ?

Sai Abhishek Sure

Can you clarify your problem by providing an example YANG model and CLI output of what you need?

Here is an example,( My CLI is ip ssh bulk-mode “window-size”)
Below is my yang model for container bulk-mode:
container bulk-mode {
“Enable optimizations for bulk data transfer procedures”;
presence “true”; → to support ip ssh bulk-mode
leaf window-size {
“Window-size value”;
type uint32 {
range “131072…1073741824”;
default “131072”; → to make 128KB as default value

If I configure “ip ssh bulk-mode 131072” below is the output in the CDB
sh run | i bulk-mode => “ip ssh bulk-mode”
sh run | details | i bulk-mode => “ip ssh bulk-mode 131072”

as 131072 is default, only that value is hidden and is shown in sh run | details.
My requirement is the whole command must be set as default when leaf bulk-mode is default
sh run | i bulk-mode =>
sh run | details | i bulk-mode => “ip ssh bulk-mode 131072”