Hi Robert, > The issue that I raise in slide 8 of proposal #1 is the following. > A data node “foo” that has a default can be used in a template configuration > without problem (while configuring the template, the default can be used or > another value can be explicitly configured instead). However, this same data > node “foo” must not keep this default value when used in the YANG schema of > the instance.
I’m having a hard time parsing this paragraph: 1) Are you assuming a default mode? (RFC 6243) 2) Does "that has a default” mean in the YANG module or configuration? 3) What is an “instance”? (I think you mean “configuration”) It might help to use terms defined in various RFCs. > Why so ? > > Well, imagine that the template is explicitly configured with “foo” having > value 200, so, different from the default. > In the general case, the vast majority of the data nodes of an instance are > not explicitly configured because the expectation is that their value comes > from the template. If the instance data node “foo” is left unconfigured > (naively hoping to inherit 200 from the template) but still has its default > 100, the default value 100 will take effect as-if it had been explicitly > configured and hence 100 will overrule the value 200 coming from the > template. The problem is that this default value overruling the template will > happen silently, so this is very prone to unintended behaviour ! > > So this is why default values in instances should not be present. I love that you provided an example, but I again am having trouble parsing what is written. It would be clearer if the example contained snippets of YANG and JSON/XML. That said, my understanding of how templates are processed is so straightforward, that no special consideration for how leafs with ‘default’ statements are processed is needed. In my worldview, the templates are fully expanded/flattened and, if an unconfigured leaf has a ‘default’ statement, then it is understood that the ‘default’ value is used when the config is *applied* (standard RFC 7950 behavior). > The issue with mandatory is that data nodes that are mandatory in templates > and instances must be configured twice: once in the template (this one is > OK) but also in the instance (this one is useless, value would have come > from the template anyway). This causes inefficiency to the template > mechanism, albeit it is less problematic than the “default” issue because it > is not a silent side effect. I disagree that ‘mandatory’ leafs must be configured in templates. I think that mandatory nodes only must be configured after all templates have been fully expanded/flattened. That said, please add a requirement for "‘mandatory’ leafs must be configured in templates” to the issue tracker so the idea can be scored later. Kent // contributor
_______________________________________________ netmod mailing list -- [email protected] To unsubscribe send an email to [email protected]
