Subject: [netmod] smi2yang-04: string vs. binary

From: David Reid <[email-masked]>
Date: Thu, 17 Nov 2011 11:44:08 -0500

I've never been entirely comfortable with solution #04-01, but I can't
come up with anything better. Of the options on the table, I think #04-01
is the best.

-David Reid

> * smi2yang-04: string vs. binary [open]
> 
>   It would be nice to have a reliable mechanism to determine whether
>   an OCTET STRING can be represented as a human readable string or is
>   a binary string. The current ID suggests to use the presence of a
>   DISPLAY-HINT for this purpose. However, the SMIv2 allows to add a
>   DISPLAY-HINT when a MIB module is revised, which can lead to
>   different translations of different versions of a MIB module.
> 
> ** Solution #04-01
> 
>    Declare this a non-problem since additions of DISPLAY-HINTs are
>    rare. Suggest that implementations provide options to cast an
>    OCTET STRING into binary to handle situations where a DISPLAY-HINT
>    got added when a module was revised.
> 
> ** Solution #04-02
> 
>    Translate strings into unions that allows both a human readable
>    string representation and a binary representation. However, this
>    requires to have some mechanism in place to decide whether a value
>    is a human readable string or a binary string, which means we
>    likely have to mess around with values.
> 
> ** Solution #04-03
> 
>    Always translate OCTET STRING types into the YANG binary types. We
>    could list some well-known types as exceptions, like DisplayString,
>    SnmpAdminString, DateAndTime but such a list will always be
>    incomplete and hence some human readable data will be encoded into
>    base64.
> 
> ** Solution #04-04
> 
>    Always translate OCTET STRINGS into a choice which contains a
>    binary leaf. Add a second string leaf if there is a DISPLAY-HINT.
>    This would also apply to objects using an OCTET STRING TC, that is
>    in the extreme case (no special rules for well known string types),
>    we get for sysDescr:
> 
>    choice sysDescr-leaf {
>      leaf sysDescr-string {
>        type string;
>      }
>      leaf sysDescr-binary {
>        type binary;
>      }
>    }
> 
>    While this solution is robust wrt. module revisions that add a
>    DISPLAY-HINT, the cost of having to support two formats are
>    significant.

---

From: Martin Bjorklund <[email-masked]>
Date: Thu, 17 Nov 2011 18:03:08 +0100 (CET)

> come up with anything better. Of the options on the table, I think #04-01

+1

/martin