Re: [YANG] Choice and uses statement

Martin Bjorklund <mbj@tail-f.com> Fri, 18 January 2008 11:38 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 1JFpYX-0006S1-BF; Fri, 18 Jan 2008 06:38:41 -0500
Received: from yang by megatron.ietf.org with local (Exim 4.43) id 1JFpYW-0006Rw-Bn for yang-confirm+ok@megatron.ietf.org; Fri, 18 Jan 2008 06:38:40 -0500
Received: from [10.91.34.44] (helo=ietf-mx.ietf.org) by megatron.ietf.org with esmtp (Exim 4.43) id 1JFpYW-0006Ro-0W for yang@ietf.org; Fri, 18 Jan 2008 06:38:40 -0500
Received: from [213.180.94.162] (helo=mail.tail-f.com) by ietf-mx.ietf.org with esmtp (Exim 4.43) id 1JFpYU-0005j2-KI for yang@ietf.org; Fri, 18 Jan 2008 06:38:39 -0500
Received: from localhost (138.162.241.83.in-addr.dgcsystems.net [83.241.162.138]) by mail.tail-f.com (Postfix) with ESMTP id 590621B80C9; Fri, 18 Jan 2008 12:38:36 +0100 (CET)
Date: Fri, 18 Jan 2008 12:39:47 +0100 (CET)
Message-Id: <20080118.123947.237218225.mbj@tail-f.com>
To: liyan_77@huawei.com
Subject: Re: [YANG] Choice and uses statement
From: Martin Bjorklund <mbj@tail-f.com>
In-Reply-To: <000b01c859bd$1f4fe5c0$ec0c6f0a@china.huawei.com>
References: <000b01c859bd$1f4fe5c0$ec0c6f0a@china.huawei.com>
X-Mailer: Mew version 5.1.51 on Emacs 22.1 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Scan-Signature: e5ba305d0e64821bf3d8bc5d3bb07228
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

Li Yan <liyan_77@huawei.com> wrote:
> Hi,
> 
> Why the "uses" statement is not able to reference the "choice" definition?
> If it can, the "choice" definition would be allowed to be reused.

uses always references a named grouping.  The grouping can contain a
choice, so you can do:

   grouping protocol-type {
     choice proto {
       case tcp { ... }
       case udp { ... }
     }
   }

And then:

   uses protocol-type;


> I noticed that the "choice" statement can be contained immediately in the
> "module" and "submodule" statement. I wonder how to make use of this
> "choice" definition?

'choice' is one of the "data-definition statements" in YANG.  All
data-definitions are allowed at the top-level.  We didn't really see a
reason to restrict these usages.


/martin


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