Re: [YANG] mandatory empty

Martin Bjorklund <mbj@tail-f.com> Mon, 04 February 2008 19:47 UTC

Return-Path: <yang-bounces@ietf.org>
X-Original-To: ietfarch-yang-archive@core3.amsl.com
Delivered-To: ietfarch-yang-archive@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 293923A7139; Mon, 4 Feb 2008 11:47:49 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.675
X-Spam-Level:
X-Spam-Status: No, score=-1.675 tagged_above=-999 required=5 tests=[AWL=0.924, BAYES_00=-2.599]
Received: from core3.amsl.com ([127.0.0.1]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Re5NjzlWdoxR; Mon, 4 Feb 2008 11:47:49 -0800 (PST)
Received: from core3.amsl.com (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 3F5223A70F8; Mon, 4 Feb 2008 11:47:40 -0800 (PST)
X-Original-To: yang@core3.amsl.com
Delivered-To: yang@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 815973A6ECE for <yang@core3.amsl.com>; Mon, 4 Feb 2008 11:47:38 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
Received: from core3.amsl.com ([127.0.0.1]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LaKf0C93cW6O for <yang@core3.amsl.com>; Mon, 4 Feb 2008 11:47:37 -0800 (PST)
Received: from mail.tail-f.com (mail.tail-f.com [213.180.94.158]) by core3.amsl.com (Postfix) with ESMTP id A27773A6FFE for <yang@ietf.org>; Mon, 4 Feb 2008 11:45:32 -0800 (PST)
Received: from localhost (c213-100-166-13.swipnet.se [213.100.166.13]) by mail.tail-f.com (Postfix) with ESMTP id 224D81B80CF; Mon, 4 Feb 2008 20:47:06 +0100 (CET)
Date: Mon, 04 Feb 2008 20:46:56 +0100 (CET)
Message-Id: <20080204.204656.247665076.mbj@tail-f.com>
To: ietf@andybierman.com
From: Martin Bjorklund <mbj@tail-f.com>
In-Reply-To: <47A756C9.8000401@andybierman.com>
References: <47A756C9.8000401@andybierman.com>
X-Mailer: Mew version 5.2.52 on Emacs 22.1 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Cc: yang@ietf.org
Subject: Re: [YANG] mandatory empty
X-BeenThere: yang@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: YANG modeling Language for NETCONF <yang.ietf.org>
List-Unsubscribe: <http://www.ietf.org/mailman/listinfo/yang>, <mailto:yang-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/pipermail/yang>
List-Post: <mailto:yang@ietf.org>
List-Help: <mailto:yang-request@ietf.org?subject=help>
List-Subscribe: <http://www.ietf.org/mailman/listinfo/yang>, <mailto:yang-request@ietf.org?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: yang-bounces@ietf.org
Errors-To: yang-bounces@ietf.org

Andy Bierman <ietf@andybierman.com> wrote:
> Hi,
> 
> What does this mean exactly?
> 
>    leaf foo {
>      type empty;
>      mandatory true;
>    }
> 
> Does this translate to:
> 
>    <element name='foo' minOccurs='0'/>

No, b/c the default type in XSD is anyType, which means any xml.  And
if it's mandatory, it should be minOccurs='1' (which is the default).
But it depends on what your XSD is supposed to validate - a NETCONF
PDU or the datastore.

I translate this into:

      <xs:element name="foo">
        <xs:complexType/>
      </xs:element>

> The empty data type can be modeled in XSD as an empty complexType:
> 
>    <complexType name='empty'/>

Yes.

> Can it be modeled as a simpleType?
> 
>    <simpleType name='empty'>
>      <restriction base='xs:string'>
>        <maxLength value='0'/>
>      </restriction>
>    </simpleType>

I don't know.  Maybe?

> If mandatory means that the manager must supply a value,
> then the leaf 'foo' can never be missing.
> 
> Even if it means the agent must supply a value,
> it still seems strange.  Perhaps more text is needed
> about the empty data type.
> 
> IMO, 'mandatory' and 'units' are not applicable to built-in type 'empty'.

I agree that units on a type empty seems weird.

mandatory true on type empty also seems weird, since a type empty leaf
provides a single bit of information (in its existance).  So if it
always has to be there, what is the point?

I don't know if we have to make this an error though.


/martin
_______________________________________________
YANG mailing list
YANG@ietf.org
http://www.ietf.org/mailman/listinfo/yang