ietf
[Top] [All Lists]

Re: Blog: YANG Really Takes Off in the Industry

2014-12-10 04:12:10
----- Original Message -----
From: "Brian E Carpenter" <brian(_dot_)e(_dot_)carpenter(_at_)gmail(_dot_)com>
To: "Ted Lemon" <Ted(_dot_)Lemon(_at_)nominum(_dot_)com>
Cc: "t.p." <daedulus(_at_)btconnect(_dot_)com>; "IETF-Discussion list"
<ietf(_at_)ietf(_dot_)org>
Sent: Tuesday, December 09, 2014 7:39 PM
On 10/12/2014 03:54, Ted Lemon wrote:
On Dec 9, 2014, at 9:31 AM, t.p. <daedulus(_at_)btconnect(_dot_)com> wrote:
The expression that controls the permissible format of IPv6
addresses in
yang-types is of this ilk.
"       type string {
        pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
              + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
              + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}'
              + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'
              + '(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))';
        pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
              + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'
              + '(/.+)'; "
which was got wrong several times before it became what it is now
(which
rings alarm bells for me).

Wow, so there's no way to do this ABNF-style?

In fairness, it took numerous attempts to get the ABNF for the text
representation of IPv6 addresses right, with RFC 6874 being the latest
twist (which, if I am not mistaken, is not covered by the above
gobbledygook; at least, I don't see anything in there that seems
equivalent to '"%25" ZoneID', but maybe I missed it).

Brian

The question of zone index did come up and it appears in RFC6991 which
has the

" ipv6-address type represents an IPv6 address in full, mixed,
shortened, and shortened-mixed notation.  The IPv6 address may include a
zone index, separated by a % sign."

as well as

"ipv6-address-no-zone ...
An IPv6 address without a zone index "

but whether we should be using a language to achieve such precise
control in the general case I am less sure of.

Tom Petch

    Brian