In addition, and to Jeff’s point, we (in Arrcus) have started to deviate (and 
add) a constraint on the length of strings when they form part of the key, and 
when one is missing. It would be great to check for this as a practice, and/or 
add a type definition for a string type as suggested by Andy.

Thanks.

> On Oct 3, 2022, at 12:41 PM, Jeffrey Haas <jh...@pfrc.org> wrote:
> 
> [I had promised Mahesh that I'd take my comments here, but I realize that this
> is a topic that likely will result in no short term solutions.  It may also
> result in no action whatsoever.]
> 
> YANG strings are bounded in length, theoretically, but that length limit
> isn't small.
> 
> When strings are used solely as leaf values, the length limit largely isn't
> a matter of concern, in my opinion.  However, when they're used as keys, it
> introduces some code practicalities that may be worth discussing.
> 
> One item of practicality is simply the length and its impact on underlying
> data structures.  If you were storing such things in something like a
> PATRICIA tree, many implementations behave better when the key is of a
> bounded length.*
> 
> A secondary consideration is that since unicode is used, character lengths
> in terms of storage may vary.  Implementations that internally store strings
> as UTF-8 have to be wary of truncation considerations.
> 
> A tertiary consideration is that in mechanisms like gNMI, long keys end up
> bloating PDUs.
> 
> Loosely framing this as a very old English joke: YANG Doctor, it hurts when
> I do this!  YANG Doctor: Well... don't do that!
> 
> For many things that have naturally short string names (e.g. interface
> names), this mostly isn't an issue.  However, for things that may take
> user-supplied strings as their key in configuration, this is somewhat more
> problematic.*
> 
> Most implementations likely don't take unbounded inputs to the maximum
> length of a YANG string for such things.  Technically in such situations,
> they're non-conformant if that's the case, or if they don't provide a
> deviation specifying the length of the string.
> 
> Why raise this?  While I only coincidentally participate in YANG module
> implementation at the moment, I remember similar headaches in MIBs making
> the lives of implementors problematic.
> 
> What should be done, if anything?  It seems like those with deeper expertise
> may want to recommend a reasonable length limit for strings that will be
> used as keys.  Perhaps define a specific typedef for such things.  And, once
> defined, the YANG doctors might consider recommending them in their reviews.
> 
> Such things may already be good practice, but perhaps I'm not aware of it.
> 
> -- Jeff
> 
> * As a matter of fact, it was performing a code review against exactly this
> point that raised this consideration.
> 
> _______________________________________________
> yang-doctors mailing list
> yang-doct...@ietf.org
> https://www.ietf.org/mailman/listinfo/yang-doctors


Mahesh Jethanandani
mjethanand...@gmail.com






_______________________________________________
netmod mailing list
netmod@ietf.org
https://www.ietf.org/mailman/listinfo/netmod

Reply via email to