Re: [YANG] 7.6, default value for a type
Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de> Sun, 13 January 2008 13:43 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 1JE37c-0001RE-Lp; Sun, 13 Jan 2008 08:43:33 -0500
Received: from yang by megatron.ietf.org with local (Exim 4.43)
id 1JE37b-0001Dx-0C
for yang-confirm+ok@megatron.ietf.org; Sun, 13 Jan 2008 08:43:31 -0500
Received: from [10.91.34.44] (helo=ietf-mx.ietf.org)
by megatron.ietf.org with esmtp (Exim 4.43) id 1JE37U-0000lD-3T
for yang@ietf.org; Sun, 13 Jan 2008 08:43:24 -0500
Received: from hermes.jacobs-university.de ([212.201.44.23])
by ietf-mx.ietf.org with esmtp (Exim 4.43) id 1JE37S-00074Y-EB
for yang@ietf.org; Sun, 13 Jan 2008 08:43:24 -0500
Received: from localhost (demetrius.jacobs-university.de [212.201.44.32])
by hermes.jacobs-university.de (Postfix) with ESMTP id 526B68A32E;
Sun, 13 Jan 2008 14:43:21 +0100 (CET)
Received: from hermes.jacobs-university.de ([212.201.44.23])
by localhost (demetrius.jacobs-university.de [212.201.44.32])
(amavisd-new, port 10024)
with ESMTP id 13935-07; Sun, 13 Jan 2008 14:43:16 +0100 (CET)
Received: from elstar.local (elstar.iuhb02.iu-bremen.de [10.50.231.133])
by hermes.jacobs-university.de (Postfix) with ESMTP id DA1858A329;
Sun, 13 Jan 2008 14:43:16 +0100 (CET)
Received: by elstar.local (Postfix, from userid 501)
id 94CBF465D70; Sun, 13 Jan 2008 14:43:15 +0100 (CET)
Date: Sun, 13 Jan 2008 14:43:15 +0100
From: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
To: Andy Bierman <andy@andybierman.com>
Subject: Re: [YANG] 7.6, default value for a type
Message-ID: <20080113134315.GA25434@elstar.local>
Mail-Followup-To: Andy Bierman <andy@andybierman.com>,
yang <yang@ietf.org>
References: <47880961.1030506@andybierman.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <47880961.1030506@andybierman.com>
User-Agent: Mutt/1.5.17 (2007-11-01)
X-Virus-Scanned: amavisd-new 2.3.3 (20050822) at jacobs-university.de
X-Spam-Score: 0.0 (/)
X-Scan-Signature: a7d6aff76b15f3f56fcb94490e1052e4
Cc: yang <yang@ietf.org>
X-BeenThere: yang@ietf.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: j.schoenwaelder@jacobs-university.de
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
On Fri, Jan 11, 2008 at 04:27:13PM -0800, Andy Bierman wrote:
> 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 a nice detail, and covers things like the agent creating
> a bunch of counter objects or ifOperStatus objects.
>
> It mandates that a specific value will be used, not random values.
>
> What are the specific values?
>
> - int8 to uint64: 0
> - float32, float64: 0.0
> - string, binary, instance-identifier: empty string
> - enumeration: ??? (!) [first value?]
> - boolean: false
> - bits: empty bitset
> - keyref: default for data type of 'path'
Why not leave it undefined? It is easy to define defaults:
typedef int8-zero {
type int8;
default 0;
}
If we hard wire defaults, it will be a pain to define a type which
does not have a default, e.g. for an SNMP counter.
/js
--
Juergen Schoenwaelder Jacobs University Bremen gGmbH
Phone: +49 421 200 3587 Campus Ring 1, 28759 Bremen, Germany
Fax: +49 421 200 3103 <http://www.jacobs-university.de/>
_______________________________________________
YANG mailing list
YANG@ietf.org
https://www1.ietf.org/mailman/listinfo/yang
- [YANG] 7.6, default value for a type Andy Bierman
- Re: [YANG] 7.6, default value for a type Juergen Schoenwaelder
- Re: [YANG] 7.6, default value for a type Martin Bjorklund
- Re: [YANG] 7.6, default value for a type Andy Bierman
- Re: [YANG] 7.6, default value for a type Martin Bjorklund
- Re: [YANG] 7.6, default value for a type Martin Bjorklund