Re: [netconf] Question on restconf empty list reply

Olof Hagsand <olof@hagsand.se> Tue, 25 February 2020 20:02 UTC

Return-Path: <olof@hagsand.se>
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 7272A3A1419 for <netconf@ietfa.amsl.com>; Tue, 25 Feb 2020 12:02:37 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.897
X-Spam-Level:
X-Spam-Status: No, score=-1.897 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
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 PxcrZEUXY-Sm for <netconf@ietfa.amsl.com>; Tue, 25 Feb 2020 12:02:34 -0800 (PST)
Received: from smtp2.outgoing.loopia.se (smtp2.outgoing.loopia.se [93.188.3.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 7F4313A131D for <netconf@ietf.org>; Tue, 25 Feb 2020 12:02:33 -0800 (PST)
Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id DDAA12E778B7 for <netconf@ietf.org>; Tue, 25 Feb 2020 21:02:28 +0100 (CET)
Received: from s630.loopia.se (unknown [172.22.191.5]) by s807.loopia.se (Postfix) with ESMTP id BEC3A2E27FAF; Tue, 25 Feb 2020 21:02:28 +0100 (CET)
Received: from s474.loopia.se (unknown [172.22.191.6]) by s630.loopia.se (Postfix) with ESMTP id B30A913ABEC7; Tue, 25 Feb 2020 21:02:28 +0100 (CET)
X-Virus-Scanned: amavisd-new at amavis.loopia.se
Received: from s498.loopia.se ([172.22.191.6]) by s474.loopia.se (s474.loopia.se [172.22.190.14]) (amavisd-new, port 10024) with LMTP id p8NpDzpWxVFr; Tue, 25 Feb 2020 21:02:28 +0100 (CET)
X-Loopia-Auth: user
X-Loopia-User: olof@hagsand.se
X-Loopia-Originating-IP: 85.227.89.255
Received: from [10.0.0.14] (ua-85-227-89-255.bbcust.telenor.se [85.227.89.255]) (Authenticated sender: olof@hagsand.se) by s498.loopia.se (Postfix) with ESMTPSA id 17611470830; Tue, 25 Feb 2020 21:02:28 +0100 (CET)
To: Martin Björklund <mbj+ietf@4668.se>
Cc: netconf@ietf.org
References: <4bca4ca8-0d9f-d986-4521-5c808a6e8a4d@hagsand.se> <20200224.201727.524298611078512416.id@4668.se>
From: Olof Hagsand <olof@hagsand.se>
Message-ID: <70fdf9ba-9b48-8cba-a3c2-1366b5a37a8f@hagsand.se>
Date: Tue, 25 Feb 2020 21:02:27 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1
MIME-Version: 1.0
In-Reply-To: <20200224.201727.524298611078512416.id@4668.se>
Content-Type: text/plain; charset="utf-8"
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/netconf/ewvD_d-vk0JZfXbn0T8KE6AikQg>
Subject: Re: [netconf] Question on restconf empty list reply
X-BeenThere: netconf@ietf.org
X-Mailman-Version: 2.1.29
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: Tue, 25 Feb 2020 20:02:38 -0000

On 2020-02-24 20:17, Martin Björklund wrote:
> Hi,
> 
> Olof Hagsand <olof@hagsand.se> wrote:
>> Hello,
>> In a restconf GET request of an empty YANG list using JSON encoding,
>> what is the expected reply? I.e. using a yang list "x" in module "m"
>> (pseudo http):
>>   GET /restconf/data/m:x
>>   Accept: application/yang-data+json
>>
>> Is the reply (1):
>>   HTTP/1.1 200 OK
>>   {
>>     "m:x": []
>>   }
>>
>> or should it be (2)
>>   "404 Not Found" status-line and error-tag value "invalid-value"?
> 
> It should be 404, even if the list contains some entries.  The reason
> for this is that there is no resource for the list itself, only for
> list entries.  See section 3.5 of RFC 8040.
> 
> We used to have "collections" for this use case, but it was never finished.

OK,

I find that explanation semantically sound, although somewhat
disappointing from a usability perspective.
But it makes sense and avoids the pitfalls of differences between
non-existent and empty lists, for example.
But as mentioned elsewhere, I then find paragraph 5 of section 3.5 of
RFC 8040 confusing at best, or even irrelevant, if this is the correct
interpretation.

Thanks.
--Olof


> 
> 
> /martin
> 
> 
>>
>> Apologizes that this is a basic question, and I am sure this is resolved
>> properly, but we have some discussions with users on how to properly
>> interpret the description of GET in RFC 8040 Section 4.3 and RFC 7951.
>>
>> Regards,
>> Olof Hagsand,
>> Clixon maintainer
>>
>> _______________________________________________
>> netconf mailing list
>> netconf@ietf.org
>> https://www.ietf.org/mailman/listinfo/netconf