Re: [netconf] Question on restconf empty list reply

Olof Hagsand <olof@hagsand.se> Sun, 23 February 2020 20:01 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 AE22D3A0DD9 for <netconf@ietfa.amsl.com>; Sun, 23 Feb 2020 12:01:44 -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 kw_AWbNI5o6k for <netconf@ietfa.amsl.com>; Sun, 23 Feb 2020 12:01:42 -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 0CC333A0DD5 for <netconf@ietf.org>; Sun, 23 Feb 2020 12:01:41 -0800 (PST)
Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id 219B52E608B1 for <netconf@ietf.org>; Sun, 23 Feb 2020 21:01:37 +0100 (CET)
Received: from s630.loopia.se (unknown [172.22.191.5]) by s807.loopia.se (Postfix) with ESMTP id 0305D2E27DC9; Sun, 23 Feb 2020 21:01:37 +0100 (CET)
Received: from s475.loopia.se (unknown [172.22.191.5]) by s630.loopia.se (Postfix) with ESMTP id EB9C613ABDB1; Sun, 23 Feb 2020 21:01:36 +0100 (CET)
X-Virus-Scanned: amavisd-new at amavis.loopia.se
Received: from s498.loopia.se ([172.22.191.5]) by s475.loopia.se (s475.loopia.se [172.22.190.15]) (amavisd-new, port 10024) with LMTP id BV-LrmXr6V-K; Sun, 23 Feb 2020 21:01:36 +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 60CFB470823; Sun, 23 Feb 2020 21:01:36 +0100 (CET)
To: "Schönwälder, Jürgen" <J.Schoenwaelder@jacobs-university.de>
Cc: "netconf@ietf.org" <netconf@ietf.org>
References: <4bca4ca8-0d9f-d986-4521-5c808a6e8a4d@hagsand.se> <20200223112829.rjd3zf53rybmmzvc@anna.jacobs.jacobs-university.de>
From: Olof Hagsand <olof@hagsand.se>
Message-ID: <6ed11152-ab3d-d42b-f983-908de32bbef8@hagsand.se>
Date: Sun, 23 Feb 2020 21:01:35 +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: <20200223112829.rjd3zf53rybmmzvc@anna.jacobs.jacobs-university.de>
Content-Type: text/plain; charset="utf-8"
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/netconf/tqtARPaiLaLo01ZnknzolXpzf4g>
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: Sun, 23 Feb 2020 20:01:45 -0000

Thank you for the answer!
What does "the empty lists exists or not" mean, how is an existing empty
list different from a non-existent list wrt YANG? I would think that a
YANG list have instances (= it exists), or it does not have instances (=
is empty = does not exist).

Another related question is how the same request but for XML encoding
should be treated, ie a YANG list x with no elements (empty
list/non-existent)?

  GET /restconf/data/m:x
  Accept: application/yang-data+xml

Is the reply "404 Not Found" status-line and error-tag value
"invalid-value" (following the list resource doe snot exist)
or, following the JSON [] (existing empty list) reasoning, a "204 No
Content"?

Again apologizes for these basic questions,
Regards,
Olof Hagsand

On 2020-02-23 12:28, Schönwälder, Jürgen wrote:
> My reading of RFC 7951 section 5.4 is that an empty list results in an
> empty JSON array. A related question is likely whether the empty list
> exists or not. RFC 8040 says a 404 response indicates that the
> resource does not exist (or is not accessible). So both responses may
> be reasonable, depending on the existence/accessibility of the resource.
> 
> /js
> 
> On Sun, Feb 23, 2020 at 12:12:58PM +0100, Olof Hagsand 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"?
>>
>> 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
>