analysis of YANG vs. RELAX NG
"Rohan Mahy" <rohan.mahy@gmail.com> Tue, 27 November 2007 05:48 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 1IwtJN-0001mh-D8; Tue, 27 Nov 2007 00:48:45 -0500
Received: from discuss by megatron.ietf.org with local (Exim 4.43)
id 1IwtJM-0001kb-7F for discuss-confirm+ok@megatron.ietf.org;
Tue, 27 Nov 2007 00:48:44 -0500
Received: from [10.91.34.44] (helo=ietf-mx.ietf.org)
by megatron.ietf.org with esmtp (Exim 4.43) id 1IwtJL-0001jh-T2
for discuss@apps.ietf.org; Tue, 27 Nov 2007 00:48:43 -0500
Received: from el-out-1112.google.com ([209.85.162.183])
by ietf-mx.ietf.org with esmtp (Exim 4.43) id 1IwtJI-0005KA-2j
for discuss@apps.ietf.org; Tue, 27 Nov 2007 00:48:43 -0500
Received: by el-out-1112.google.com with SMTP id n30so305353elf
for <discuss@apps.ietf.org>; Mon, 26 Nov 2007 21:48:39 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:mime-version:content-type;
bh=iRLdYLSg0GIav+z2xpBTjy3gik0A7aDQA37NK0AycBY=;
b=hsBWaLYWCgInu6OCT4rvPud/E9yKg1wpGkR8T2e/nUB5CiFhffcCpJkm6a0+9daVwxZPnmq2yajxeY5cwy7hYTBmedhvg68hRS0GRrUaOCGVrNze/k8SD+n13VML50eKphtNcfCsnk+omnGNg6ZETc1vI8TlgtC5wSHGuPYhS1w=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
h=received:message-id:date:from:to:subject:cc:mime-version:content-type;
b=OyKCutfaQHypqsQJ/A4buSj6Uzr0cXwgDzhMIrtpowR5qR6FJ5MEZvID+GIJOevYBbjUNIG9DGmRywh6OrLCY8C8OrNYTlImYGnMbuXRQc/J6bqkcapDRUsC96TF1GUgBST3fQL9UJXzlC+Xhr4cumI8tBjBw9ZjA4rMI7aDHLc=
Received: by 10.143.161.3 with SMTP id n3mr749895wfo.1196142518093;
Mon, 26 Nov 2007 21:48:38 -0800 (PST)
Received: by 10.142.214.15 with HTTP; Mon, 26 Nov 2007 21:48:37 -0800 (PST)
Message-ID: <953beacc0711262148me3c119coebc756a44322b6e9@mail.gmail.com>
Date: Mon, 26 Nov 2007 21:48:37 -0800
From: "Rohan Mahy" <rohan.mahy@gmail.com>
To: discuss@apps.ietf.org
Subject: analysis of YANG vs. RELAX NG
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_Part_8624_3260125.1196142518017"
X-Spam-Score: 0.0 (/)
X-Scan-Signature: ec7c6dab5a62df223002ae71b5179d41
Cc:
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,
I read through the YANG I-D (draft-bjorklund-netconf-yang-00) and thought
immediately that all of the problems the draft is trying to address looked
very suitable to use RELAX NG as a schema language. Looking at
section F.2(Why not RELAX NG) I did not see any specific examples
motivating the
apparently contradictory statements that Relax is not expressive enough and
Relax is too expressive.
Below is a comparison of YANG integral types and common idioms to integral
types/idioms available in RELAX NG. I seems pretty clear to me that
expressing any of the idioms in YANG should be straightforward in RELAX NG
and very easy to read and write.
Writing a schema language is a lot of work, and I can't imagine the IETF
designing one that would only be used by NETCONF. RELAX NG has existing
tools and parsers, has additional integral types (ex: URI, dates, and
times), and was written by a large group of folks who have tons of
experience designing schema languages.
thanks,
-rohan
BUILT IN TYPES
yang: relax:
int8 byte
int16 short
int32 int
int64 long
uint8 unsignedByte
uint16 unsignedShort
uint32 unsignedInt
uint64 unsignedLong
float32 float
float64 double
string string
boolean boolean
binary base64Binary
empty <empty/>
anyxml <anyName/>
union <choice> or <interleaved>
enumeration, <text><choice>
bits <value>foo</value>
<value>bar</value>
</choice></text>
keyref and instance-identifier are probably better served by referencing an
'id' attribute and using the 'ID' type, but doing exactly what is done in
YANG could still be handled easily using an anyURI restricted to be an XPath
expression.
Below, I also show examples of the YANG concepts of leaf node, leaf-list,
container, and list expressed in YANG, how it would be expressed in NETCONF,
and expressed in RELAX NG.
LEAF
yang:
leaf host-name {
type string;
description "Hostname for this system";
}
netconf:
<host-name>my.example.com</host-name>
relax:
<element name="host-name">
<other:description>Hostname for this system</other:description>
<data type="string"/>
</element>
LEAF-LIST
yang:
leaf-list domain-search {
type string;
}
netconf:
<domain-search>example.com</domain-search>
<domain-search> example.org</domain-search>
relax:
<zeroOrMore> <!-- could be oneOrMore instead -->
<element name="domain-search">
<text/> <!-- this is an alias for data type="string" -->
</element>
</zeroOrMore>
CONTAINER
yang:
container system {
container login {
leaf message {
type string;
}
}
}
netconf:
<system>
<login>
<message>Hello Dave</message>
</login>
</system>
relax:
<element name="system">
<element name="login">
<element name="message">
<text/>
</element>
</element>
</element>
LIST
yang:
list user {
key "name";
leaf name {
type string;
}
leaf class {
type string;
}
}
netconf:
<user>
<name>alice</name>
<class>human</class>
</user>
<user>
<name>cheshire</name>
<class>cat</class>
</user>
relax:
<zeroOrMore>
<element name="user">
<other:key>name</other:key>
<element name="name">
<text/>
</element>
<element name="class">
<text/>
</element>
</element>
</zeroOrMore>
- analysis of YANG vs. RELAX NG Rohan Mahy
- Re: analysis of YANG vs. RELAX NG Martin Bjorklund
- Re: analysis of YANG vs. RELAX NG Leif Johansson
- Re: analysis of YANG vs. RELAX NG Juergen Schoenwaelder
- Re: analysis of YANG vs. RELAX NG Juergen Schoenwaelder
- Re: analysis of YANG vs. RELAX NG Paul Hoffman
- RE: analysis of YANG vs. RELAX NG Natale, Bob
- Re: analysis of YANG vs. RELAX NG Lisa Dusseault
- Re: analysis of YANG vs. RELAX NG Rohan Mahy
- Re: analysis of YANG vs. RELAX NG Juergen Schoenwaelder
- RE: analysis of YANG vs. RELAX NG Romascanu, Dan (Dan)
- Re: analysis of YANG vs. RELAX NG Leif Johansson
- RE: analysis of YANG vs. RELAX NG Romascanu, Dan (Dan)
- Re: analysis of YANG vs. RELAX NG Martin Bjorklund
- Re: analysis of YANG vs. RELAX NG Jon Saperia
- Do we need a formalized language: [Was: Re: analy… Balazs Lengyel
- Re: analysis of YANG vs. RELAX NG Balazs Lengyel
- Re: analysis of YANG vs. RELAX NG Rohan Mahy
- Re: analysis of YANG vs. RELAX NG Martin Bjorklund
- Re: analysis of YANG vs. RELAX NG Rohan Mahy
- Re: analysis of YANG vs. RELAX NG Juergen Schoenwaelder
- Re: analysis of YANG vs. RELAX NG Martin Bjorklund
- Re: analysis of YANG vs. RELAX NG Lisa Dusseault
- Re: analysis of YANG vs. RELAX NG Rohan Mahy
- Re: analysis of YANG vs. RELAX NG Juergen Schoenwaelder
- Re: analysis of YANG vs. RELAX NG Juergen Schoenwaelder
- Re: analysis of YANG vs. RELAX NG Balazs Lengyel
- Re: analysis of YANG vs. RELAX NG Balazs Lengyel
- Re: analysis of YANG vs. RELAX NG Balazs Lengyel
- Re: analysis of YANG vs. RELAX NG Balazs Lengyel
- Re: analysis of YANG vs. RELAX NG Andrew Newton
- Re: analysis of YANG vs. RELAX NG Rohan Mahy
- Re: analysis of YANG vs. RELAX NG Rohan Mahy
- Re: analysis of YANG vs. RELAX NG Balazs Lengyel
- Re: analysis of YANG vs. RELAX NG Phil Shafer
- Re: analysis of YANG vs. RELAX NG Rohan Mahy
- Re: analysis of YANG vs. RELAX NG Randy Presuhn
- Re: analysis of YANG vs. RELAX NG Juergen Schoenwaelder
- Re: analysis of YANG vs. RELAX NG Martin Bjorklund
- Re: analysis of YANG vs. RELAX NG Andy Bierman
- Re: analysis of YANG vs. RELAX NG Julian Reschke
- Re: analysis of YANG vs. RELAX NG Tim Bray
- Re: analysis of YANG vs. RELAX NG Ladislav Lhotka
- Re: analysis of YANG vs. RELAX NG Juergen Schoenwaelder
- Re: analysis of YANG vs. RELAX NG Ladislav Lhotka
- Re: analysis of YANG vs. RELAX NG Juergen Schoenwaelder
- Re: analysis of YANG vs. RELAX NG Andy Bierman
- Re: analysis of YANG vs. RELAX NG Ladislav Lhotka
- Re: analysis of YANG vs. RELAX NG Andy Bierman
- Re: analysis of YANG vs. RELAX NG Randy Presuhn
- RE: analysis of YANG vs. RELAX NG David Harrington
- RE: analysis of YANG vs. RELAX NG Romascanu, Dan (Dan)
- Re: analysis of YANG vs. RELAX NG Ladislav Lhotka
- Re: analysis of YANG vs. RELAX NG Juergen Schoenwaelder
- Re: analysis of YANG vs. RELAX NG Balazs Lengyel