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

Martin Bjorklund <mbj@tail-f.com> Sun, 04 January 2015 10:09 UTC

Return-Path: <mbj@tail-f.com>
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 187E41A7033 for <netmod@ietfa.amsl.com>; Sun, 4 Jan 2015 02:09:22 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.911
X-Spam-Level:
X-Spam-Status: No, score=-1.911 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=ham
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 Drw_WoV9rJd7 for <netmod@ietfa.amsl.com>; Sun, 4 Jan 2015 02:09:20 -0800 (PST)
Received: from mail.tail-f.com (mail.tail-f.com [83.241.162.140]) by ietfa.amsl.com (Postfix) with ESMTP id 577811A7028 for <netmod@ietf.org>; Sun, 4 Jan 2015 02:09:20 -0800 (PST)
Received: from localhost (unknown [193.13.112.215]) by mail.tail-f.com (Postfix) with ESMTPSA id B76571280056; Sun, 4 Jan 2015 11:09:16 +0100 (CET)
Date: Sun, 04 Jan 2015 11:09:16 +0100
Message-Id: <20150104.110916.325563256712417030.mbj@tail-f.com>
To: andy@yumaworks.com
From: Martin Bjorklund <mbj@tail-f.com>
In-Reply-To: <CABCOCHS=4_9QVf5wB8XPS5VEXJe9axUDMmrsZ2-tWKiTJmRmWQ@mail.gmail.com>
References: <CABCOCHTPQeiB4g2g+-YiGpMZLFxr+4tq5SdOvb3N=ne3jJsC0Q@mail.gmail.com> <20150102.173921.2068884682648761059.mbj@tail-f.com> <CABCOCHS=4_9QVf5wB8XPS5VEXJe9axUDMmrsZ2-tWKiTJmRmWQ@mail.gmail.com>
X-Mailer: Mew version 6.5 on Emacs 24.3 / Mule 6.0 (HANACHIRUSATO)
Mime-Version: 1.0
Content-Type: Text/Plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Archived-At: http://mailarchive.ietf.org/arch/msg/netmod/O30798Of9VYmdAFU6uxoeqEs_DA
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 10:09:22 -0000

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.

    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.

    (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.

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

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


(*) one interesting case is Y07 combined with Y09, for example:

  list address {
    key "ip vrf";
    leaf ip { ... }
    leaf vrf {
      if-feature vrf;
      mandatory false;
      ...
    }
    ...
  }

(**)

  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