Re: [netmod] xpath expressions in JSON

Andy Bierman <andy@yumaworks.com> Fri, 12 October 2018 16:09 UTC

Return-Path: <andy@yumaworks.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 7978A130E37 for <netmod@ietfa.amsl.com>; Fri, 12 Oct 2018 09:09:28 -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, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=yumaworks-com.20150623.gappssmtp.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 TvF4agptSU-1 for <netmod@ietfa.amsl.com>; Fri, 12 Oct 2018 09:09:25 -0700 (PDT)
Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 0EB87130E39 for <netmod@ietf.org>; Fri, 12 Oct 2018 09:09:25 -0700 (PDT)
Received: by mail-lj1-x22a.google.com with SMTP id z21-v6so11855718ljz.0 for <netmod@ietf.org>; Fri, 12 Oct 2018 09:09:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yumaworks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=86HqzWYweAJMoohJbyruLMeB2kBAk/jPe/3lEf3u7/Q=; b=wSjbCGaKhhnI5m8axYSvC18bClkWn80n8O28mIVQqZ3eK+DAO9/GYbSwzc7XDO2J04 n3oOPvLKeooHiM+W3tXNsHFIq6DroZQQIn0Srd++XxfkFARilFKt/WYGcpfnEPp9YtR4 Ipues6T9tRoDLY4rZe+u1fRA+izR1oRJ2DPKTuSd17x+WKdIEbQDrJaxFIkd1bFei75S Juq+leoazMra2ohoaFuOJw8KHLUP4VibS2B4ym8rOYBRn2mzuTsr7LdLKmk80pUb9DyR 73Q0v7ihNc/Pe1pSE/aumxROpMEPmvcvaNN+qCAv5/uEiFDwlGbcdgw6Ry/tsnfahdtW wQ3w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=86HqzWYweAJMoohJbyruLMeB2kBAk/jPe/3lEf3u7/Q=; b=eGdyWY3+dNHiIWUTHlJmvxtHO8k+xzxRgS4+tQ8BZh1wCmfoSciVgUYOSbu6bDt2Ap jkp2oNwRBnJcy/zdU4tdohfXJPPolWfbXE2nwWhPcFvxJpQih62yNtVK1ZWHrIRFTdzh d/dkmqk8MNYOzgvYpVxultFH7fL+ya+Dk2ugJk/ibIFz1/R7qXNnRE22JIuJHoWc6tuD F+aya7/O2MPsWKKHEy0uvfrCUSwhMKM5VVcBv+aEwprO6RNDrrDkmz/AVCQnM6tQOiv/ gKwVwNu1Vrtx30JQ3BqSdJLHuSUyPP5vBGefeTuT30s9Qif0oKXsmzMab5YGfWMQD8f1 3vvA==
X-Gm-Message-State: ABuFfohN9R8NHO6H/Y9vsq50HoVv8JdwF45XH/0xRKjcsUyyOxokI7vv Ac/FBOf1RWdb5zMZ8qwvAOqCM7XQGRWicJs4o6FGvA==
X-Google-Smtp-Source: ACcGV61UVpORBaZgG6qVDmFDLWh5YpBMpZd0/BN5JQgfvKmK33KX/VrrU83y87NJhUrGeHUw9s1cRr19+9qSUjOF5FU=
X-Received: by 2002:a2e:4408:: with SMTP id r8-v6mr4878677lja.21.1539360562907; Fri, 12 Oct 2018 09:09:22 -0700 (PDT)
MIME-Version: 1.0
Received: by 2002:a19:f811:0:0:0:0:0 with HTTP; Fri, 12 Oct 2018 09:09:21 -0700 (PDT)
In-Reply-To: <a4861b2b-fbdd-986f-d386-83977c319384@cisco.com>
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> <a4861b2b-fbdd-986f-d386-83977c319384@cisco.com>
From: Andy Bierman <andy@yumaworks.com>
Date: Fri, 12 Oct 2018 09:09:21 -0700
Message-ID: <CABCOCHTRoe1hxRUO-5YhMMbNDQjsTtu5RWueo9uUNiXfSUMOuQ@mail.gmail.com>
To: Robert Wilton <rwilton@cisco.com>
Cc: Martin Bjorklund <mbj@tail-f.com>, NetMod WG <netmod@ietf.org>
Content-Type: multipart/alternative; boundary="00000000000088a6f805780a4fd4"
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/Jjl326oOIo6N9LLwVFZ-kEC1p1A>
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 16:09:34 -0000

On Fri, Oct 12, 2018 at 3:22 AM, Robert Wilton <rwilton@cisco.com> wrote:

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

There are parts of XPath that are not used and most people are unaware
XPath even has
those details. Not a real problem.

There is usually a high cost to pay for instability. IMO we have already
seen that with the churn
that NMDA has caused. Training people over again has a cost.  Confusing
people by having
6 or 7 different path language variants that mostly look the same has a
cost.

I guess we will have this debate for real if YANG 2.0 is ever done


Thanks,
> Rob
>
>
Andy


>
>
>
>
>>
>>> 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
>
>
>