Re: [netmod] YANG 1.1 Default for Mandatory Statement

Martin Bjorklund <mbj@tail-f.com> Wed, 07 May 2014 07:27 UTC

Return-Path: <mbj@tail-f.com>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id AC5061A067D for <netmod@ietfa.amsl.com>; Wed, 7 May 2014 00:27:37 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.552
X-Spam-Level:
X-Spam-Status: No, score=-2.552 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RP_MATCHES_RCVD=-0.651, SPF_PASS=-0.001] autolearn=ham
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 JeLR1KuDwuqM for <netmod@ietfa.amsl.com>; Wed, 7 May 2014 00:27:36 -0700 (PDT)
Received: from mail.tail-f.com (mail.tail-f.com [109.74.15.94]) by ietfa.amsl.com (Postfix) with ESMTP id 6CF441A065D for <netmod@ietf.org>; Wed, 7 May 2014 00:27:36 -0700 (PDT)
Received: from localhost (138.162.241.83.in-addr.dgcsystems.net [83.241.162.138]) by mail.tail-f.com (Postfix) with ESMTPSA id 09C4D3F4012; Wed, 7 May 2014 09:27:32 +0200 (CEST)
Date: Wed, 07 May 2014 09:27:31 +0200
Message-Id: <20140507.092731.422274944402181413.mbj@tail-f.com>
To: powladi@cisco.com
From: Martin Bjorklund <mbj@tail-f.com>
In-Reply-To: <013A9B371AC6DF4C8AD261897D8F243E10AAE090@xmb-aln-x08.cisco.com>
References: <013A9B371AC6DF4C8AD261897D8F243E10AAE090@xmb-aln-x08.cisco.com>
X-Mailer: Mew version 6.5 on Emacs 23.4 / Mule 6.0 (HANACHIRUSATO)
Mime-Version: 1.0
Content-Type: Text/Plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Archived-At: http://mailarchive.ietf.org/arch/msg/netmod/7YZ7-RMlarcro5wz-0m69e0S9mA
Cc: netmod@ietf.org
Subject: Re: [netmod] YANG 1.1 Default for Mandatory Statement
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.15
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: <http://www.ietf.org/mail-archive/web/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: Wed, 07 May 2014 07:27:37 -0000

Hi,

Added as Y52.


/martin



"Peyman Owladi -X (powladi - Ensoft Ltd at Cisco)" <powladi@cisco.com> wrote:
> Issue:
> 
> 
> 
> There can be containers which contain a set of fields which are all mandatory, and currently each leaf needs to be individually tagged as mandatory. For readability, it would be good to be able to indicate that everything within a subtree is mandatory.
> 
> 
> 
> This can be useful in two scenarios: Firstly when multiple leaves make up a single logical "block" of data (as close as it gets to a complex type); and secondly when a container (in particular in operational data) has a large number of leaves, all of which are mandatory.
> 
> 
> 
> Example:
> 
> 
> 
> grouping lacp-system-id-group {
> 
>   container lacp-system-id {
> 
>     presence;
> 
>     leaf id  { type uint16; mandatory true; }
> 
>     leaf mac { type yang:mac-address; mandatory true; }
> 
>   }
> 
> }
> 
> 
> 
> Solution:
> 
> 
> 
> Enable the "mandatory" keyword under lists, containers, and case statements. In this usage, the keyword would apply to all contained leaves.
> 
> (This is effectively a parallel of how the "config" statement works as described in RFC 6020.)
> 
> 
> 
> container lacp-system-id {
> 
>   presence;
> 
>   mandatory true;
> 
>   leaf id  { type uint16; }
> 
>   leaf mac { type yang:mac-address; }
> 
> }
> 
> 
> 
> Alternative solution:
> 
> 
> 
> Add a new "default-mandatory" keyword  that's supported under lists, containers and case-statements, with values "true" and "false", which sets the default state of the mandatory keyword for elements contained. (This avoids overloading the keyword, but
> 
> 
> 
> container lacp-system-id {
> 
>   presence;
> 
>   default-mandatory true;
> 
>   leaf id  { type uint16; }
> 
>   leaf mac { type yang:mac-address; }
> 
> }
> 
>