Yeah - I don't think there is any way for YANG to really express different defaults (i.e. dynamic defaults that depend on some other condition, e.g. which list item, etc).
The YANG default statement is really only for leafs that have a static default value (i.e. always the same). In this case the best you can do is have no YANG "default" statement and maybe describe the situation in the description (which won't really be machine readable). Jason From: netmod <[email protected]> On Behalf Of Andy Bierman Sent: Wednesday, February 23, 2022 6:12 PM To: Reshad Rahman <[email protected]> Cc: NetMod WG <[email protected]> Subject: Re: [netmod] Conditional default values? On Wed, Feb 23, 2022 at 2:37 PM Reshad Rahman <[email protected]<mailto:[email protected]>> wrote: Hi, My understanding is that we don't have any construct to easily do conditional default values. e.g. let's say I want interface MTU to have default 1500 for all types except 1. I tried by having conditional leaf nodes (using when on type) but I can't have duplicate leaf-nodes in the schema, even if the 2 when statements can never be true at the same time. Suggestions? You can make clever use of the "union" data type to allow different defaults. You cannot really represent the conditions to pick a member type (except description). Regards, Reshad. Andy _______________________________________________ netmod mailing list [email protected]<mailto:[email protected]> https://www.ietf.org/mailman/listinfo/netmod
_______________________________________________ netmod mailing list [email protected] https://www.ietf.org/mailman/listinfo/netmod
