Re: [netmod] 'Namespace Qualified' in draft-ietf-netmod-yang-json-08
Rob Shakir <rjs@rob.sh> Fri, 11 March 2016 23:40 UTC
Return-Path: <rjs@rob.sh>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 5B38D12DD87 for <netmod@ietfa.amsl.com>; Fri, 11 Mar 2016 15:40:13 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RP_MATCHES_RCVD=-0.001] autolearn=ham autolearn_force=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 gpZpagjayzk1 for <netmod@ietfa.amsl.com>; Fri, 11 Mar 2016 15:40:10 -0800 (PST)
Received: from cappuccino.rob.sh (cappuccino.rob.sh [IPv6:2a03:9800:10:4c::cafe:b00c]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 2529312DD93 for <netmod@ietf.org>; Fri, 11 Mar 2016 15:40:08 -0800 (PST)
Received: from [166.170.46.50] (helo=latte) by cappuccino.rob.sh with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from <rjs@rob.sh>) id 1aeWeq-0004ZM-2l; Fri, 11 Mar 2016 23:39:48 +0000
Date: Fri, 11 Mar 2016 16:40:01 -0700
From: Rob Shakir <rjs@rob.sh>
To: Ladislav Lhotka <lhotka@nic.cz>, netmod@ietf.org
Message-ID: <etPan.56e35751.4a824c47.8142@rob.sh>
In-Reply-To: <m2fuw6fnyf.fsf@birdie.labs.nic.cz>
References: <etPan.56d8bd53.6af84958.11a@latte> <m2fuw6fnyf.fsf@birdie.labs.nic.cz>
X-Mailer: Airmail Beta (352)
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="56e35751_2bd8925_8142"
Archived-At: <http://mailarchive.ietf.org/arch/msg/netmod/JiDHrrnyplAxZJ72yk9IxkKgksA>
Subject: Re: [netmod] 'Namespace Qualified' in draft-ietf-netmod-yang-json-08
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.17
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: <https://mailarchive.ietf.org/arch/browse/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: Fri, 11 Mar 2016 23:40:13 -0000
Thanks Lada and others for the responses here. Much clearer to me. r. On 4 March, 2016 at 5:05:03 AM, Ladislav Lhotka (lhotka@nic.cz) wrote: Hi Rob, Rob Shakir <rjs@rob.sh> writes: > Hi NETMOD, > > I am in the process of implementing draft-ietf-netmod-yang-json–08, and had some queries as to the content. Hopefully there is some misunderstanding on my part, or it helps to clean up the text for future people reviewing/implementing. > > The phrase ‘namespace-qualified’ seems to have some ambiguity through the document. For example, in the case that we have two modules: > > module mod-a { > prefix "pfx-a"; > namespace "http://a.tld"; > > container container-a { > leaf leaf-a { > type string; > } > > leaf ref-a { > type identityref { > base SOME_IDENTITY; > } > } > } > } > > module mod-b { > prefix "pfx-b"; > namespace "http://b.tld"; > > container container-b { > leaf leaf-b { > type string; > } > > leaf ref-b { > type identityref { > base SOME_IDENTITY; > } > } > } > } > Then, AIUI, the encoding needs to specify the names of the modules for > both container-a and container-b (since they sit at the > root; and are in different namespaces) - so we encode > these as JSON objects named mod-a:container-a and > mod-b:container-b as per Section 4 of the document. Correct. > > In this case, we never use the actual namespace (i.e., http://a.tld > and http://b.tld) so calling it ‘namespace qualified’ appears > ambiguous. Should it be simply referred to as ‘module-qualified’? Namespaces (= sets of names) as defined by YANG are encoding-independent. However, XML and JSON use different namespace identifiers. XML uses naturally the mechanism of [XML-NAMES], i.e. namespace URIs and references via declared prefixes. JSON in general doesn't support namespaced member names, but we could conveniently use the module name as the namespace identifier. So this is what Sec. 4 defines: The name of a module determines the namespace of all data node names defined in that module. If a data node is defined in a submodule, then the namespace-qualified member name uses the name of the main module to which the submodule belongs. This is then later extended to other named entities such as identities. > > Secondarily, the example in Section 6.8 does not actually use the name > of the module, it rather uses the prefix (if for the interface-type > leaf). This doesn’t seem to be explained anywhere within the text. Is > this a mistake? No, it's correct. YANG adopted the XML namespace rules, so declared prefixes are used in YANG modules. The JSON-encoded name of the identity uses the rules of the yang-json document, i.e. module name as the namespace identifier. > It seems to me that using the module name consistently throughout the > encoding is preferable, since this cannot be different in a number of > places; and isn’t as long as the namespace value to make readability > worse. Module name is used consistently in JSON encoding, but we have to use YANG rules when dealing with YANG modules. It is somewhat confusing but I believe this is the best solution we could come up with. > > I also didn’t understand why an identityref value encodes the > namespace in the actual value? It seems like the “base” of the > identityref should qualify all possible values here; with the only > case that we would ever need this is one where we have: I think Per explained this part nicely. Thanks, Lada > > leaf some-reference { > type union { > type identityref { > base "a"; > } > type identityref { > base "b"; > } > } > } > And a and b both define a value with the same name (where one needs the prefix to be able to refer to the b version). > > Thanks, > r. > _______________________________________________ > netmod mailing list > netmod@ietf.org > https://www.ietf.org/mailman/listinfo/netmod -- Ladislav Lhotka, CZ.NIC Labs PGP Key ID: E74E8C0C
- [netmod] 'Namespace Qualified' in draft-ietf-netm… Rob Shakir
- Re: [netmod] 'Namespace Qualified' in draft-ietf-… Kent Watsen
- Re: [netmod] 'Namespace Qualified' in draft-ietf-… Rob Shakir
- Re: [netmod] 'Namespace Qualified' in draft-ietf-… Per Hedeland
- Re: [netmod] 'Namespace Qualified' in draft-ietf-… Ladislav Lhotka
- Re: [netmod] 'Namespace Qualified' in draft-ietf-… Rob Shakir