Re: [netmod] Y07: do not allow when or if-feature on key

Ladislav Lhotka <lhotka@nic.cz> Sun, 04 January 2015 11:53 UTC

Return-Path: <lhotka@nic.cz>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 6A6F41A879B for <netmod@ietfa.amsl.com>; Sun, 4 Jan 2015 03:53:18 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.361
X-Spam-Level:
X-Spam-Status: No, score=-0.361 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HELO_EQ_CZ=0.445, HOST_EQ_CZ=0.904, MIME_8BIT_HEADER=0.3, T_RP_MATCHES_RCVD=-0.01] autolearn=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 pGVEFS78bGo0 for <netmod@ietfa.amsl.com>; Sun, 4 Jan 2015 03:53:16 -0800 (PST)
Received: from mail.nic.cz (mail.nic.cz [IPv6:2001:1488:800:400::400]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 1ABCD1A8710 for <netmod@ietf.org>; Sun, 4 Jan 2015 03:53:16 -0800 (PST)
Received: from [IPv6:2a01:5e0:29:ffff:194e:bfc7:73a6:5ef] (unknown [IPv6:2a01:5e0:29:ffff:194e:bfc7:73a6:5ef]) by mail.nic.cz (Postfix) with ESMTPSA id 9D22113F7AF; Sun, 4 Jan 2015 12:53:14 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=nic.cz; s=default; t=1420372394; bh=X1MZA/AY0ccL14O4+Z/K6+BEBDke7BWUaIEYxPMTzqA=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Content-Transfer-Encoding:Message-Id:References:To; b=KCNlqf1dI0l/3VyovG0hKPVZ4KYmaihJd6+VMQAL7wSLmS9bniHpbhvaXs0AgpGKM yfOyyLmoakbWbaxhXFg8kupJ9fhM8yPq6DTF2Zmr9VjA0QDcTue9aYza85S9TA37RJ wUjLdUSmEUKsI7dSb+5IcxIxzwPXURdH7vrUNji4=
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\))
From: Ladislav Lhotka <lhotka@nic.cz>
In-Reply-To: <20150104.110916.325563256712417030.mbj@tail-f.com>
Date: Sun, 04 Jan 2015 12:53:11 +0100
Content-Transfer-Encoding: quoted-printable
Message-Id: <70150F84-5C10-42D8-BF78-76E0A3CF0F6C@nic.cz>
References: <CABCOCHTPQeiB4g2g+-YiGpMZLFxr+4tq5SdOvb3N=ne3jJsC0Q@mail.gmail.com> <20150102.173921.2068884682648761059.mbj@tail-f.com> <CABCOCHS=4_9QVf5wB8XPS5VEXJe9axUDMmrsZ2-tWKiTJmRmWQ@mail.gmail.com> <20150104.110916.325563256712417030.mbj@tail-f.com>
To: Martin Björklund <mbj@tail-f.com>
X-Mailer: Apple Mail (2.1993)
X-Virus-Scanned: clamav-milter 0.98.1 at mail
X-Virus-Status: Clean
Archived-At: http://mailarchive.ietf.org/arch/msg/netmod/qrxWRFcZiT2vluZTA7JTbmtDk70
Cc: netmod@ietf.org
Subject: Re: [netmod] Y07: do not allow when or if-feature on key
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.15
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: <http://www.ietf.org/mail-archive/web/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: Sun, 04 Jan 2015 11:53:18 -0000

> On 04 Jan 2015, at 11:09, Martin Bjorklund <mbj@tail-f.com> wrote:
> 
> Andy Bierman <andy@yumaworks.com> wrote:
>> On Fri, Jan 2, 2015 at 8:39 AM, Martin Bjorklund <mbj@tail-f.com> wrote:
>>> Andy Bierman <andy@yumaworks.com> wrote:
> 
> [...]
> 
>>>> I agree that it is not feasible for a tool to compare XPath statements
>>>> with different context nodes to see if they always produce the
>>>> same results.  But it is easy to check if the feature-stmts are the same
>>>> or less than the parent.
> 
> This is exactly the problem that I tried to describe orginally in this
> email thread.
> 
> The current approach to Y07 is to say that it is ok to have
> if-feature/when on key leafs, as long as they are the same as the
> parent list node.  This sounds simple, but my point is - and it seems
> you agree - that it is not simple.  For boolean expressions in
> if-feature it is doable, but for XPath expressions in when it is not.
> 
> So how do we solve this?
> 
> First of all, this is mostly an issue w/ using leafs defined in a
> groping as a key in a list.  If the key leaf is defined "inline", it
> is not necessary to allow if-feature/when on the key leaf (*).
> 
> 1.  Require the expression to be *exactly* the same string, including
>    whitespaces.

This could possibly work only for a small subset of XPath expressions because of different context nodes. Also, it would be extremely brittle.

> 
>    There are some corner cases where some groupings cannot be used in
>    this case (**).
> 
> 2.  Require the expression to be logically the same - but this is
>    difficult and will probably lead to tools not checking this.

Yes.

> 
>    (Or rather, the expression on the list can be more restrictive
>    than the expression on the key; even more difficult to check.)
> 
> 3.  Ignore the if-feature/when on the key leaf.  This is possibly
>    confusing.

A “default” statement on a key is also ignored.

> 
> 4.  Make if-feature/when on the key leaf illegal.  This means that
>    certain groupings cannot be used.

… and makes some 1.0 modules illegal.

> 
> 5.  Have different rules for if-feature and when.

This is IMO too complicated given that such cases should be quite rare.

> 
> 
> (*) one interesting case is Y07 combined with Y09, for example:
> 
>  list address {
>    key "ip vrf";
>    leaf ip { ... }
>    leaf vrf {
>      if-feature vrf;
>      mandatory false;
>      ...
>    }
>    ...
>  }

This actually makes a good sense and should be allowed if Y09 makes it into 1.1.

Lada

> 
> (**)
> 
>  grouping a {
>    leaf a {
>      when "/properties/a":
>      ...
>    }
>  }
> 
>  grouping b {
>    leaf b {
>      when "/properties/b":
>      ...
>    }
>  }
> 
>  list x {
>    when "/properties/a and /properties/b";
>    key "a b";
>    uses a;
>    uses b;
>  }
> 
> 
>>> I think Lada's suggestion was to ignore if-feature/when b/c of
>>> backwards compatibility reasons.
>>> 
>>> This would be legal in 1.1, if we say that we ignore the if-feature:
>>> 
>>>  list y {
>>>    if-feature "bar";
>>>    key "a b";
>>>    uses x;
>>>    leaf b {
>>>      type string;
>>>    }
>>>  }
>>> 
>>> 
>> 
>> This is legal now -- our tools support it and check for key leafs
>> that are more conditional than their parent.
> 
> But this behavior isn't specified in RFC 6020 - and this is the
> problem that we want to solve.
> 
> 
> /martin
> 
> 
> 

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