Re: [netmod] xpath expressions in JSON

"Reshad Rahman (rrahman)" <rrahman@cisco.com> Thu, 11 October 2018 18:12 UTC

Return-Path: <rrahman@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 4B09D1200D7 for <netmod@ietfa.amsl.com>; Thu, 11 Oct 2018 11:12:23 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -14.5
X-Spam-Level:
X-Spam-Status: No, score=-14.5 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, HTML_MESSAGE=0.001, 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 VF_iysuMU9UZ for <netmod@ietfa.amsl.com>; Thu, 11 Oct 2018 11:12:20 -0700 (PDT)
Received: from alln-iport-3.cisco.com (alln-iport-3.cisco.com [173.37.142.90]) (using TLSv1.2 with cipher DHE-RSA-SEED-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 3BBBF130E82 for <netmod@ietf.org>; Thu, 11 Oct 2018 11:12:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=35874; q=dns/txt; s=iport; t=1539281540; x=1540491140; h=from:to:cc:subject:date:message-id:references: in-reply-to:mime-version; bh=IZK1Dq6bfa5Ew+Xc6A2qi994qDYw5c61jbnxw8840C0=; b=f4MGiEX4r6LfRT9+HPFPO7jeQ8HJiRY5c+UBVdnahNL9vBlYnMJs2HPR arpCgL8qpM/+BMCRU6tVvNUWAvRhpnyc8xpF8Jk0i2DBjnF/bRJwdetYw LUqvslN1V9SXuoBjgjJEEO23phUfnRE04RKrMvkyrSC50kBHR5GjxxAPD g=;
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0AFAAAlkr9b/5FdJa1iGQEBAQEBAQEBAQEBAQcBAQEBAQGBUgMBAQEBAQsBgQx3Zn8VEwqDa5RMgWgllwCBdwMLAQEYAQoJg3pGAheEPiE1DA0BAwEBAgEBAm0cDIU5AQEBAQIBAQEhSwsFCwIBCBEDAQIhAQYDAgICJQsUCQgCBA4FgyABgR1cCA+mH4EuiVgFi0UXgUE/gTkME4JMgxsBAYE6ETYWgksxgiYCiD2BG4RGFYVziWoJApBSF4FPjkKJFIxXAhEUgSUeATaBVXAVOyoBgkEJiw6FPm+BFohSgS4BgR4BAQ
X-IronPort-AV: E=Sophos;i="5.54,369,1534809600"; d="scan'208,217";a="184917008"
Received: from rcdn-core-9.cisco.com ([173.37.93.145]) by alln-iport-3.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Oct 2018 18:12:19 +0000
Received: from XCH-RCD-010.cisco.com (xch-rcd-010.cisco.com [173.37.102.20]) by rcdn-core-9.cisco.com (8.15.2/8.15.2) with ESMTPS id w9BICJQw028198 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=FAIL); Thu, 11 Oct 2018 18:12:19 GMT
Received: from xch-rcd-005.cisco.com (173.37.102.15) by XCH-RCD-010.cisco.com (173.37.102.20) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 11 Oct 2018 13:12:18 -0500
Received: from xch-rcd-005.cisco.com ([173.37.102.15]) by XCH-RCD-005.cisco.com ([173.37.102.15]) with mapi id 15.00.1395.000; Thu, 11 Oct 2018 13:12:18 -0500
From: "Reshad Rahman (rrahman)" <rrahman@cisco.com>
To: "Robert Wilton -X (rwilton - ENSOFT LIMITED at Cisco)" <rwilton@cisco.com>
CC: Martin Bjorklund <mbj@tail-f.com>, "netmod@ietf.org" <netmod@ietf.org>
Thread-Topic: [netmod] xpath expressions in JSON
Thread-Index: AQHUYIqyJUA4hM8yQEuWRAlaWHhia6UYv5+AgAAV+YCAAIZOgIAASaoAgABHYACAAC1hgIAAEM2AgAAGGwCAAAHbgIAAB16AgAAFDgCAAEkjAP//4u6A
Date: Thu, 11 Oct 2018 18:12:18 +0000
Message-ID: <D4E6916F-B17F-4524-9A3D-2990DF9D6FF8@cisco.com>
References: <CABCOCHQ58Z0TpVLGVcw_TT-OG+1pWQERyCnU7NFO_Gob7JLLcA@mail.gmail.com> <20181011.122137.1647095802972927089.mbj@tail-f.com> <461820e8-4ed9-823b-a2c4-a04c74e4f7c1@cisco.com> <20181011.125007.434815114996317742.mbj@tail-f.com> <7a9b1a5f-db66-7431-a2c7-82acebb2082b@cisco.com> <BE8F576F-2A56-44D8-8554-6576B9CDB0F8@cisco.com> <b84a4e2d-0f63-6b53-3dcc-70bf9ad96cbd@cisco.com>
In-Reply-To: <b84a4e2d-0f63-6b53-3dcc-70bf9ad96cbd@cisco.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
user-agent: Microsoft-MacOutlook/10.b.0.180311
x-ms-exchange-messagesentrepresentingtype: 1
x-ms-exchange-transport-fromentityheader: Hosted
x-originating-ip: [161.44.212.54]
Content-Type: multipart/alternative; boundary="_000_D4E6916FB17F45249A3D2990DF9D6FF8ciscocom_"
MIME-Version: 1.0
X-Outbound-SMTP-Client: 173.37.102.20, xch-rcd-010.cisco.com
X-Outbound-Node: rcdn-core-9.cisco.com
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/owy02itPHwHOBD4raTTJNsQL9g8>
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, 11 Oct 2018 18:12:23 -0000

Hi Rob,


From: "Robert Wilton -X (rwilton - ENSOFT LIMITED at Cisco)" <rwilton@cisco.com>
Date: Thursday, October 11, 2018 at 11:56 AM
To: "Reshad Rahman (rrahman)" <rrahman@cisco.com>
Cc: Martin Bjorklund <mbj@tail-f.com>, "netmod@ietf.org" <netmod@ietf.org>
Subject: Re: [netmod] xpath expressions in JSON


<trimmed>

Yet the examples in section 8.3.6 don't seem to use namespace prefixes in very many places, e.g. why is it "/example-mod:event1/name='joe'" and not "/example-mod:event1/example-mod:name='joe'"?  Is the example wrong, or otherwise what am I missing? :-)


<RR> Section 8.3.6 of which document?
RFC 8040.

<RR2> B.3.6, got it. Was looking for 8.3.6, that’s why didn’t find it.

Regards,
Reshad.


Thanks,
Rob



Regards,
Reshad.

Thanks,
Rob











/martin







Thanks,

Rob





There is no standard XPath implementation that can just take an XML

instance document + YANG module and figure out what to do.  Custom

code is needed to connect things together.  This proposal doesn't

change this.





/martin





A normal XPath implementation will not find any namespace mapping for

the

prefixes.



An XPath expression has no concept of the "current module" inherited

from

the parent

like the JSON encoding. This is problematic for predicates



    /ietf-interfaces:interfaces/interface[name='eth0']



XPath says the missing prefixes for 'interface' and 'name' are simply

missing (no namespace).

The JSON encoding says "ietf-interfaces" is used for 'interfaces'. and

'interface'.

There is no specification for the 'name' node inside a predicate.



So you must mean the full module name will be used at every node:



  /ietf-interfaces:interfaces/ietf-interfaces:interface[ietf-interfaces:name='eth0']







/martin





Andy





     Hmm, so you mean change the leaf "stream-xpath-filter" to say:



              o  The set of namespace declarations has one member for

each

                 YANG module supported by the server.  This member maps

                 from the YANG module name to the YANG module namespace.



                 This means that in the XPath expression, the module

name

                 serves as the prefix.



     .... and then also give an example of this.



     This is probably what we need to do in all places where

yang:xpath1.0

     is used, going forward.  Maybe even define a new type

     yang:xpath1.0-2 (name?) with the set of namespace declarations

     built-in.



We should avoid making off-the-shelf implementations of standards like

XPath unusable.

At the very least this should be only available if the server supports

it

(with a capability URI)







<RR> So we need an update to RFC7951?



Regards,

Reshad.





Andy





     /martin











     >

     > Lada

     >

     > >

     > > How is this supposed to work with JSON?

     > >

     > >

     > > /martin

     > >

     > > _______________________________________________

     > > netmod mailing list

     > > netmod@ietf.org<mailto:netmod@ietf.org>

     > > https://www.ietf.org/mailman/listinfo/netmod

     >

     > --

     > Ladislav Lhotka

     > Head, CZ.NIC Labs

     > PGP Key ID: 0xB8F92B08A9F76C67

     >



     _______________________________________________

     netmod mailing list

     netmod@ietf.org<mailto:netmod@ietf.org>

     https://www.ietf.org/mailman/listinfo/netmod





_______________________________________________

netmod mailing list

netmod@ietf.org<mailto:netmod@ietf.org>

https://www.ietf.org/mailman/listinfo/netmod



_______________________________________________

netmod mailing list

netmod@ietf.org<mailto:netmod@ietf.org>

https://www.ietf.org/mailman/listinfo/netmod

..



.