Re: [netmod] Pattern statements [was Re: Query about augmenting module from submodule in YANG 1.0]

Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de> Wed, 23 August 2017 13:37 UTC

Return-Path: <j.schoenwaelder@jacobs-university.de>
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 76283132C12 for <netmod@ietfa.amsl.com>; Wed, 23 Aug 2017 06:37:01 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level:
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
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 E9R7Gv8OLQmR for <netmod@ietfa.amsl.com>; Wed, 23 Aug 2017 06:36:59 -0700 (PDT)
Received: from atlas5.jacobs-university.de (atlas5.jacobs-university.de [212.201.44.20]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 6ECB2132518 for <netmod@ietf.org>; Wed, 23 Aug 2017 06:36:59 -0700 (PDT)
Received: from localhost (demetrius5.irc-it.jacobs-university.de [10.70.0.222]) by atlas5.jacobs-university.de (Postfix) with ESMTP id 3F2E73C; Wed, 23 Aug 2017 15:36:58 +0200 (CEST)
X-Virus-Scanned: amavisd-new at jacobs-university.de
Received: from atlas5.jacobs-university.de ([10.70.0.217]) by localhost (demetrius5.jacobs-university.de [10.70.0.222]) (amavisd-new, port 10032) with ESMTP id erXAH9V8XqqN; Wed, 23 Aug 2017 15:36:57 +0200 (CEST)
Received: from hermes.jacobs-university.de (hermes.jacobs-university.de [212.201.44.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "hermes.jacobs-university.de", Issuer "Jacobs University CA - G01" (verified OK)) by atlas5.jacobs-university.de (Postfix) with ESMTPS; Wed, 23 Aug 2017 15:36:58 +0200 (CEST)
Received: from localhost (demetrius3.jacobs-university.de [212.201.44.48]) by hermes.jacobs-university.de (Postfix) with ESMTP id 1D702200E2; Wed, 23 Aug 2017 15:36:58 +0200 (CEST)
X-Virus-Scanned: amavisd-new at jacobs-university.de
Received: from hermes.jacobs-university.de ([212.201.44.23]) by localhost (demetrius3.jacobs-university.de [212.201.44.32]) (amavisd-new, port 10024) with ESMTP id GctgnEKS9HHj; Wed, 23 Aug 2017 15:36:57 +0200 (CEST)
Received: from elstar.local (elstar.jacobs.jacobs-university.de [10.50.231.133]) by hermes.jacobs-university.de (Postfix) with ESMTP id B5344200E0; Wed, 23 Aug 2017 15:36:57 +0200 (CEST)
Received: by elstar.local (Postfix, from userid 501) id 931F94049A07; Wed, 23 Aug 2017 15:36:57 +0200 (CEST)
Date: Wed, 23 Aug 2017 15:36:57 +0200
From: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
To: Robert Wilton <rwilton@cisco.com>
Cc: Vladimir Vassilev <vladimir@transpacket.com>, "netmod@ietf.org" <netmod@ietf.org>
Message-ID: <20170823133657.76s5wbcxbpgjfkiy@elstar.local>
Reply-To: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
Mail-Followup-To: Robert Wilton <rwilton@cisco.com>, Vladimir Vassilev <vladimir@transpacket.com>, "netmod@ietf.org" <netmod@ietf.org>
References: <E3378E0605547F4E854DEE0CB1116AB0210631@gbcdcmbx03.intl.att.com> <defe35bb-bb8b-f1f0-d8c4-2d2d0f23731b@transpacket.com> <1502290869.16638.15.camel@nic.cz> <20170809151312.GC42207@elstar.local> <6ef68131-f731-0edc-b731-d7ec85924f03@cisco.com> <E3378E0605547F4E854DEE0CB1116AB021CE2D@gbcdcmbx03.intl.att.com> <D5C05EB3.C2681%acee@cisco.com> <7614040f-9f8f-09c2-1854-63ad9ffb6be1@cisco.com> <5929631c-e51d-ae66-52d1-cbc87ca3506b@transpacket.com> <321a45fb-77e1-23c7-184b-d3bff9d41c39@cisco.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <321a45fb-77e1-23c7-184b-d3bff9d41c39@cisco.com>
User-Agent: NeoMutt/20170714 (1.8.3)
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/FkYpvBNgDHuXIdgybxGLQHzxWkc>
Subject: Re: [netmod] Pattern statements [was Re: Query about augmenting module from submodule in YANG 1.0]
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.22
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, 23 Aug 2017 13:37:01 -0000

On Wed, Aug 23, 2017 at 02:23:12PM +0100, Robert Wilton wrote:
> 
> 1) Email address.  I understand that the full regex to validate all email
> addresses is very complex, but checking that it at least contains an @
> symbol still has benefit.  It would seem that a short imperfect regex is
> better than a complete perfect regex.

What is your definition of 'better'? A stricter pattern catches more
errors. An imperfect pattern is better than none.

> 2) A list of VLAN ranges, e.g. want to allow strings that look like this:
> "1-10,20-400,600,2000-3000", but only with non overlapping values in
> ascending order.  It is easy to write a regex to check that the structure is
> right, but AFAIK it is hard (impossible?) to write a regex that ensures that
> the ranges don't overlap and are specified in ascending order.

So what. Does this provide a helpful argument whether patterns should
be strict or imperfect?

> So, I propose that we use regexes for checking that the string is
> structurally correct, but don't use regexes to perform numerical range
> checks of string encoded numbers, since it makes the regexes hard to
> read/verify, and doesn't improve the readability of the YANG file either.

So here is the point I think:

   It is desirable that regexes are as strict as they can be.
   However, if regexes become so complicated that they become a
   verification and maintenance problem by themself, then less strict
   regexes may be a better choice.

/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/>