Disabling a part of the yang model , resets internal nodes to default values

Hi all , I have the following yang template

augment "/timer-counters" {
    container reserved-timers {
        leaf reserved-timer-count {
            default 10;

Say I have now changed the value of “reserved-timer-count” and then I disable the “timer-counters” subpart of the yang models using : no timer-counters, the value of “reserved-timer-count” is reset back to the default by confd.
This is something I would like to avoid. Is it possible? Is it additionally possible to disable it only for this specific subpart of the yang model ?

Thank you in advance for your help!

Default values are quite complex topic…

“default” value by YANG definition/RFC cannot be “deleted” / not present.

You may need to tell apart cases where value is set to 10 by user, vs when it is “not set” (note quotes! :slight_smile: ) → has the default value of 10 coming from your “deletion/reset”.
ConfD allows this in managing code using special C_DEFAULT for confd_value_t's type- grep for this text in various manual pages of ConfD or in ConfD user guide for more details on usage…

1 Like