Re: [YANG] deep keys and unique statements

Ladislav Lhotka <lhotka@cesnet.cz> Mon, 21 January 2008 09:06 UTC

Return-path: <yang-bounces@ietf.org>
Received: from [127.0.0.1] (helo=stiedprmman1.va.neustar.com) by megatron.ietf.org with esmtp (Exim 4.43) id 1JGsbR-0004L0-LQ; Mon, 21 Jan 2008 04:06:01 -0500
Received: from yang by megatron.ietf.org with local (Exim 4.43) id 1JGsbQ-0004Ku-7H for yang-confirm+ok@megatron.ietf.org; Mon, 21 Jan 2008 04:06:00 -0500
Received: from [10.90.34.44] (helo=chiedprmail1.ietf.org) by megatron.ietf.org with esmtp (Exim 4.43) id 1JGsbG-0003mp-NE for yang@ietf.org; Mon, 21 Jan 2008 04:05:50 -0500
Received: from office2.cesnet.cz ([195.113.144.244]) by chiedprmail1.ietf.org with esmtp (Exim 4.43) id 1JGsbG-0007Id-2I for yang@ietf.org; Mon, 21 Jan 2008 04:05:50 -0500
Received: from [172.29.2.201] (asus-gx.lhotka.cesnet.cz [195.113.161.161]) by office2.cesnet.cz (Postfix) with ESMTP id 52050D80098 for <yang@ietf.org>; Mon, 21 Jan 2008 10:05:49 +0100 (CET)
Subject: Re: [YANG] deep keys and unique statements
From: Ladislav Lhotka <lhotka@cesnet.cz>
To: yang <yang@ietf.org>
In-Reply-To: <4790D279.3070804@andybierman.com>
References: <4790D279.3070804@andybierman.com>
Content-Type: text/plain; charset=UTF-8
Organization: CESNET
Date: Mon, 21 Jan 2008 10:05:48 +0100
Message-Id: <1200906348.6914.97.camel@missotis>
Mime-Version: 1.0
X-Mailer: Evolution 2.12.1
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Scan-Signature: 287c806b254c6353fcb09ee0e53bbc5e
X-BeenThere: yang@ietf.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: YANG modeling Language for NETCONF <yang.ietf.org>
List-Unsubscribe: <https://www1.ietf.org/mailman/listinfo/yang>, <mailto:yang-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www1.ietf.org/pipermail/yang>
List-Post: <mailto:yang@ietf.org>
List-Help: <mailto:yang-request@ietf.org?subject=help>
List-Subscribe: <https://www1.ietf.org/mailman/listinfo/yang>, <mailto:yang-request@ietf.org?subject=subscribe>
Errors-To: yang-bounces@ietf.org

Andy Bierman píše v Pá 18. 01. 2008 v 08:23 -0800:
> On the other hand, the unique-stmt allows arbitrary combinations
> of leaf instances anywhere within the list.  The complexity
> built into the unique-stmt is extensive, as even a 2-d table shows:

I am thinking about an alternative "upside-down" implementation of both
key and unique properties, namely to declare these properties with the
leaf. The semantics would be that these properties always pertain to the
nearest ancestor list (if any, otherwise it is noop). Example:

list aaa {
  container bbb {
    leaf c {
      type c-type;
      unique;
    }
  }
}

There are two advantages:
1. The scope of the property - nearest ancestor list - is always unique,
so no XPath expressions are needed here.
2. At the time when the declaration is read the entire ancestor chain is
known, i.e., no buffering is needed.

If I remember correctly, the main objection against this implementation
is that it would be difficult to declare keys a posteriori for standard
groupings, but I think it could be handled by extending the augment
statement, e.g, like this:

module inet-extra {
  ...
  grouping endpoint {
    leaf address {
      type inet:address;
    }
    leaf port {
      type uint16;
    }
  }
  ...

import inet-extra {
  prefix iex;
}

augment "/iex:endpoint/iex:address" {
  key;
}

Lada

  
> 
> 
>    list foo {
>      // all nodes except the key leafs (x, c, d) are optional
>      config true;
>      key x;
>      unique "y bar/a baz/e baz/c";
> 
>      list bar {
>        config false;
>        leaf a { type int32; }
>        leaf b { type string; }
>      }
> 
>      list baz {
>        key "d c";
>        leaf c { type float32; }
>        leaf d { type float64; }
>        leaf e { type binary; }
>      }
> 
>      leaf x { type instance-identifier; }
>      leaf y { type keyref { path "baz/c"; } }
> 
>    }
> 
> 
> The agent has to check all the instances of all the leafs and only
> enforce uniqueness in the entries that are complete.  One missing
> optional leaf, and the entire unique-stmt is ignored instead (for that
> entry).
> 
> Besides this unbounded complexity, it seems very odd for
> the leafs within the nested lists (bar and baz) to have
> uniqueness constraints placed 'from above', since they are
> not required to be unique within the list that defines the leafs.
> 
> It also seems broken that config and non-config leafs can be
> combined in the uniqueness test.  The 'config' and 'unique'
> statements are not relevant in notification data, so is it
> an error or just no-op if they are entered for notification
> data-def-stmts?  (Could be from uses expansion as well.)
> (Note that keyref adds an indirection twist to the complexity.)
> 
> Andy
> 
> 
> 
> 
> _______________________________________________
> YANG mailing list
> YANG@ietf.org
> https://www1.ietf.org/mailman/listinfo/yang
-- 
Ladislav Lhotka, CESNET
PGP Key ID: E74E8C0C



_______________________________________________
YANG mailing list
YANG@ietf.org
https://www1.ietf.org/mailman/listinfo/yang