How to hide a container when default value is set ?
container test {
presence "";
leaf value {
type uint16 {
range "0..63";
}
default "1";
tailf:cli-drop-node-name;
}
}
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”
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.
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 {
description
“Enable optimizations for bulk data transfer procedures”;
presence “true”; → to support ip ssh bulk-mode
leaf window-size {
description
“Window-size value”;
tailf:cli-drop-node-name;
tailf:cli-no-value-on-delete;
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”