[netconf] Re: RESTCONF RFC8040 questions

Kent Watsen <kent+ietf@watsen.net> Wed, 31 July 2024 17:25 UTC

Return-Path: <0100019109d2e5d8-c914e971-e785-44bb-9a1f-6a2ae763a548-000000@amazonses.watsen.net>
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 2242FC14F6BB for <netconf@ietfa.amsl.com>; Wed, 31 Jul 2024 10:25:07 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.905
X-Spam-Level:
X-Spam-Status: No, score=-1.905 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-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_BLOCKED=0.001, 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 (1024-bit key) header.d=amazonses.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 UkoyghuIQYj6 for <netconf@ietfa.amsl.com>; Wed, 31 Jul 2024 10:25:03 -0700 (PDT)
Received: from a8-88.smtp-out.amazonses.com (a8-88.smtp-out.amazonses.com [54.240.8.88]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 18614C14F5F7 for <netconf@ietf.org>; Wed, 31 Jul 2024 10:25:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug; d=amazonses.com; t=1722446702; h=From:Message-Id:Content-Type:Mime-Version:Subject:Date:In-Reply-To:Cc:To:References:Feedback-ID; bh=1zq07nPa9xKMiF0WEJsoeE6fpQw1IimeffGDKWydJTA=; b=ngZ1EDPxfUhyZhCBZZwUH6VNUfMSNsoZj/B5yn51wBXk3VOi8+o4TP7Wn73ijf/1 zktKo2NTmIPyjGYye/WFJ1DYIcDVKdJTZfs29fDRQV/YbVIVOpQtFjsdk1rbW1N1HwX 3MElsYX+6Ul59N9mdxk61cCNx5Fir8R5saSvUY70=
From: Kent Watsen <kent+ietf@watsen.net>
Message-ID: <0100019109d2e5d8-c914e971-e785-44bb-9a1f-6a2ae763a548-000000@email.amazonses.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_EE32C5E9-D188-4D75-A3A3-7374026F4DB9"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.400.31\))
Date: Wed, 31 Jul 2024 17:25:02 +0000
In-Reply-To: <AS4PR02MB857374F0A0F29BA333ABB95F93AC2@AS4PR02MB8573.eurprd02.prod.outlook.com>
To: Oleg Olivson <O.Olivson=40falconvsystems.com@dmarc.ietf.org>
References: <AS4PR02MB857374F0A0F29BA333ABB95F93AC2@AS4PR02MB8573.eurprd02.prod.outlook.com>
X-Mailer: Apple Mail (2.3774.400.31)
Feedback-ID: ::1.us-east-1.DKmIRZFhhsBhtmFMNikgwZUWVrODEw9qVcPhqJEI2DA=:AmazonSES
X-SES-Outgoing: 2024.07.31-54.240.8.88
Message-ID-Hash: HEECWSOKRXUB7JLJQ2BIR46FX7IRIXBL
X-Message-ID-Hash: HEECWSOKRXUB7JLJQ2BIR46FX7IRIXBL
X-MailFrom: 0100019109d2e5d8-c914e971-e785-44bb-9a1f-6a2ae763a548-000000@amazonses.watsen.net
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-netconf.ietf.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
CC: "netconf@ietf.org" <netconf@ietf.org>
X-Mailman-Version: 3.3.9rc4
Precedence: list
Subject: [netconf] Re: RESTCONF RFC8040 questions
List-Id: NETCONF WG list <netconf.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/netconf/CP2EmirKWsNYmIvW5bMH7Pd8TC8>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netconf>
List-Help: <mailto:netconf-request@ietf.org?subject=help>
List-Owner: <mailto:netconf-owner@ietf.org>
List-Post: <mailto:netconf@ietf.org>
List-Subscribe: <mailto:netconf-join@ietf.org>
List-Unsubscribe: <mailto:netconf-leave@ietf.org>

Hi Oleg,

As list-moderator: your email got stuck in the list’s moderation queue, which I only just now cleared, hence the delay.

See below for more responses.

K.


> On Jul 18, 2024, at 2:58 AM, Oleg Olivson <O.Olivson=40falconvsystems.com@dmarc.ietf.org> wrote:
> 
> Hi,
> I'm working on product which is using RESTCONF and YANGs as configuration interface and I'm struggling trying to understand concepts which are lying behind data modification using RESTCONF.
> Would you be so kind to explain why certain requests are made in a way they're made?
> 
> In RFC8040 https://www.rfc-editor.org/rfc/rfc8040#appendix-B.2 there are some examples of using RESTCONF, I'll be using same model in questions.
> There is an example of adding a resource to list:
> POST /restconf/data/example-jukebox:jukebox/library HTTP/1.1
>       Host: example.com <http://example.com/>
>       Content-Type: application/yang-data+json
> 
>       {
>         "example-jukebox:artist" : [
>           {
>             "name" : "Foo Fighters"
>           }
>         ]
>       }
> Can it be done in way below?
> POST /restconf/data/example-jukebox:jukebox/library/artist HTTP/1.1
>       Host: example.com <http://example.com/>
>       Content-Type: application/yang-data+json      
>       {
>             "example-jukebox:name" : "Foo Fighters"
>           }
> RFC says that target URI in POST should point to parent container of resource to be added, wouldn't it be "artist" in that case and why? 
This is a known issue.  Please see https://github.com/netconf-wg/restconf-next/issues/5.  The plan is for the RESTCONF-next effort to fix it.  For now, all implementations seem to follow as it is written in RFC 8040.


> When doing resource modification, there's certain ambiguity in requests:
> PATCH /restconf/data/example-jukebox:jukebox/\
>           library/artist=Foo%20Fighters/album=Wasting%20Light/\
>           genre HTTP/1.1
>       Host: example.com <http://example.com/>
>       If-Unmodified-Since: Thu, 26 Jan 2017 20:56:30 GMT
>       Content-Type: application/yang-data+json
> 
>       { "example-jukebox:genre" : "example-jukebox:alternative" }
> "genre" work must occur twice: as part of URI and as top key of payload. Why such ambiguity take place? Since JSON is not limited to objects, can it be reduced to view below?
> PATCH /restconf/data/example-jukebox:jukebox/\
>           library/artist=Foo%20Fighters/album=Wasting%20Light/\
>           genre HTTP/1.1
>       Host: example.com <http://example.com/>
>       If-Unmodified-Since: Thu, 26 Jan 2017 20:56:30 GMT
>       Content-Type: application/yang-data+json
> 
>       "example-jukebox:alternative"
> 
> 
> 
> Taking into account mentioned difference between POST and PUT|PATCH requests, is there a rules that define which URL<->Body relation to use issuing each type of request?
I’ll defer to others to respond.


> Hope you won't be bothered with these questions and answering them won't take much of your time.
> With gratitude for work you've done in those RFC.

Thank you for your message!

Kent