Subject: [netmod] yang canonical integer format

From: Juergen Schoenwaelder <[email-masked]>
Date: Fri, 3 Mar 2017 16:53:22 +0100

Hi,

the canonical format for integer types is the decimal representation.
We do not seem to have a mechanism (other than a description statement)
to declare that the canonical representation is lets say hexadecimal.
For example, EtherType <https://en.wikipedia.org/wiki/EtherType> values
are usually written in hexadecimal notation. If I use a plain uint16
to represent an EtherType, it comes out of a datastore rendered as a
decimal number - and all I have is a description statement... Would
be nice to say something like

  typedef ether-type {
    type uint16 { format "%x"; }
  }

in plain YANG to make the hexadecimal format the canonical format. Who
maintains ideas for the next YANG revision?

/js

-- 
Juergen Schoenwaelder           Jacobs University Bremen gGmbH
Phone: +49 421 200 3587         Campus Ring 1 | 28759 Bremen | Germany
Fax:   +49 421 200 3103         <http://www.jacobs-university.de/>

---

From: Kent Watsen <[email-masked]>
Date: Fri, 3 Mar 2017 16:52:19 +0000

Hi Juergen,

> maintains ideas for the next YANG revision?

Ideas for the next revision of YANG are being captured in this tracker:

  https://github.com/netmod-wg/yang-next/issues

K.

---

From: Robert Varga <[email-masked]>
Date: Mon, 6 Mar 2017 12:13:36 +0100

Hello,

>> maintains ideas for the next YANG revision?

This is also useful for other types, for example inet-types:mac-address,
where implementations could use an 'canonical-pattern' type of declaration.

I think this particular idea ties the transport-specific representation
to a type definition -- I mean requiring binary transports to send
uint16s as text is not efficient and they would end up not using the
statement at all. This is also sticky if the transport places additional
restrictions on what is and is not a valid string and reminds me of some
of the 'anyxml' problems...

>   https://github.com/netmod-wg/yang-next/issues

given YANG is an extensible language, would it make sense to deliver
these outside of YANG revisions?

The main reason for doing so is that these, unlike YANG revisions:
- do not change the meta model of the language
- are not mandatory-to-implement

It will also allow for faster delivery to end users.

Regards,
Robert

---

From: Ladislav Lhotka <[email-masked]>
Date: Mon, 06 Mar 2017 13:28:16 +0100

> where implementations could use an 'canonical-pattern' type of

Perhaps even more common use case would be IP addresses - an IPv4 address
is basically a uint32 represented as a dotted quad.

> of the 'anyxml' problems...

DSDL has "extensible datatypes" [1] that try to approach this problem
from the other end: a type may provide a recipe (regular expression +
XPath transformation) for parsing a string into the "internal" value.

BTW, DSDL seems to be dead as dodo, even the dsdl.org domain now
advertises some Danish online gambling. :-) This is sort of pity, they
had quite a few interesting ideas.

Lada

[1] http://conferences.idealliance.org/extreme/html/2006/Tennison01/EML2006Tennison01.html

> _______________________________________________
> netmod mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/netmod

-- 
Ladislav Lhotka, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67