Re: [netmod] xpath expressions in JSON

Robert Wilton <rwilton@cisco.com> Fri, 12 October 2018 10:22 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 38CC2129BBF for <netmod@ietfa.amsl.com>; Fri, 12 Oct 2018 03:22:57 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -14.956
X-Spam-Level:
X-Spam-Status: No, score=-14.956 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.456, 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, 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 bg_vyvNknsgi for <netmod@ietfa.amsl.com>; Fri, 12 Oct 2018 03:22:55 -0700 (PDT)
Received: from aer-iport-4.cisco.com (aer-iport-4.cisco.com [173.38.203.54]) (using TLSv1.2 with cipher DHE-RSA-SEED-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id CBB17130DC5 for <netmod@ietf.org>; Fri, 12 Oct 2018 03:22:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=10593; q=dns/txt; s=iport; t=1539339775; x=1540549375; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to; bh=hg4BzxXd8YOGSRuYCwdK73x6Y7u4StHEOXFWCSrq5Ks=; b=OfcvfjkWxMM3EPphO69UxcTx5KLeRNwYpqqB2hsMHLXroxk084QYeiP0 9p+Vzf2e9czKukB1KHIQfyvkeUNeqgAlRs2lFZ2hRdAMFJmDs/q0/5W6/ xjJpv3G51lNZwybLEhFraSsyZtQvghGAsZ+e95Oe9kSEyqnDHBFJdHCEP U=;
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0BdAABtdcBb/xbLJq0ZAUoaAQEBAQECAQEBAQcCAQEBAYFlAoNVEiiDdYh1jTstkT+HQg2EbAKEeTgWAQMBAQIBAQJtKIU5AQEBAwEjVhAJAhgnAwICRhEGDQYCAQGDHIF6CIhegSmbTYEuH4RYhGuLXYFBP4E5gW1+h3+CVwKOOoV1iW0JkFIGF4FPhG+Ca4Ztj26GNoFaIYFVMxoIGxWDJ5BXPjCKDCuCIAEB
X-IronPort-AV: E=Sophos;i="5.54,371,1534809600"; d="scan'208,217";a="7127935"
Received: from aer-iport-nat.cisco.com (HELO aer-core-4.cisco.com) ([173.38.203.22]) by aer-iport-4.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Oct 2018 10:22:52 +0000
Received: from [10.63.23.158] (dhcp-ensft1-uk-vla370-10-63-23-158.cisco.com [10.63.23.158]) by aer-core-4.cisco.com (8.15.2/8.15.2) with ESMTP id w9CAMpAE013007; Fri, 12 Oct 2018 10:22:52 GMT
To: Andy Bierman <andy@yumaworks.com>
Cc: Martin Bjorklund <mbj@tail-f.com>, NetMod WG <netmod@ietf.org>
References: <461820e8-4ed9-823b-a2c4-a04c74e4f7c1@cisco.com> <20181011.125007.434815114996317742.mbj@tail-f.com> <7a9b1a5f-db66-7431-a2c7-82acebb2082b@cisco.com> <20181011.181150.1840683183107627057.mbj@tail-f.com> <329f67ff-0774-0fd7-f630-7a01c7e7d3be@cisco.com> <CABCOCHTV_-9b0xjcrO=UEyc15xvzYGAQg9CSqEu9qQ0eDSpJVA@mail.gmail.com>
From: Robert Wilton <rwilton@cisco.com>
Message-ID: <a4861b2b-fbdd-986f-d386-83977c319384@cisco.com>
Date: Fri, 12 Oct 2018 11:22:50 +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: <CABCOCHTV_-9b0xjcrO=UEyc15xvzYGAQg9CSqEu9qQ0eDSpJVA@mail.gmail.com>
Content-Type: multipart/alternative; boundary="------------2C698DB853FD9C85A04B84A3"
Content-Language: en-US
X-Outbound-SMTP-Client: 10.63.23.158, dhcp-ensft1-uk-vla370-10-63-23-158.cisco.com
X-Outbound-Node: aer-core-4.cisco.com
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/xzuTRIdlDC3s5UP2W3GcDHWmz90>
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: Fri, 12 Oct 2018 10:22:57 -0000

Hi Andy,

On 11/10/2018 17:52, Andy Bierman wrote:
>
>
> On Thu, Oct 11, 2018 at 9:45 AM, Robert Wilton <rwilton@cisco.com 
> <mailto:rwilton@cisco.com>> wrote:
>
>
>     ....
>
>
>             Finally, I'm trying to figure out have RFC 8040 query
>             parameter (sect
>             4.8.4), which also uses XPath expressions is meant to
>             work. That
>             states:
>
>             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.
>
>         Perfect!  It seems the authors of 8040 thought of this ;-)
>
>     OK, what you propose would at least be consistent with how the
>     XPath is formed in sec 8040, 4.8.4?
>
>     I can live with that.  But still strongly think that WG should
>     think of trying to move YANG on from Xpath 1.0.
>
>
>
> I do not agree YANG should change any statements where XPath is being 
> used.
> (Note that leafs like the filter are free to use whatever data type 
> they want, including yang:xpath1.0).

OK, I think that I would be proposing either doing this as part of 
YANG.next, or perhaps as different leaf types.

>
> The WG is on the right track already wrt/ XPath by creating custom 
> XPath functions
> like 'deref' that simplify syntax or extend functionality.

Yes, the functions partially help.

But there are bits of Xpath expressions that are not meaningful for YANG 
(e.g. NodeType checks or processing-instruction).

The fact that NodeSets are sets rather than sequences isn't particularly 
helpful (fixed in future versions of XPath).

E.g. if I wanted to check that a particular YANG boolean leaf is true 
then I might write "enabled = true" ... which is valid XPath, but 
probably doesn't do what most people expect ...
When they realize that is wrong, perhaps they will try "enabled = 
true()" instead ... which is also valid XPath, but still probably won't 
do what they expect ...
Instead they have to do 'enabled = "true"'.

And then what about comparisons for 64 bit numbers that don't work properly?

So, it seems like there are quite a lots of gotchas when using XPath for 
YANG, and it is far from an ideal language for expressing configuration 
constraints.

If YANG adoption increases, and if folks start putting more validation 
constrains into the model then I hope that we will end up with a better 
language for expressing those constraints.

Thanks,
Rob


>
>
>
>
>             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? :-)
>
>         It seems the example is wrong!
>
>     Please can you check section 8040, 8.3.6.  Are all the examples wrong?
>
>     Thanks,
>     Rob
>
>
>
>         /martin
>         .
>
>
>
>
> Andy
>