Re: [netmod] guidelines for top-level nodes in RFC 8407

Ladislav Lhotka <lhotka@nic.cz> Fri, 22 March 2019 10:12 UTC

Return-Path: <lhotka@nic.cz>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id E15D1126C01 for <netmod@ietfa.amsl.com>; Fri, 22 Mar 2019 03:12:23 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.999
X-Spam-Level:
X-Spam-Status: No, score=-6.999 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_HI=-5, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=nic.cz
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 3UfJ8nw1S-Ws for <netmod@ietfa.amsl.com>; Fri, 22 Mar 2019 03:12:20 -0700 (PDT)
Received: from mail.nic.cz (mail.nic.cz [IPv6:2001:1488:800:400::400]) (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 142CC1277CE for <netmod@ietf.org>; Fri, 22 Mar 2019 03:12:19 -0700 (PDT)
Received: from birdie (unknown [IPv6:2001:1488:fffe:6:bcc9:97ff:fe48:2ab0]) by mail.nic.cz (Postfix) with ESMTPSA id BB96C607AD for <netmod@ietf.org>; Fri, 22 Mar 2019 11:12:16 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1553249536; bh=gCuLtdUxjlErH4rOaiaZATAQssLnTQUOG0WAjhgXBxo=; h=From:To:Date; b=lhLkmsb2SdxQQ+rlA7IO6dkGEQe5SBMtqaeR7MXsLHWOaxdyG6CDt/y21DF9YvpAs jPg3FPZZVHhf/l+tYTyFn+MZGOrEN9iK1cL2YQVPcyyMXe0RmBHHleuv81MH37fCyW W3y5oVj5cCb4XCxXF5YO92aMvWbibfMrHw+7BOyY=
Message-ID: <64219162d7fbcea83796e37f01f4cf9648b5573b.camel@nic.cz>
From: Ladislav Lhotka <lhotka@nic.cz>
To: netmod@ietf.org
Date: Fri, 22 Mar 2019 11:12:16 +0100
In-Reply-To: <20190322.102400.1417118397166044745.mbj@tail-f.com>
References: <20190322.102400.1417118397166044745.mbj@tail-f.com>
Organization: CZ.NIC
Content-Type: text/plain; charset="UTF-8"
User-Agent: Evolution 3.32.0
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: clamav-milter 0.99.2 at mail
X-Virus-Status: Clean
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/S_s67DD9FUyv9o99B4p7THx5cRE>
Subject: Re: [netmod] guidelines for top-level nodes in RFC 8407
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 22 Mar 2019 10:12:24 -0000

On Fri, 2019-03-22 at 10:24 +0100, Martin Bjorklund wrote:
> Hi,
> 
> RFC 8407, section 4.10 says:
> 
>    A mandatory database data definition is defined as a node that a
>    client must provide for the database to be valid.  The server is not
>    required to provide a value.
> 
>    Top-level database data definitions MUST NOT be mandatory.

The term "database" is somewhat unclear. Other documents use "datastore".

> 
> The objective for this rule is to avoid a situation where a module cannot
> be loaded w/o providing additional config, or a situation where you
> can't boot a server w/o additional config.

In fact, this issue is related to the semantics of a particular datastore. For
example, mandatory top-level nodes make a very good sense in <operational>. If I
remember correctly, the NACM module has some.

> 
> 
> Consider this snippet:
> 
>   container top {
>     leaf foo {
>       type int32;
>       default 0;
>     }
>     leaf bar {
>       when '../foo = 42';
>       mandatory true;
>       type int32;
>     }
>   }
> 
> 
> Is /top/bar considered a mandatory top level node?

Of course it is, as well as the /top, per definition in RFC 7950:

   o  mandatory node: A mandatory node is one of:

      *  A leaf, choice, anydata, or anyxml node with a "mandatory"
         statement with the value "true".

      *  A list or leaf-list node with a "min-elements" statement with a
         value greater than zero.

      *  A container node without a "presence" statement and that has at
         least one mandatory node as a child.

> 
> IMO it doesn't violate the spirit of the rule.  So the question is; is
> this allowed?

My answer is that the mandatory property is a syntactic/schema constraint
whereas "when" should be treated as a semantic rule because its expression has
to be evaluated on a particular instance. As such, it should not interfere with
schema constraints including mandatory.

If the when expression is more complicated (e.g. involves data from other
modules), it may not be possible to determine just by looking at a single module
whether an empty datastore is valid or not.

Even in your trivial example, what if an implementation adds a deviation module
changing the default for /top/foo to 42?

Lada

> 
> 
> /martin
> 
> P.S. the real data model is a potential solution to a problem with
> ietf-alarms from draft-ietf-ccamp-alarm-module:
> 
>       leaf notify-status-changes {
>         type enumeration {
>           enum all-state-changes {
>             ...
>           }
>           enum raise-and-clear {
>             ...
>           }
>           enum severity-level {
>             ...
>           }
>         }
>         default "all-state-changes";
>         description
>           ...
>       }
>       leaf notify-severity-level {
>         when '../notify-status-changes = "severity-level"';
>         type severity;
>         mandatory true;
>         ...
>       }
> 
> 
> pyang complains that this violates the cited rule.
> 
> D.S.
> 
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod
-- 
Ladislav Lhotka
Head, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67