Re: [netmod] regular expression flavours (again)

Ladislav Lhotka <lhotka@nic.cz> Wed, 12 June 2019 11:01 UTC

Return-Path: <lhotka@nic.cz>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 0F93B120026 for <netmod@ietfa.amsl.com>; Wed, 12 Jun 2019 04:01:41 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.998
X-Spam-Level:
X-Spam-Status: No, score=-6.998 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_NONE=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=nic.cz
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sssJ-AcZRCIS for <netmod@ietfa.amsl.com>; Wed, 12 Jun 2019 04:01:39 -0700 (PDT)
Received: from mail.nic.cz (mail.nic.cz [217.31.204.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id BA68D12008D for <netmod@ietf.org>; Wed, 12 Jun 2019 04:01:38 -0700 (PDT)
Received: from birdie (unknown [IPv6:2001:718:1a02:1::380]) by mail.nic.cz (Postfix) with ESMTPSA id 439B5140C32 for <netmod@ietf.org>; Wed, 12 Jun 2019 13:01:35 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1560337295; bh=1bBDrglNwgmpLHxLDWT3pvki0cC5HnWXh4Tu0zHcamw=; h=From:To:Date; b=XO4oToj4/oZmvYXJbO2mlEVgtTMDaJ/4js/eOYJAK5U/RttFU2xpdctLTxwCgrhFK mOfASb27FjVVbGg1Z9RNEiqjb/nbors0039z7ivnafINwZDkTIwDHSXxkcgE49YJPp xMVmy8hk6cgDMCcfCz8anPEOB/OMLc1ylteA1fio=
Message-ID: <bc8780147297b30893ca6f2d83ddf07bffde89e0.camel@nic.cz>
From: Ladislav Lhotka <lhotka@nic.cz>
To: NETMOD WG <netmod@ietf.org>
Date: Wed, 12 Jun 2019 13:01:35 +0200
In-Reply-To: <BYAPR11MB26310B96E28B846081615F50B5EC0@BYAPR11MB2631.namprd11.prod.outlook.com>
References: <291106e34498ebd68f26bf9ff9b679dd5bd8f0cd.camel@nic.cz> <BYAPR11MB26316E09A62C11012CAFDA15B5EC0@BYAPR11MB2631.namprd11.prod.outlook.com> <d11c243ec323610a3179d06fe9b594c9b4d548d8.camel@nic.cz> <BYAPR11MB26310B96E28B846081615F50B5EC0@BYAPR11MB2631.namprd11.prod.outlook.com>
Organization: CZ.NIC
Content-Type: text/plain; charset="UTF-8"
User-Agent: Evolution 3.32.2
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Virus-Scanned: clamav-milter 0.100.3 at mail.nic.cz
X-Virus-Status: Clean
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/sW61ObenHtUdaaye2JSHQ6JvvuE>
Subject: Re: [netmod] regular expression flavours (again)
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 12 Jun 2019 11:01:41 -0000

On Wed, 2019-06-12 at 09:53 +0000, Rob Wilton (rwilton) wrote:
> Hi Lada,
> 
> > -----Original Message-----
> > From: Ladislav Lhotka <lhotka@nic.cz>
> > Sent: 12 June 2019 10:40
> > To: Rob Wilton (rwilton) <rwilton@cisco.com>; NETMOD WG <netmod@ietf.org>
> > Subject: Re: [netmod] regular expression flavours (again)
> > 
> > Hi Rob,
> > 
> > On Wed, 2019-06-12 at 09:25 +0000, Rob Wilton (rwilton) wrote:
> > > Hi Lada,
> > > 
> > > OpenConfig have already introduced a module level extension statement
> > > to indicate that their pattern statements use POSIX regular expressions.
> > 
> > What I meant was rather something like
> > 
> >     pattern-language "POSIX";
> > 
> 
> But depending on how many pattern languages are supported, wouldn’t that make
> implementing YANG a lot harder, since implementations would need to support
> all the allowed pattern languages?

Not necessarily, implementors should be able decide which flavours to support.
So OpenConfig would be a niche that uses POSIX, and they have to use tools that
support it.

The real problem here is that they use an extension for changing the semantics
of a built-in YANG statement, which is IMO not permitted by RFC 7950 and causes
implementations to break without warning, or even opens security holes. If it
was a critical extension, and I didn't want to implement the POSIX flavour, my
implementation should be able to notice it and say "Sorry, I can't work with
this module".

> Also, IIRC, POSIX regex doesn't support unicode, which means that it isn't
> necessarily a good choice for a language that does support unicode strings by
> default.

Yes, this has also been discussed previously. I am not advocating POSIX in
favour of XSD, I just want to guarantee that YANG tools can be made so as to
behave predictably and safely. We cannot expect YANG BFUs to understand the dog-
fighting between NETMOD and OpenConfig.

> 
> > with the default being "XSD". It could possibly also include your proposal
> > of XSD regex subset (issue #21).
> 
> Really my aim was the other way around.  I.e. have all YANG pattern statements
> in just one simple regex language that could trivially be converted to run on
> any common regex engine.

I understand this, but I think the full XSD pattern language has to remain an
option.

Lada

> 
> > This could in fact be a good candidate for a critical extension.
> > 
> > >   extension regexp-posix {
> > >      description
> > >       "This extension indicates that the regular expressions included
> > >       within the YANG module specified are conformant with the POSIX
> > >       regular expression format rather than the W3C standard that is
> > >       specified by RFC6020 and RFC7950.";
> > >   }
> > > 
> > > Defined in
> > > https://github.com/openconfig/public/blob/master/release/models/openco
> > > nfig-extensions.yang
> > > 
> > > I don't think that this should become part of the YANG standard.
> > 
> > I suspect that developers of YANG tools are being pushed by users to
> > include support for this anyway, so I don't see much benefit from blocking
> > it.
> 
> I don't see this as blocking it at all, but rather that a pragmatic common
> solution already exists without requiring any standardization work.
> 
> Thanks,
> Rob
> 
> 
> > Lada
> > 
> > > Thanks,
> > > Rob
> > > 
> > > 
> > > > -----Original Message-----
> > > > From: netmod <netmod-bounces@ietf.org> On Behalf Of Ladislav Lhotka
> > > > Sent: 12 June 2019 09:02
> > > > To: NETMOD WG <netmod@ietf.org>
> > > > Subject: [netmod] regular expression flavours (again)
> > > > 
> > > > Hi,
> > > > 
> > > > I think it is very unfortunate that OpenConfig folks use POSIX
> > > > regular expressions instead of XSD. This of course causes confusion,
> > > > see e.g. this
> > > > PR:
> > > > 
> > > > https://github.com/CZ-NIC/yangson/pull/22
> > > > 
> > > > Given the popularity of OpenConfig models, it seems to me that it
> > > > would be better if YANG somehow accomodates such (largely cosmetic)
> > differences.
> > > > One option would be that each YANG module declares the regex flavour
> > > > used in its patterns. Yes, it is a complication, but having separate
> > > > forks of YANG is much worse.
> > > > 
> > > > ISO Schematron adopted a similar approach with "query language
> > binding"
> > > > that can be declared with the schema element, for example
> > > > 
> > > > <schema xmlns="http://purl.oclc.org/dsdl/schematron"
> > > > queryBinding="exslt">
> > > > 
> > > > Any thoughts on this?
> > > > 
> > > > Lada
> > > > 
> > > > --
> > > > Ladislav Lhotka
> > > > Head, CZ.NIC Labs
> > > > PGP Key ID: 0xB8F92B08A9F76C67
> > > > 
> > > > _______________________________________________
> > > > netmod mailing list
> > > > netmod@ietf.org
> > > > https://www.ietf.org/mailman/listinfo/netmod
> > --
> > Ladislav Lhotka
> > Head, CZ.NIC Labs
> > PGP Key ID: 0xB8F92B08A9F76C67
-- 
Ladislav Lhotka
Head, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67