Re: [netmod] xpath expressions in JSON

Robert Wilton <rwilton@cisco.com> Tue, 23 October 2018 09:39 UTC

Return-Path: <rwilton@cisco.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 61862130E3E for <netmod@ietfa.amsl.com>; Tue, 23 Oct 2018 02:39:33 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -14.501
X-Spam-Level:
X-Spam-Status: No, score=-14.501 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_HI=-5, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, USER_IN_DEF_DKIM_WL=-7.5] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=cisco.com
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 dlotVYEHQHgH for <netmod@ietfa.amsl.com>; Tue, 23 Oct 2018 02:39:31 -0700 (PDT)
Received: from aer-iport-3.cisco.com (aer-iport-3.cisco.com [173.38.203.53]) (using TLSv1.2 with cipher DHE-RSA-SEED-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id D752B130E1E for <netmod@ietf.org>; Tue, 23 Oct 2018 02:39:30 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=21554; q=dns/txt; s=iport; t=1540287571; x=1541497171; h=subject:to:references:from:message-id:date:mime-version: in-reply-to; bh=VrzFKVMN0eKF5evZRyopLu+ViSgMXN2SnlXp4XxY8O4=; b=OjsspADdl0GiMhtmr8/J+t8sbigGeYR87XsVyS/G6F2yLiruQOTsPJtV zjneiF3KG7FRfQP2P8RsofFrl7cPE7cPEmjWr4E5KnayIWM1fpkuzMep3 PZS097AFWdXBDQiWm7LKVsDr2PdHaYIaJyEqyyPubZftuZ+2mUbRHXbwR k=;
X-Files: : None
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0BVAAC/685b/xbLJq1jGgEBAQICAQEBCAIBAQGBZoFWBYEQbRIog3WId41MmQ8NGAuEA0YChUk4FgEDAQECAQECbRwMhTsBAQEDAQEhSxsLGCoCAicwEwYCAQGDHQGCAQ+lcYEuhTuEWgoFi3iBQT+BESeCa4MbAQGCDYJXglcCiGsEhV1Cjm5UCYQQgW6KcAYXiTSGfJAjhkiBWiEngS4zGggbFTuCbIImF30BC4dThT8+MI17AQE
X-IronPort-AV: E=Sophos;i="5.54,415,1534809600"; d="scan'208";a="7405016"
Received: from aer-iport-nat.cisco.com (HELO aer-core-1.cisco.com) ([173.38.203.22]) by aer-iport-3.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2018 09:39:28 +0000
Received: from [10.63.23.63] (dhcp-ensft1-uk-vla370-10-63-23-63.cisco.com [10.63.23.63]) by aer-core-1.cisco.com (8.15.2/8.15.2) with ESMTP id w9N9dM4K021126 for <netmod@ietf.org>; Tue, 23 Oct 2018 09:39:22 GMT
To: netmod@ietf.org
References: <20181022.145605.1533686864301630023.mbj@tail-f.com> <c65c0eaf9054242c5378f50c001789a84b3007c2.camel@nic.cz> <B8F9A780D330094D99AF023C5877DABA9B0BC6A0@nkgeml513-mbx.china.huawei.com> <20181023.084254.2257754077098127031.mbj@tail-f.com> <87d0s1azc8.fsf@nic.cz> <ed32a8f0-53b5-dbee-c6ac-b1ff2ddad039@cisco.com> <8ef79f3002b77b8be59d667b656e776c80a80531.camel@nic.cz> <20181023092800.mhu4kntxhjycsol4@anna.jacobs.jacobs-university.de>
From: Robert Wilton <rwilton@cisco.com>
Message-ID: <d0ac6404-4af7-c046-37bf-ca3eb7814bc8@cisco.com>
Date: Tue, 23 Oct 2018 10:39:22 +0100
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1
MIME-Version: 1.0
In-Reply-To: <20181023092800.mhu4kntxhjycsol4@anna.jacobs.jacobs-university.de>
Content-Type: multipart/mixed; boundary="------------4DD3D6B374730FEC6ED00AB0"
Content-Language: en-US
X-Outbound-SMTP-Client: 10.63.23.63, dhcp-ensft1-uk-vla370-10-63-23-63.cisco.com
X-Outbound-Node: aer-core-1.cisco.com
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/HpnnwM1wVXw2KjdVkTC0eGyXnDA>
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: Tue, 23 Oct 2018 09:39:33 -0000

Hi Juergen,

Is this the same as Martin's alternative B proposed previously 
(attached)?  Or are you suggesting a different alternative?

Thanks,
Rob


On 23/10/2018 10:28, Juergen Schoenwaelder wrote:
> On Tue, Oct 23, 2018 at 11:20:54AM +0200, Ladislav Lhotka wrote:
>> Note that the namespace information needn't be sent along with every XPath
>> expression as it would probably be the case in the XML encoding of option A.
>> Only if a new namespace is being used, the "namespace" list has to be updated.
>>
> Can we pre-populate the context with namespaces, for example,
> controlled via an extension of yang library? Perhaps we can simply
> pre-polutate contexts with all module names? Yes, I know this makes
> xpath expressions rather verbose but on the other hand it takes away
> guesswork and (client) tools may do expansion of an unprefixed
> expression into a proper namespace prefixed expression.
>
> /js
>

--- Begin Message ---
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
       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
.

--- End Message ---