Re: [netmod] Questions about namings and prefixes in leafrefs
Ladislav Lhotka <lhotka@nic.cz> Thu, 22 January 2015 13:07 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 324D31ACC8D for <netmod@ietfa.amsl.com>; Thu, 22 Jan 2015 05:07:10 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.3
X-Spam-Level:
X-Spam-Status: No, score=-1.3 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, J_CHICKENPOX_44=0.6] 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 SOOdWsz3r4Ez for <netmod@ietfa.amsl.com>; Thu, 22 Jan 2015 05:07:08 -0800 (PST)
Received: from trail.lhotka.name (trail.lhotka.name [77.48.224.143]) by ietfa.amsl.com (Postfix) with ESMTP id B90641ACC8F for <netmod@ietf.org>; Thu, 22 Jan 2015 05:07:07 -0800 (PST)
Received: from localhost (unknown [195.113.220.110]) by trail.lhotka.name (Postfix) with ESMTPSA id 2FD161CC0604; Thu, 22 Jan 2015 14:07:09 +0100 (CET)
From: Ladislav Lhotka <lhotka@nic.cz>
To: Paul Borman <borman@google.com>, netmod@ietf.org
In-Reply-To: <CAHsVM3=n5fRUmN4MBs01b3kvNXD2WMt4E6FbcpowRYsHM8pE_w@mail.gmail.com>
References: <CAHsVM3=n5fRUmN4MBs01b3kvNXD2WMt4E6FbcpowRYsHM8pE_w@mail.gmail.com>
User-Agent: Notmuch/0.18.1 (http://notmuchmail.org) Emacs/24.4.51.2 (x86_64-apple-darwin14.0.0)
Date: Thu, 22 Jan 2015 14:07:05 +0100
Message-ID: <m2ppa7m0au.fsf@nic.cz>
MIME-Version: 1.0
Content-Type: text/plain
Archived-At: <http://mailarchive.ietf.org/arch/msg/netmod/fuMkaHVW8H0jJYwLzm7KNhr3Ov0>
Subject: Re: [netmod] Questions about namings and prefixes in leafrefs
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: Thu, 22 Jan 2015 13:07:10 -0000
Hi Paul, Paul Borman <borman@google.com> writes: > Hi, I am trying to understand RFC6020 without having had the benefit of > being in any of the discussions of the working group. I have found the > discussion of path names unclear so I have used pyang to try and understand > what is expected. It seems to me that a path in a leafref: > > - may descend into submodule's containers yes > - may descend into used groupings, no matter where the grouping is > defined yes > - may *not* ascend into the parent module Actually, I am not sure about this one. > - may optionally use the module's prefix for any element in a leafref > path, no matter where the element is defined The prefix has to be present if the node is defined in another module. For example, a leafref in "base" pointing to "other-container-leaf1" would have path "/bother:other-container/bother:other-container-leaf1"; > - may optionally use the belongs-to-prefix in elements in paths inside a > submodule yes > - may *never* use the prefix for/from an imported module It must *always* use it. > > Some questions this raise are: > > - are these observations correct (and intended)? > - is there ever a time where a prefix is required in a leafref > path? Yes, see above. I hope submodule rules will be significantly simplified in YANG 1.1, see issue Y49: https://svn.tools.ietf.org/svn/wg/netmod/yang-1.1/issues.html#sec-50 ... > > I am also trying to understand the prefixes used in XPath representations. > I have tried using --tree-prefix but that does not appear to accept any > prefixes. The "tree" plugin has no such option, RTFM. > // These next two ar invalid > leaf base-container-badref1 { > type leafref { path > ../other-group-container/bother:other-group-container-leaf1; } The prefix "bother" is wrong. It is because YANG groupings are "chameleons": nodes defined in a grouping receive the namespace of the module where the grouping is used, not the one in which it is defined. Sec sec. 7.12 in RFC 6020. Lada > } > leaf base-container-badref2 { > type leafref { path > ../other-group-container/pother:other-group-container-leaf1; } > } > } > } > > // included by base.yang. > submodule sub { > belongs-to base { prefix "sbase"; } > container sub-container { > leaf sub-container-leaf { type string; } > container subsub { > leaf sub-leafref { > type leafref { path ../../sub-container-leaf; } > } > leaf sub-leafref1 { > type leafref { path ../../sbase:sub-container-leaf; } > } > // the next two both fail trying to ascend into the parent > leaf sub-badref2 { > type leafref { path ../../../base-container/base-container-leaf; } > } > leaf sub-badref3 { > type leafref { path > ../../../sbase:base-container/base-container-leaf; } > } > } > } > grouping sub-group { > container sub-group-container { > leaf sub-group-leaf { type string; } > } > } > } > > // imported by base.yang. > module other { > namespace "uri:empty"; > prefix "otherp"; > container other-container { > leaf other-container-leaf1 { type string; } > leaf other-container-leaf2 { type string; } > } > grouping other-group { > leaf other-group-leaf { type string; } > container other-group-container { > leaf other-group-container-leaf1 { type string; } > leaf other-group-container-leaf2 { type string; } > } > } > } > _______________________________________________ > netmod mailing list > netmod@ietf.org > https://www.ietf.org/mailman/listinfo/netmod -- Ladislav Lhotka, CZ.NIC Labs PGP Key ID: E74E8C0C
- [netmod] Questions about namings and prefixes in … Paul Borman
- Re: [netmod] Questions about namings and prefixes… Ladislav Lhotka
- Re: [netmod] Questions about namings and prefixes… Paul Borman
- Re: [netmod] Questions about namings and prefixes… Ladislav Lhotka
- Re: [netmod] Questions about namings and prefixes… Paul Borman