netmod-wg / yang-next

Feature requests for future versions of YANG
6 stars 0 forks source link

Clarify canonical representation of typedefs #83

Open rgwilton opened 5 years ago

rgwilton commented 5 years ago

Some typedefs (and possibly some leaves) (e.g. ipv6-prefix) define their own canonical representation of the value space that overrides the canonical representation defined in the YANG built in types (RFC 7950 section 9.1).

I think that the next revision of the YANG draft should be clarified that:

I also think that we should consider whether YANG would benefit from a new keyword to mark typedefs or leaves that override the canonical representation of the base type, as an aid to compilers.

Further details/discussions on NETMOD "6021 ipv4-prefix" thread.

llhotka commented 5 years ago

Canonical representation should IMO be used only for types (built-in or derived), not individual leaves.

Instead of introducing a new keyword just as a label, we should maybe consider specifying the canonical format in a machine readable way, e.g. as an expression that transforms any legal value of the type into the canonical format.

samans commented 4 years ago

The use of strings as keys is troublesome when the format provided is not precise. An example is the mac-address typedef that defines a format string that supports both upper and lower case letters. In order for the key to match, they need to be identical. The Canonical representation is described in the description text, Providing a substatement that provides the Canonical representation in a machine readable way could provide a way to convert the value into canonical form before comparing keys.

abierman commented 2 weeks ago

Support these changes, but also need machine-readable syntax (as much as possible) Canonical format is complicated in servers and clients. Not sure if any existing syntax can help. This is like DISPLAY-HINT for a leaf.

complexity: high, bc: medium, importance: medium

kwatsen commented 27 minutes ago

This seems important.

Postel's law applies. Liberal in what is received, conservative in what is sent.