Re: [YANG] 7.6, default value for a type

Andy Bierman <ietf@andybierman.com> Sun, 13 January 2008 23:28 UTC

Return-path: <yang-bounces@ietf.org>
Received: from [127.0.0.1] (helo=stiedprmman1.va.neustar.com) by megatron.ietf.org with esmtp (Exim 4.43) id 1JECFM-0001B1-NH; Sun, 13 Jan 2008 18:28:08 -0500
Received: from yang by megatron.ietf.org with local (Exim 4.43) id 1JECFL-00016y-Gu for yang-confirm+ok@megatron.ietf.org; Sun, 13 Jan 2008 18:28:07 -0500
Received: from [10.91.34.44] (helo=ietf-mx.ietf.org) by megatron.ietf.org with esmtp (Exim 4.43) id 1JECFK-00015S-V6 for yang@ietf.org; Sun, 13 Jan 2008 18:28:06 -0500
Received: from smtp113.sbc.mail.re2.yahoo.com ([68.142.229.92]) by ietf-mx.ietf.org with smtp (Exim 4.43) id 1JECFK-0007qW-Js for yang@ietf.org; Sun, 13 Jan 2008 18:28:06 -0500
Received: (qmail 56520 invoked from network); 13 Jan 2008 23:28:05 -0000
Received: from unknown (HELO ?192.168.0.10?) (andybierman@att.net@67.126.240.103 with plain) by smtp113.sbc.mail.re2.yahoo.com with SMTP; 13 Jan 2008 23:28:05 -0000
X-YMail-OSG: ffI.LpAVM1k56COqZP.zx71kqvD8SjkRxZCPHY9E_BuGDKOgu5VVsCHbf0iq2BlE3MlTvzlTna9WnPHmtHAVxq2slVlYOza8BR5pBEUnC4YYXGWsfQ38
Message-ID: <478A9EB5.9060800@andybierman.com>
Date: Sun, 13 Jan 2008 15:28:53 -0800
From: Andy Bierman <ietf@andybierman.com>
User-Agent: Thunderbird 2.0.0.9 (Windows/20071031)
MIME-Version: 1.0
To: Martin Bjorklund <mbj@tail-f.com>
Subject: Re: [YANG] 7.6, default value for a type
References: <47880961.1030506@andybierman.com> <20080113.223852.227441890.mbj@tail-f.com>
In-Reply-To: <20080113.223852.227441890.mbj@tail-f.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Scan-Signature: 52e1467c2184c31006318542db5614d5
Cc: yang@ietf.org
X-BeenThere: yang@ietf.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: YANG modeling Language for NETCONF <yang.ietf.org>
List-Unsubscribe: <https://www1.ietf.org/mailman/listinfo/yang>, <mailto:yang-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www1.ietf.org/pipermail/yang>
List-Post: <mailto:yang@ietf.org>
List-Help: <mailto:yang-request@ietf.org?subject=help>
List-Subscribe: <https://www1.ietf.org/mailman/listinfo/yang>, <mailto:yang-request@ietf.org?subject=subscribe>
Errors-To: yang-bounces@ietf.org

Martin Bjorklund wrote:
> Andy Bierman <andy@andybierman.com> wrote:
>> Hi,
>>
>> Sec 7.6, para 5 says:
>>
>>     If a leaf has a "default" statement, the leaf's default value is set
>>     to the value of the "default" statement.  Otherwise, if the leaf's
>>     type has a default value, and the leaf is not mandatory, then the
>>     leaf's default value is set to the type's default value.  In all
>>     other cases, the leaf does not have a default value.
>>
>> The default value for each builtin type is not defined anywhere.
> 
> This is supposed to be a feature, not a bug.  If every type has a
> default, you will never be able to define optional leafs.
> 


The text is misleading.
The builtin types do not have default values(good!)
The order to check the default-stmt is 1) leaf 2) typedef


>> This is a nice detail, and covers things like the agent creating
>> a bunch of counter objects or ifOperStatus objects.
> 
> Yes.  Define ifOperStatus with a default, or use a type with a
> default.
> 
> 
> /martin
> 


Andy


_______________________________________________
YANG mailing list
YANG@ietf.org
https://www1.ietf.org/mailman/listinfo/yang