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

Kent Watsen <kent+ietf@watsen.net> Fri, 21 June 2019 21:24 UTC

Return-Path: <0100016b7bed5571-8bf0b1c4-db4e-499a-8728-610ea56c54d9-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 AD0D312008A for <netconf@ietfa.amsl.com>; Fri, 21 Jun 2019 14:24:43 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.896
X-Spam-Level:
X-Spam-Status: No, score=-1.896 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, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=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 pb4UDX6_l1qc for <netconf@ietfa.amsl.com>; Fri, 21 Jun 2019 14:24:41 -0700 (PDT)
Received: from a8-33.smtp-out.amazonses.com (a8-33.smtp-out.amazonses.com [54.240.8.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 7CB07120019 for <netconf@ietf.org>; Fri, 21 Jun 2019 14:24:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw; d=amazonses.com; t=1561152280; h=From:Content-Type:Mime-Version:Subject:Date:References:To:In-Reply-To:Message-Id:Feedback-ID; bh=AxLVFZ4eEQxoSnjjUFfVO7teDMvYyi8HNa33aFAR56s=; b=MjfyyZi6FJcgxYjayY+WpYOXAoKuo/wRZEQ23rH6s+862EoDOfOxFFyzeotHi/XD V0/4t7OPumClaNf53Jyv4DTpMQ2Cq3sVrUXs1JlC9onw+BGP7mZnI+GLE51FAu05qkg Zz6TAC/yXtpW+tVN95wfVZJwC8ybuFT+af6pXnLE=
From: Kent Watsen <kent+ietf@watsen.net>
Content-Type: multipart/alternative; boundary="Apple-Mail=_66376AF2-E624-44CF-8FDB-62C26DDF4285"
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\))
Date: Fri, 21 Jun 2019 21:24:40 +0000
References: <0100016b7a7ca57b-bedf88a1-e867-4d0d-a44a-94964a93ccbb-000000@email.amazonses.com>
To: "netconf@ietf.org" <netconf@ietf.org>
In-Reply-To: <0100016b7a7ca57b-bedf88a1-e867-4d0d-a44a-94964a93ccbb-000000@email.amazonses.com>
Message-ID: <0100016b7bed5571-8bf0b1c4-db4e-499a-8728-610ea56c54d9-000000@email.amazonses.com>
X-Mailer: Apple Mail (2.3445.104.11)
X-SES-Outgoing: 2019.06.21-54.240.8.33
Feedback-ID: 1.us-east-1.DKmIRZFhhsBhtmFMNikgwZUWVrODEw9qVcPhqJEI2DA=:AmazonSES
Archived-At: <https://mailarchive.ietf.org/arch/msg/netconf/hRB6sEhKTICyM4WZmVnvfRS4_mQ>
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: Fri, 21 Jun 2019 21:24:44 -0000

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> 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
> https://www.ietf.org/mailman/listinfo/netconf