Subject: Re: [netmod] I-D Action: draft-chopps-netmod-geo-location-00.txt

From: Martin Bjorklund <[email-masked]>
Date: Mon, 04 Mar 2019 10:59:40 +0100 (CET)

Hi,

Just some quick comments on the YANG:

The pattern

        '[-0-9a-z #x22#x23#x5B#x5D' +
        '!$%&()*+,\./:;<=>?@\\^_`{|}~]+';

doesn't seem to be correct.  I think it should be:

        '[-0-9a-z "#[\]' +
        '!$%&()*+,./:;<=>?@\\^_`{|}~]+';

i.e., don't use hex codes (the regex dialect we use
don't support them, and besides, the normal syntax is \x22 etc.), and
don't escape characters that don't need escapes.

However, it seems libxml2's regexp engine requires both "[" and "^" to
be escaped:

        '[-0-9a-z "#\[\]' +
        '!$%&()*+,./:;<=>?@\\\^_`{|}~]+';

This expression isn't wrong, but it seems to me that these characters
should not have to be escaped.

The pattern allows double quote (") but not single quote (').  Is
that intentional?

[a simple way to test the patterns is to have a "default" statement
and a YANG complier that verifies defaults]

I recommend that you rename the example module in section to
"example-uses-geo-location" (and change the namespace to
urn:example:uses-geo-location).   We should not use the "ietf"
namespace for examples.

/martin

Christian Hopps <[email-masked]> wrote:
> FYI.
> 
> > Begin forwarded message:
> > 
> > From: [email-masked]
> > Subject: I-D Action: draft-chopps-netmod-geo-location-00.txt
> > Date: February 26, 2019 at 3:59:23 PM EST
> > To: <[email-masked]>
> > Reply-To: [email-masked]
> > 
> > 
> > A New Internet-Draft is available from the on-line Internet-Drafts directories.
> > 
> > 
> >        Title           : YANG Geo Location
> >        Author          : Christian Hopps
> > 	Filename        : draft-chopps-netmod-geo-location-00.txt
> > 	Pages           : 17
> > 	Date            : 2019-02-26
> > 
> > Abstract:
> >   This document defines a generic geographical location object YANG
> >   grouping.  The geographical location grouping is intended to be used
> >   in YANG models for specifying a location on or in reference to the
> >   Earth or any other astronomical object.
> > 
> > 
> > The IETF datatracker status page for this draft is:
> > https://datatracker.ietf.org/doc/draft-chopps-netmod-geo-location/
> > 
> > There are also htmlized versions available at:
> > https://tools.ietf.org/html/draft-chopps-netmod-geo-location-00
> > https://datatracker.ietf.org/doc/html/draft-chopps-netmod-geo-location-00
> > 
> > 
> > Please note that it may take a couple of minutes from the time of submission
> > until the htmlized version and diff are available at tools.ietf.org.
> > 
> > Internet-Drafts are also available by anonymous FTP at:
> > ftp://ftp.ietf.org/internet-drafts/
> > 
> > _______________________________________________
> > I-D-Announce mailing list
> > [email-masked]
> > https://www.ietf.org/mailman/listinfo/i-d-announce
> > Internet-Draft directories: http://www.ietf.org/shadow.html
> > or ftp://ftp.ietf.org/ietf/1shadow-sites.txt
> > 
>

---

From: Martin Bjorklund <[email-masked]>
Date: Mon, 04 Mar 2019 12:59:54 +0100 (CET)

>         '[-0-9a-z #x22#x23#x5B#x5D' +

It turns out that "[" actually must be escaped, but the handling of
"^" is a bug in libxml2:

https://bugzilla.gnome.org/show_bug.cgi?id=779751
https://bugzilla.gnome.org/show_bug.cgi?id=674411

/martin

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

---

From: Christian Hopps <[email-masked]>
Date: Mon, 04 Mar 2019 15:20:24 -0500

> However, it seems libxml2's regexp engine requires both "[" and "^" to

The intent was "ascii-printable". Would be nice if there was an easier way to specify this. :)

> and a YANG complier that verifies defaults]

Does pyang do this?

> urn:example:uses-geo-location).   We should not use the "ietf"

Will do.

Thanks,
Chris.

---

From: William Lupton <[email-masked]>
Date: Mon, 4 Mar 2019 21:31:46 +0000

> The intent was "ascii-printable". Would be nice if there was an easier
way to specify this. :)

Printable ASCII characters are ' ' (space) through '~' (tilde) so naively [
-~] should work ... but perhaps that makes unacceptable assumptions about
the locale and/or character encoding? (Certainly it should be OK if we can
assume UTF-8, because all printable ASCII characters retain their ASCII
representations in UTF-8.)

---

From: Martin Bjorklund <[email-masked]>
Date: Mon, 04 Mar 2019 23:23:42 +0100 (CET)

> The intent was "ascii-printable". Would be nice if there was an easier

Hmm, one pattern includes space (but not tab etc), and another doesn't
include space.  Was that intentional?

You may be able to use Unicode properties and write something like:

      pattern '[\p{IsBasicLatin}-[\p{Lu}\p{Cc}\p{Z}]]+';

  Lu = uppercase letter
  Cc = ascii control
  Z  = whitespace

> > and a YANG complier that verifies defaults]

Yes.

/martin

---

From: Christian Hopps <[email-masked]>
Date: Tue, 05 Mar 2019 08:54:29 -0500

> representations in UTF-8.)

I think your suggestion is a good one!

YANG references <https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#dt-regex> says it will work too (its the range between the UTF code points, which in this case are the ascii values), but then that reference is also where i got the "#x22" hex format from that Martin said was invalid. :)

Thanks,
Chris.

---

From: Martin Bjorklund <[email-masked]>
Date: Tue, 05 Mar 2019 15:05:01 +0100 (CET)

Christian Hopps <[email-masked]> wrote:
> > -~] should work ... but perhaps that makes unacceptable assumptions
> > -about

Not sure I get it.  What exactly is the suggestion?

> YANG references
> <https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#dt-regex> says
> it will work too (its the range between the UTF code points, which in
> this case are the ascii values), but then that reference is also where
> i got the "#x22" hex format from that Martin said was invalid. :)

But they use the hex form in the grammar that describes XSD, and that
grammar uses EBNF as explained in
https://www.w3.org/TR/2000/WD-xml-2e-20000814.

/martin

> >> The intent was "ascii-printable". Would be nice if there was an easier
> >> way
> >> to specify this. :)
> >>

---

From: William Lupton <[email-masked]>
Date: Tue, 5 Mar 2019 15:03:52 +0000

> Not sure I get it.  What exactly is the suggestion?

Presumably the suggestion of using the [ -~] ("space through tilde")
closure. I forgot to include other whitespace characters (CR, LF, FF) so if
those are to be included it could be [\s!-~] ("whitespace plus exclamation
mark through tilde").

---

From: Martin Bjorklund <[email-masked]>
Date: Tue, 05 Mar 2019 16:33:27 +0100 (CET)

> Presumably the suggestion of using the [ -~] ("space through tilde")

Aha, ok, this is better!

/martin

---

From: Christian Hopps <[email-masked]>
Date: Tue, 05 Mar 2019 14:02:22 -0500

> those are to be included it could be [\s!-~] ("whitespace plus exclamation

I mis-poke earlier, it's all printable lowercase ASCII.

I'm going to use the pattern: '[ -@\[-\^_-~]*'

These 3 ranges seem to make pyang happy. I don't know why I need to break up the second range into 2 adjacent ranges like that to make pyang not complain, but complain it does if I just use: '[ -@\[-~]*'

Thanks,
Chris.