Re: [netconf] restconf 'get' on non-presence container

Kent Watsen <kent+ietf@watsen.net> Sat, 22 June 2019 23:18 UTC

Return-Path: <0100016b817c39d7-61fd3ee0-e74b-436d-a50b-0f0f0212cdf4-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 CF75612004A for <netconf@ietfa.amsl.com>; Sat, 22 Jun 2019 16:18:53 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.312
X-Spam-Level:
X-Spam-Status: No, score=-2.312 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_MSPIKE_H2=-0.415, SPF_HELO_NONE=0.001, SPF_NONE=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 ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YEyw9KERvIL9 for <netconf@ietfa.amsl.com>; Sat, 22 Jun 2019 16:18:52 -0700 (PDT)
Received: from a8-31.smtp-out.amazonses.com (a8-31.smtp-out.amazonses.com [54.240.8.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id E2771120047 for <netconf@ietf.org>; Sat, 22 Jun 2019 16:18:51 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw; d=amazonses.com; t=1561245530; h=From:Content-Type:Mime-Version:Subject:Date:References:To:In-Reply-To:Message-Id:Feedback-ID; bh=lKfQdN14HXtW0w2A3Qch6WorC+o7rgq7uQ6JSB3Xblw=; b=hEareO52ghj530FBJXTd+zSBzWT6gVcyLqy86POx1HUmc3yuMekkUxSztC9ywpVq tCpCqAFP9P6lfw6aM0Rr6jl3honbdx5kPUv6tIiX5RROFyCIUZ6hJ1M3yHvALzMYmrR MYDuUEsDgG6iucMImta387ToFcgN+GAxPX9Zkre4=
From: Kent Watsen <kent+ietf@watsen.net>
Content-Type: multipart/alternative; boundary="Apple-Mail=_07606880-77DE-48A5-8687-BEF4952B81AF"
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\))
Date: Sat, 22 Jun 2019 23:18:50 +0000
References: <0100016b7a7ca57b-bedf88a1-e867-4d0d-a44a-94964a93ccbb-000000@email.amazonses.com> <0100016b7bed5571-8bf0b1c4-db4e-499a-8728-610ea56c54d9-000000@email.amazonses.com>
To: "netconf@ietf.org" <netconf@ietf.org>
In-Reply-To: <0100016b7bed5571-8bf0b1c4-db4e-499a-8728-610ea56c54d9-000000@email.amazonses.com>
Message-ID: <0100016b817c39d7-61fd3ee0-e74b-436d-a50b-0f0f0212cdf4-000000@email.amazonses.com>
X-Mailer: Apple Mail (2.3445.104.11)
X-SES-Outgoing: 2019.06.22-54.240.8.31
Feedback-ID: 1.us-east-1.DKmIRZFhhsBhtmFMNikgwZUWVrODEw9qVcPhqJEI2DA=:AmazonSES
Archived-At: <https://mailarchive.ietf.org/arch/msg/netconf/6Ma7dHNFhT-MfhNXVv_JL538b78>
Subject: Re: [netconf] restconf 'get' on non-presence container
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: Sat, 22 Jun 2019 23:18:54 -0000

Applying the same "client-usage history" logic to POST leads to an unfriendly result.  Specifically, a POST should return 404 if the parent NP-container (e.g., "/foo:widgets") doesn't exist, but a friendlier implementation would silently create all the ancestor NP-containers.  

Same applies to DELETE.  404 should be returned if the NP-container ("/foo:widgets") doesn't exist, but a friendlier option would be to always return 204.  This view is further supported by RFC 8040 saying "The resource must exist or the DELETE method will fail."

Kent // contributor


> On Jun 21, 2019, at 5:24 PM, Kent Watsen <kent+ietf@watsen.net> wrote:
> 
> Reviewing the very long "What should a server response be?" thread from 2016-07-11, it seems that the answer might be:
> 
>     4) depends on client-usage history (i.e., sometimes
>         404 and sometimes 200 with an empty response).
> 
> Specifically, it seems that servers proactively creating or removing NP-containers is not desirable.
> 
> PS: I created https://github.com/netmod-wg/yang-next/issues/88 <https://github.com/netmod-wg/yang-next/issues/88>.
> 
> Kent // contributor
> 
> 
> 
> 
>> On Jun 21, 2019, at 10:41 AM, Kent Watsen <kent+ietf@watsen.net <mailto:kent+ietf@watsen.net>> wrote:
>> 
>> Given:
>> 
>>  module foo {
>>    ...
>>    container widgets {   <--- NOT a presence container
>>      list widget {
>>        ...
>>      }
>>    }
>>  }
>> 
>> Assuming no widgets have been configured, would a GET on "/foo:widgets"
>> return:
>> 
>>    1) 200 with an empty response (i.e., <widgets xmlns="..."/>
>>    2) 404 (Not Found)
>>    3) It's up to the implementation
>> 
>> 
>> With NETCONF, or RESTCONF when retrieving an ancestor of an 
>> NP-container, it's clear that RFC 7950, Section 7.5.7 (XML
>> Encoding Rules) comes into play:
>> 
>>   If a non-presence container does not have any child nodes, the
>>   container may or may not be present in the XML encoding.
>> 
>> However, this question regards the GET being on the NP-container itself.
>> That is, it's not an encoding question so much as a protocol question.
>> RFC 8040 doesn't discuss this directly, but Section 4.3 (GET) says:
>> 
>>   If a retrieval request for a data resource represents an instance
>>   that does not exist, then an error response containing a "404 Not
>>   Found" status-line MUST be returned by the server.
>> 
>> Okay, so it does the NP-container "exist" or not?  RFC 7950, Section 
>> 7.5.1 (Containers with Presence) says:
>> 
>>   ...the [non-presence] container has no meaning of its own, existing
>>   only to contain child nodes.  In particular, the presence of the
>>   container node with no child nodes is semantically equivalent to the
>>   absence of the container node.
>> 
>> 
>> Kent
>> 
>> _______________________________________________
>> netconf mailing list
>> netconf@ietf.org <mailto:netconf@ietf.org>
>> https://www.ietf.org/mailman/listinfo/netconf
> 
> _______________________________________________
> netconf mailing list
> netconf@ietf.org
> https://www.ietf.org/mailman/listinfo/netconf