Re: analysis of YANG vs. RELAX NG

Martin Bjorklund <mbj@tail-f.com> Wed, 28 November 2007 22:03 UTC

Return-path: <discuss-bounces@apps.ietf.org>
Received: from [127.0.0.1] (helo=stiedprmman1.va.neustar.com) by megatron.ietf.org with esmtp (Exim 4.43) id 1IxUzp-0005cK-QP; Wed, 28 Nov 2007 17:03:05 -0500
Received: from discuss by megatron.ietf.org with local (Exim 4.43) id 1IxUzo-0005cA-MQ for discuss-confirm+ok@megatron.ietf.org; Wed, 28 Nov 2007 17:03:04 -0500
Received: from [10.91.34.44] (helo=ietf-mx.ietf.org) by megatron.ietf.org with esmtp (Exim 4.43) id 1IxUzo-0005c2-CU for discuss@apps.ietf.org; Wed, 28 Nov 2007 17:03:04 -0500
Received: from [213.180.94.162] (helo=mail.tail-f.com) by ietf-mx.ietf.org with esmtp (Exim 4.43) id 1IxUzl-00065I-ES for discuss@apps.ietf.org; Wed, 28 Nov 2007 17:03:04 -0500
Received: from localhost (c213-100-166-201.swipnet.se [213.100.166.201]) by mail.tail-f.com (Postfix) with ESMTP id EBD6A1B80C5; Wed, 28 Nov 2007 23:02:57 +0100 (CET)
Date: Wed, 28 Nov 2007 23:02:44 +0100
Message-Id: <20071128.230244.254578150.mbj@tail-f.com>
To: rohan.mahy@gmail.com
Subject: Re: analysis of YANG vs. RELAX NG
From: Martin Bjorklund <mbj@tail-f.com>
In-Reply-To: <953beacc0711281025w4d993dd7u77d729111074496c@mail.gmail.com>
References: <953beacc0711271504y7aea5f21jc301ccad886d3611@mail.gmail.com> <474D9194.3060103@ericsson.com> <953beacc0711281025w4d993dd7u77d729111074496c@mail.gmail.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: 082a9cbf4d599f360ac7f815372a6a15
Cc: discuss@apps.ietf.org
X-BeenThere: discuss@apps.ietf.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: general discussion of application-layer protocols <discuss.apps.ietf.org>
List-Unsubscribe: <https://www1.ietf.org/mailman/listinfo/discuss>, <mailto:discuss-request@apps.ietf.org?subject=unsubscribe>
List-Post: <mailto:discuss@apps.ietf.org>
List-Help: <mailto:discuss-request@apps.ietf.org?subject=help>
List-Subscribe: <https://www1.ietf.org/mailman/listinfo/discuss>, <mailto:discuss-request@apps.ietf.org?subject=subscribe>
Errors-To: discuss-bounces@apps.ietf.org

Hi,

"Rohan Mahy" <rohan.mahy@gmail.com> wrote:
> Setting that aside for a moment, even if half the statements in a schema are
> annotation, the other half can still do something very, very useful.  They
> can validate the syntax and structure of the XML received on the wire
> automatically in a piece of code (the XML parser) that the implementation
> probably already has.

Note that in order to validate the different NETCONF messages, you
would either need more than one schema, or a very lax schema which
will validate messages/documents which are not actually valid NETCONF.
As one very simple example, suppose we have these in the data model:

   leaf ifAdminStatus {
      config true;
      type ...;
   }
   leaf ifOperStatus {
      config false;
      type ...;
   }

In a <get-config> only ifAdminStatus can occur.  In a <get> both can
occur.  In an <edit-config>, there can be an nc:operation attribute on
the ifAdminStatus, but that attribute cannot be present in a <get>.

> If we decided we wanted to build something like YANG, we would still need a
> tool to generate valid XSD or Relax from the YANG definitions to turn on
> validation in the XML parser.

One such tool is available from www.yang-central.org.  It currently
supports a single XSD output, but adding e.g. RelaxNG should be
possible.  YANG is based on three different vendor-specific languages,
which all three have tools that generate XSD.

Three of the people in the YANG gang have existing NETCONF
implementations.  None of these implementations are actually using XSD
or RelaxNG to do validation in the parser, (partly) for the reasons
listed above.

[...]

> These aspects are not *missing* from Relax NG.  Some of these things are not
> in the scope of the Relax NG schema, but can be defined as an additional
> layer on top of a specific Relax schema.

In my experience, people who design data models for device
configuration and monitoring do not typically think in terms of
patterns which match an XML instance document.  Instead they might
think in terms of objects with certain attributes, operations and
notifications, or in terms of a hierarchical structure of config
parameters.  From an operator perspective I also believe (although I
don't really know) that it's more common to think about which config
parameters can be set, than which patterns might match some virtual
XML instance document.  Thus, IMO a domain specific language with
a smaller semantic gap between the language and how people think about
and understand the problem will be more appropriate.



/martin