Re: [netmod] xpath expressions in JSON
Martin Bjorklund <mbj@tail-f.com> Mon, 22 October 2018 12:56 UTC
Return-Path: <mbj@tail-f.com>
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 283F6130DFB for <netmod@ietfa.amsl.com>; Mon, 22 Oct 2018 05:56:11 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.901
X-Spam-Level:
X-Spam-Status: No, score=-1.901 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_PASS=-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 wCj1cg2bNxhH for <netmod@ietfa.amsl.com>; Mon, 22 Oct 2018 05:56:07 -0700 (PDT)
Received: from mail.tail-f.com (mail.tail-f.com [46.21.102.45]) by ietfa.amsl.com (Postfix) with ESMTP id F1E9F128D0C for <netmod@ietf.org>; Mon, 22 Oct 2018 05:56:06 -0700 (PDT)
Received: from localhost (unknown [173.38.220.61]) by mail.tail-f.com (Postfix) with ESMTPSA id 3570E1AE039A; Mon, 22 Oct 2018 14:56:06 +0200 (CEST)
Date: Mon, 22 Oct 2018 14:56:05 +0200
Message-Id: <20181022.145605.1533686864301630023.mbj@tail-f.com>
To: lhotka@nic.cz
Cc: netmod@ietf.org
From: Martin Bjorklund <mbj@tail-f.com>
In-Reply-To: <87bm7q4apy.fsf@nic.cz>
References: <20181012.103727.731509761734796510.mbj@tail-f.com> <20181018.123036.731934458688841323.mbj@tail-f.com> <87bm7q4apy.fsf@nic.cz>
X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO)
Mime-Version: 1.0
Content-Type: Text/Plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/7F37aLvHjYCBL8qf4gkHjiUIn60>
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: Mon, 22 Oct 2018 12:56:11 -0000
Ladislav Lhotka <lhotka@nic.cz> wrote:
> Martin Bjorklund <mbj@tail-f.com> writes:
>
> > 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
> >
> >
> > 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
>
> Is "supported" the same as "implemented", or something else?
It should be "implemented".
> > 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.
>
> Con: XPath expressions in JSON can get pretty long (I assume it's not
> just an instance identifier but may contain predicates etc.). We
> cannot use the trick with the default namespace as in YANG, so all
> data node names will have to carry the prefix.
Yes.
> > 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.
>
> I would suggest to consider declaring prefixes & namespaces explicitly
> in the data, as in the schema mount document. It is independent of
> encoding and the expressions can be kept short. In fact, one of the
> namespaces can be declared as default, so this use of XPath would then
> be very similar to YANG.
Ok, so this is another alternative that works today, and achieves the
goal of being encoding-independent. It is still context-dependent
though.
BTW, when used in filters, it is nice to let an unprefixed name to
match any namespace; i.e., treat "foo" as syntactic sugar for
"local-name(.) = 'foo'". ("*:foo" is not legal...)
/martin
>
> Lada
>
> >
> > (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
>
- [netmod] xpath expressions in JSON Martin Bjorklund
- Re: [netmod] xpath expressions in JSON Ladislav Lhotka
- Re: [netmod] xpath expressions in JSON Martin Bjorklund
- Re: [netmod] xpath expressions in JSON Reshad Rahman (rrahman)
- Re: [netmod] xpath expressions in JSON Andy Bierman
- Re: [netmod] xpath expressions in JSON Ladislav Lhotka
- Re: [netmod] xpath expressions in JSON Martin Bjorklund
- Re: [netmod] xpath expressions in JSON Ladislav Lhotka
- Re: [netmod] xpath expressions in JSON Vladimir Vassilev
- Re: [netmod] xpath expressions in JSON Martin Bjorklund
- Re: [netmod] xpath expressions in JSON Andy Bierman
- Re: [netmod] xpath expressions in JSON Robert Wilton
- Re: [netmod] xpath expressions in JSON Martin Bjorklund
- Re: [netmod] xpath expressions in JSON Robert Wilton
- Re: [netmod] xpath expressions in JSON Martin Bjorklund
- Re: [netmod] xpath expressions in JSON Robert Wilton
- Re: [netmod] xpath expressions in JSON Reshad Rahman (rrahman)
- Re: [netmod] xpath expressions in JSON Robert Wilton
- Re: [netmod] xpath expressions in JSON Martin Bjorklund
- Re: [netmod] xpath expressions in JSON Andy Bierman
- Re: [netmod] xpath expressions in JSON Reshad Rahman (rrahman)
- Re: [netmod] xpath expressions in JSON Martin Bjorklund
- Re: [netmod] xpath expressions in JSON Robert Wilton
- Re: [netmod] xpath expressions in JSON Andy Bierman
- Re: [netmod] xpath expressions in JSON Robert Wilton
- Re: [netmod] xpath expressions in JSON Andy Bierman
- Re: [netmod] xpath expressions in JSON Martin Bjorklund
- Re: [netmod] xpath expressions in JSON Robert Wilton
- Re: [netmod] xpath expressions in JSON Reshad Rahman (rrahman)
- Re: [netmod] xpath expressions in JSON Martin Bjorklund
- Re: [netmod] xpath expressions in JSON Ladislav Lhotka
- Re: [netmod] xpath expressions in JSON Robert Wilton
- Re: [netmod] xpath expressions in JSON Reshad Rahman (rrahman)
- Re: [netmod] xpath expressions in JSON Vladimir Vassilev
- Re: [netmod] xpath expressions in JSON Andy Bierman
- Re: [netmod] xpath expressions in JSON Juergen Schoenwaelder
- Re: [netmod] xpath expressions in JSON Andy Bierman
- Re: [netmod] xpath expressions in JSON Juergen Schoenwaelder
- Re: [netmod] xpath expressions in JSON Martin Bjorklund
- Re: [netmod] xpath expressions in JSON Andy Bierman
- Re: [netmod] xpath expressions in JSON Martin Bjorklund
- Re: [netmod] xpath expressions in JSON Andy Bierman
- Re: [netmod] xpath expressions in JSON Ladislav Lhotka
- Re: [netmod] xpath expressions in JSON Martin Bjorklund
- Re: [netmod] xpath expressions in JSON Ladislav Lhotka
- Re: [netmod] xpath expressions in JSON Qin Wu
- Re: [netmod] xpath expressions in JSON Martin Bjorklund
- Re: [netmod] xpath expressions in JSON Ladislav Lhotka
- Re: [netmod] xpath expressions in JSON Martin Bjorklund
- Re: [netmod] xpath expressions in JSON Ladislav Lhotka
- Re: [netmod] xpath expressions in JSON Martin Bjorklund
- Re: [netmod] xpath expressions in JSON Robert Wilton
- Re: [netmod] xpath expressions in JSON Ladislav Lhotka
- Re: [netmod] xpath expressions in JSON Juergen Schoenwaelder
- Re: [netmod] xpath expressions in JSON Robert Wilton
- Re: [netmod] xpath expressions in JSON Juergen Schoenwaelder
- Re: [netmod] xpath expressions in JSON Ladislav Lhotka
- Re: [netmod] xpath expressions in JSON Martin Bjorklund
- Re: [netmod] xpath expressions in JSON Juergen Schoenwaelder
- Re: [netmod] xpath expressions in JSON Kent Watsen
- Re: [netmod] xpath expressions in JSON Vladimir Vassilev
- Re: [netmod] xpath expressions in JSON Vladimir Vassilev
- Re: [netmod] xpath expressions in JSON Vladimir Vassilev
- Re: [netmod] xpath expressions in JSON Qin Wu
- Re: [netmod] xpath expressions in JSON Martin Bjorklund