ConfD User Community

How sub-cli should be configured when parent is configured

Hi Team,

container x {
  container y {
    presence true;
      container z {
        leaf value {
          tailf:cli-drop-node-name;
          tailf:cli-trim-default;
          type uint8;
          default 3;
        }
     }
 }

With above modeling I am unable to achieve below requirement,

  1. if configure x then y should also be configured but not display in show run config like below

ubuntu-xenial(config)# x
ubuntu-xenial(config)# show full-conf
x
ubuntu-xenial(config)# show full-conf | details
x
y
y z 3

  1. And if i do no y then it should remove all default values and display no form of y like below,
    ubuntu-xenial(config)# no y
    ubuntu-xenial(config)# show full-conf
    no y
    ubuntu-xenial(config)# show full-conf | details
    x
    no y

Please someone reply .

Hi,

From a pure modeling perspective, The container X being configured, based on the model example you used, equates to the container Y being created (as it is the only child to X), unless you have other child nodes of X that if they are configured you consider X configured.

If you have other children of X, other than Y, you can have a must statement at the top expressing that if any leaf (let’s assume you have leaf nodes under X) is configured, then Y should be present. This way you are ensuring that Y exists if some leaf is configured.

Excluding configuration in a show is not possible. What is the use case of this exclusion?

With regards to deletions, if you want to control what gets deleted in addition to what the user requests to delete, you can use a set-hook for the Y container, and delete X too. This is not recommended of course from a management orchestration perspective. But if you have a must statement at the X level that insures container Y must exist if another leaf is different than some default value, a deletion of Y will be rejected if X hasn’t been deleted too (set back to defaults).