Re: [YANG] deep keys and unique statements
Martin Bjorklund <mbj@tail-f.com> Mon, 21 January 2008 09:16 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 1JGslJ-0004DA-C1; Mon, 21 Jan 2008 04:16:13 -0500
Received: from yang by megatron.ietf.org with local (Exim 4.43)
id 1JGslI-0004D5-5Q
for yang-confirm+ok@megatron.ietf.org; Mon, 21 Jan 2008 04:16:12 -0500
Received: from [10.90.34.44] (helo=chiedprmail1.ietf.org)
by megatron.ietf.org with esmtp (Exim 4.43) id 1JGslH-0004Cx-Qp
for yang@ietf.org; Mon, 21 Jan 2008 04:16:11 -0500
Received: from [213.180.94.162] (helo=mail.tail-f.com)
by chiedprmail1.ietf.org with esmtp (Exim 4.43) id 1JGslH-0007Xp-6T
for yang@ietf.org; Mon, 21 Jan 2008 04:16:11 -0500
Received: from localhost (138.162.241.83.in-addr.dgcsystems.net
[83.241.162.138])
by mail.tail-f.com (Postfix) with ESMTP id 056D61B80C6;
Mon, 21 Jan 2008 10:16:09 +0100 (CET)
Date: Mon, 21 Jan 2008 10:17:27 +0100 (CET)
Message-Id: <20080121.101727.102844599.mbj@tail-f.com>
To: lhotka@cesnet.cz
Subject: Re: [YANG] deep keys and unique statements
From: Martin Bjorklund <mbj@tail-f.com>
In-Reply-To: <1200906348.6914.97.camel@missotis>
References: <4790D279.3070804@andybierman.com>
<1200906348.6914.97.camel@missotis>
X-Mailer: Mew version 5.1.51 on Emacs 22.1 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
X-Spam-Score: 0.1 (/)
X-Scan-Signature: e1e48a527f609d1be2bc8d8a70eb76cb
Cc: yang@ietf.org
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>
Content-Type: multipart/mixed; boundary="===============1035548993=="
Errors-To: yang-bounces@ietf.org
Ladislav Lhotka <lhotka@cesnet.cz> wrote: > 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; > } > } > } This doesn't work if it is the combination of two leafs that is unique. In this example, the name has to be unique, and also the ip/port combination: list server { key "idx"; unique "ip port"; unique "name"; leaf idx { ... } leaf ip { ... } leaf port { ... } leaf name { ... } } [Side note: In our current DML we took the approach you describe, but in order to handle the combinations, the unique statement took an argument which was a tag. All leafs with the same tag would be checked in combination. I think the YANG statement is more clear.] > 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. I don't understand these advantages. Are you talking about buffering in the compiler? > > 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; > } > } > ... I think it would be the uses refinement that would be used (not augment): list foo { uses iex:endpoint { leaf address { key true; } } } /martin
_______________________________________________ YANG mailing list YANG@ietf.org https://www1.ietf.org/mailman/listinfo/yang
- [YANG] deep keys and unique statements Andy Bierman
- Re: [YANG] deep keys and unique statements Ladislav Lhotka
- Re: [YANG] deep keys and unique statements Martin Bjorklund
- Re: [YANG] deep keys and unique statements Ladislav Lhotka