Re: [netconf] XPath support in RESTCONF

Andy Bierman <andy@yumaworks.com> Wed, 06 December 2023 18:15 UTC

Return-Path: <andy@yumaworks.com>
X-Original-To: netconf@ietfa.amsl.com
Delivered-To: netconf@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id A9391C14CE55 for <netconf@ietfa.amsl.com>; Wed, 6 Dec 2023 10:15:58 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.106
X-Spam-Level:
X-Spam-Status: No, score=-2.106 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=yumaworks.com
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fZQeZlnxtyrv for <netconf@ietfa.amsl.com>; Wed, 6 Dec 2023 10:15:54 -0800 (PST)
Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id A739BC14CE25 for <netconf@ietf.org>; Wed, 6 Dec 2023 10:15:54 -0800 (PST)
Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-50be8ced3ddso73967e87.1 for <netconf@ietf.org>; Wed, 06 Dec 2023 10:15:54 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yumaworks.com; s=google; t=1701886552; x=1702491352; darn=ietf.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=vfucNCbkoYTHJ24otr2Y/+Nzx9Qy7GlVZBJwtQLdA6M=; b=c5XQ1bvvnFiLHtZ7sN01zB/Lhiym+oiwF3hK9Pjh6v2n3/oPN7V8jBJCUyVRySKAsi 8Sd3/lxQ5Ukm7axnt3OjouP8zfHI4Ow3/mnpGXv6BBa3opiaBKJLEKHx30KFiACY1Mqo +PJ2TvMV45RDdOUMEMrFIYNWZdjTQIToM54/FY3Ede65MnrAdBnRAdZtXYBaOb2QRGwo 4J3PRbOEjZec0uba68KCcy86WoEjxXxWvZBWiQ1P+xjVUeNZbd0crT9vySfcdU4yuO1K bEfnRVUHdemI+spiVDP20zy6aifdN/hVGmiAYsDr1NVcyH7fs8dZlnQtxCiaAGQC2yse nKYA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701886552; x=1702491352; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vfucNCbkoYTHJ24otr2Y/+Nzx9Qy7GlVZBJwtQLdA6M=; b=h/ckMFW92iC+BpwqJ+n5CSphwgNGIyTAKx91gYpHpKmQcZcGH/pGIHt5JEQcbV+J41 mDWQ+RfaxzbndhINFQ8+XNbCicfh83Rn8xPChKxIWGTpf7RX5gPlTaWKn7bBLeU/h1MK apUW54zTi6hCDeiZDwYdUP+zWvn6wctH+fe5Bpi7subbCTN/g9oG3h88CGs/dXibNeNf FgMTljS49cCGqylRCjJQen+m0ASWkZ7b1rrmRJebzXfz6S2DWoKDvkm82Ds1TF+Y/Vn1 A/rnAMc1Iaf9Fp61hKsIHneS/s8DCrFVNYjuP6DJV0V5k0tIxyCeVl7M5hmAt/0CEyeT mtgw==
X-Gm-Message-State: AOJu0YxpR9rNxwL7y1KJc58hk3ZK5pWQrtd32PEGSONP8h7EEdh8BGQe i4bqaTu/EEL458PkkewmngA2DSpLA3t0R6a5FOU4Y/iLAqGXIFaHkJY=
X-Google-Smtp-Source: AGHT+IEcmL2CSxFy8X+GAkjUzZ7UKwJNbJ7EG1cesebolYSih3ysELmwPiZTLKft34CbtmHmf0gCgQPQkWY8QJi8F3U=
X-Received: by 2002:a2e:95c9:0:b0:2c9:f1c6:e20d with SMTP id y9-20020a2e95c9000000b002c9f1c6e20dmr766922ljh.49.1701886551783; Wed, 06 Dec 2023 10:15:51 -0800 (PST)
MIME-Version: 1.0
References: <DM6PR11MB47088055673E65341038FB48DB85A@DM6PR11MB4708.namprd11.prod.outlook.com> <CABCOCHTUy6gowMn_p8W5LmnUqhqmNpJ37a0pgp7=26=CmnCtUw@mail.gmail.com> <DM6PR11MB470810B5A424B91267DD75A1DB85A@DM6PR11MB4708.namprd11.prod.outlook.com> <CABCOCHQbuowG290+23=kM+q5=y327bQdhqi3Z1XpznSJYfCn0Q@mail.gmail.com> <DM6PR11MB47083A4985FA5232760B52EADB84A@DM6PR11MB4708.namprd11.prod.outlook.com>
In-Reply-To: <DM6PR11MB47083A4985FA5232760B52EADB84A@DM6PR11MB4708.namprd11.prod.outlook.com>
From: Andy Bierman <andy@yumaworks.com>
Date: Wed, 06 Dec 2023 10:15:40 -0800
Message-ID: <CABCOCHTWRzf=ratQEzgR9UrMeVs+-o71iBPi+7HFCVM+Ndcc3Q@mail.gmail.com>
To: "Per Andersson (perander)" <perander@cisco.com>
Cc: "netconf@ietf.org" <netconf@ietf.org>
Content-Type: multipart/alternative; boundary="0000000000005e0f78060bdb5710"
Archived-At: <https://mailarchive.ietf.org/arch/msg/netconf/MGYCcGmdxzi6XsfLYL0g6-_9YC4>
Subject: Re: [netconf] XPath support in RESTCONF
X-BeenThere: netconf@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: NETCONF WG list <netconf.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netconf>, <mailto:netconf-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netconf/>
List-Post: <mailto:netconf@ietf.org>
List-Help: <mailto:netconf-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netconf>, <mailto:netconf-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 06 Dec 2023 18:15:58 -0000

On Wed, Dec 6, 2023 at 4:12 AM Per Andersson (perander) <perander@cisco.com>
wrote:

> Andy Bierman <andy@yumaworks.com>:
> >On Tue, Dec 5, 2023 at 9:50 AM Per Andersson (perander) <
> perander@cisco.com<mailto:perander@cisco.com>> wrote:
> >>Andy Bierman <andy@yumaworks.com<mailto:andy@yumaworks.com>>:
> >>>
> >>> The 'get' or 'get-config' operation can be used.
> >>> The filter element is part of the payload, not the request URI.
> >>> This supports a 'select' attribute which is set to the XPath
> expression.
> >>
> >> This is a very NETCONF way to use RESTCONF though. It would
> >> probably be more appreciated to actually use HTTP techniques and
> >> mechanics.
> >
> > No -- this is the way RFC 8040 defines to invoke a YANG rpc-stmt.
> >
> > IMO every RESTCONF server should provide access to all the RPC operations
> > that are advertised as implemented in the YANG library.
>
> I agree with this of course.
>
>
> > The syntax is very simple and it does not require a new RESTCONF
> protocol version.
> >
> >
> > POST /restconf/operations/ietf-netconf:get-config HTTP/1.1
> > Server: example.com<http://example.com>
> > Content-Type: application/yang-data+xml
> >
> > <input xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
> >   <filter type="xpath"
> >          xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces"
> >          select="/if:interfaces/if:interfaces[if:name='eno1']"/>
> > </input>
>
> Indeed.
>
>

Real use cases exist that are not trivial to replicate using a data
resource URI
E.g.

get all interfaces with names starting with 'eno'  [filter on regexp name
match]

     select="/if:interfaces/if:interface[starts-with(if:name,'eno')]"

get all interfaces that are not enabled [filter on non-key leaf]

     select="/if:interfaces/if:interface[if:enabled='false']"



Perhaps good enough.
>
> However this would not support e.g. pagination as the current
> list-pagination
> draft defines it. Which a XPath query draft could include/update. Another
> option
> could be to bolt on pagination support for arbitrary RPC invocation, which
> probably is a lot more work.
>
>
>
One would use the pagination operations and not get/get-config/get-data in
that case.
If the pagination APIs cannot even handle what XPath can do, then they may
not get used.



> >>> I think it is a hard sell to state that one should use HTTP more or
> less
> >>> as expected to fetch data, but if you want do advanced filtering it is
> >>> necessary to invoke an RPC.
> >
> > The query language is even more advanced and complex to implement.
> > IMO much more so than the standard POST already defined in RESTCONF.
>
> Even so, "exclude" HTTP query parameter is asked for instead of invoking
> a NETCONF get-config RPC.
>
>
IMO XPath is already heavyweight enough for NETCONF and RESTCONF.
Is there a specific document that specifies how QUERY would be used with
YANG datastores?

IMO issues like https://github.com/netconf-wg/netconf-next/issues/24 are
meaningless
without a detailed solution proposal.



--
> Per



Andy