Re: [netmod] xpath expressions in JSON

Ladislav Lhotka <lhotka@nic.cz> Thu, 18 October 2018 10:55 UTC

Return-Path: <lhotka@nic.cz>
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 47C9112D4E9 for <netmod@ietfa.amsl.com>; Thu, 18 Oct 2018 03:55:41 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7
X-Spam-Level:
X-Spam-Status: No, score=-7 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_HI=-5] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=nic.cz
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 Jb6J7TetFV7A for <netmod@ietfa.amsl.com>; Thu, 18 Oct 2018 03:55:38 -0700 (PDT)
Received: from mail.nic.cz (mail.nic.cz [IPv6:2001:1488:800:400::400]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 5563112D4F1 for <netmod@ietf.org>; Thu, 18 Oct 2018 03:55:38 -0700 (PDT)
Received: from birdie (unknown [IPv6:2001:1488:fffe:6:1f99:257b:62cc:c0d5]) by mail.nic.cz (Postfix) with ESMTPSA id 99169621B1 for <netmod@ietf.org>; Thu, 18 Oct 2018 12:55:36 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1539860136; bh=Q/p711IAL4Y55qFCuiFvUHFnlSYfgDnE59FeAMfRhCs=; h=From:To:Date; b=OOaKw7yrbPloxbNTE2QO/py/i9MPbBW0xYXGqDMD2seg7JroXDX9fEyPAuz5jIW0k E6GZ+TZPSe2GZ54WXusxofIoRjEaUEhDMekJY4mFO86LAZIavXSqmTDl2tjILXc74c 5fKZgDd8kDdQqIxtDW1Gag+qyVrGwiBm3ClAMcoM=
Message-ID: <0939cd18e7c9a8e91497a1d6e91279b9a2e1a35f.camel@nic.cz>
From: Ladislav Lhotka <lhotka@nic.cz>
To: netmod@ietf.org
Date: Thu, 18 Oct 2018 12:55:36 +0200
In-Reply-To: <20181018.123036.731934458688841323.mbj@tail-f.com>
References: <20181011.181150.1840683183107627057.mbj@tail-f.com> <329f67ff-0774-0fd7-f630-7a01c7e7d3be@cisco.com> <20181012.103727.731509761734796510.mbj@tail-f.com> <20181018.123036.731934458688841323.mbj@tail-f.com>
Organization: CZ.NIC
Content-Type: text/plain; charset="UTF-8"
User-Agent: Evolution 3.30.1
Mime-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: clamav-milter 0.99.2 at mail
X-Virus-Status: Clean
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/5N8L72dlibQegDWO9CVelFDkpD8>
Subject: Re: [netmod] xpath expressions in JSON
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.29
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: Thu, 18 Oct 2018 10:55:41 -0000

On Thu, 2018-10-18 at 12:30 +0200, Martin Bjorklund wrote:
> Hi,
> 
> Going back to the most urgent issue, what is this WG's recommendation
> for the subscribed-notifications draft in NETCONF wrt/ their usage of
> yang:xpath1.0 in filters?
> 
> To summarize:
> 
> We already have
> 
>   o  instance-identifier in XML uses prefixes from the XML document
>   o  instance-identifier in JSON uses module names as prefixes
>   o  XPath in NETCONF filter uses prefixes from the XML document
>   o  XPath in JSON query filter uses module names as prefixes

Actually, schema mount uses yet another approach - prefix/namespace mapping is a
part of the data itself:

        +--ro namespace* [prefix]
        |  +--ro prefix    yang:yang-identifier
        |  +--ro uri?      inet:uri

It could work here, too.

Lada

> 
> 
> Alternative A:
> --------------
> 
> Use different encodings for "stream-xpath-filter" as well, depending
> on if it is XML or JSON.
> 
> We would do in SN:
> 
>     o  If the node is encoded in XML, the set of namespace
>        declarations are those in scope on the
>        'stream-xpath-filter' leaf element.
> 
>     o  If the node is encoded in JSON, the set of namespace
>        declarations is the set of prefix and namespace pairs
>        for all supported YANG modules, where the prefix is
>        the YANG module name and the namespace is as defined
>        by the "namespace" statement in the YANG module.
> 
> Pro: the format is consistent within each encoding.
> 
> Con: unclear how to handle other encodings.
> Con: we keep using context-depending encodings.
> 
> We could probably add that CBOR uses the same representation as JSON.
> 
> Example in XML:
> 
>   <stream-xpath-filter
>       xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces"
>       xmlns:ip="urn:ietf:params:xml:ns:yang:ietf-ip">
>     /if:interfaces/if:interface/ip:ipv4
>   </stream-xpath-filter>
> 
> Example in JSON:
> 
>   "stream-xpath-filter":
>     "/ietf-interfaces:interfaces/ietf-interfaces:interface/ietf-ip:ipv4"
> 
> 
> 
> Alternative B:
> --------------
> 
> Use a non-context depending encoding, with the module name as prefix.
> 
> We would do in SN:
> 
>     o  The set of namespace
>        declarations is the set of prefix and namespace pairs
>        for all supported YANG modules, where the prefix is
>        the YANG module name and the namespace is as defined
>        by the "namespace" statement in the YANG module.
> 
> Pro: the format is independent from the protocol encoding
> 
> Con: in XML, this leaf is treated differently from other XPath
>      expressions, such as get-config filter and nacm rules.
> 
> Example in XML:
> 
>   <stream-xpath-filter>
>     /ietf-interfaces:interfaces/ietf-interfaces:interface/ietf-ip:ipv4
>   </stream-xpath-filter>
> 
> Example in JSON:
> 
>   "stream-xpath-filter":
>     "/ietf-interfaces:interfaces/ietf-interfaces:interface/ietf-ip:ipv4"
> 
> 
> My proposal is A.  I think it is more important with consistency
> within each encoding than across encodings.
> 
> (This said, I would like to have a context-independent encoding of all
> YANG types in the future.  But not now.)
> 
> 
> 
> 
> /martin
> 
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod
-- 
Ladislav Lhotka
Head, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67