Subject: Re: [netmod] [Netconf] XML element order

From: Leif Johansson <[email-masked]>
Date: Fri, 8 Aug 2008 10:27:58 +0200

On Thursday 07 August 2008 23:18:56 Martin Bjorklund wrote:
> Andy Bierman <[email-masked]> wrote:
> > Hi,

Sorry for cross-posting this but this is probably critically important
for netmod wg too...

> >
> > Is the NETCONF agent allowed to accept XML elements
> > out of the specified order?
>
> Do you mean inside the protocol or inside the data?
>

I think this question may be related to the question I asked at the 
mic in Dublin about the uniqueness of representation of a yang 
model in xml form. A necessary (but probably not sufficient) 
requirement that since yang lists are order-preserving the 
corresponging xml representation needs to be order-preserving
too.

It is absolutely critical for yang that there is a *unique* mapping 
between yang and xml since yang uses xpath.

	Cheers Leif
_______________________________________________
netmod mailing list
[email-masked]
https://www.ietf.org/mailman/listinfo/netmod

---

From: Andy Bierman <[email-masked]>
Date: Fri, 08 Aug 2008 09:17:00 -0700

> between yang and xml since yang uses xpath.

I am talking about XML elements within NETCONF PDUs on the wire.
There are a few corner-cases in the YANG mapping
(leaf-list, ordered-by user, keys) in which relative order
among a sibling node set is significant.

I don't see what XPath has to do with it.
As long as the agent maintains the same conceptual
XML instance document for a database, XPath will
always work the same on that agent.  XPath in NETCONF
only applies to this database, not the PDUs.

> 	Cheers Leif

Andy

---

From: Phil Shafer <[email-masked]>
Date: Fri, 08 Aug 2008 14:23:27 -0400

>between yang and xml since yang uses xpath.

XML encoding should be predictable and consistent, but need for
"uniqueness" implies a level of exactness that XML is meant to be
the solution for.  If you define two leafs in a container, your
program (and certainly any XPath expressions you write) should not
can which order those elements arrive in, _unless_ that order carries
some semantic information.

    rpc ping {
        input {
            leaf size { ... }
            leaf count { ... }
            leaf wait { ... }
        }
    }

There is no semantic difference between:

   <rpc>
      <ping>
          <size>1024</size>
          <count>10</count>
          <wait>5</wait>
      </ping>
   </rpc>

and:

   <rpc>
      <ping>
          <count>10</count>
          <size>1024</size>
          <wait>5</wait>
      </ping>
   </rpc>

or:

   <rpc><ping><count>10</count><size>1024</size><wait>5</wait>
   </ping></rpc>

Order and whitespace differences only matter when they matter,
and shouldn't become CLRs any other time.  The XPath expression
"ping/count" finds the count no matter the order.  Assuming that
"ping/*[position() = 1]" is the count will give you fragile code.

Thanks,
 Phil

---

From: Ladislav Lhotka <[email-masked]>
Date: Fri, 08 Aug 2008 21:09:52 +0200

> some semantic information.

+1. However, YANG draft says:

"The container's child nodes are encoded as subelements to the container
element, in the same order as they are defined within the container
statement."

Will this be changed?

Lada

-- 
Ladislav Lhotka, CESNET
PGP Key ID: E74E8C0C

---

From: Phil Shafer <[email-masked]>
Date: Fri, 08 Aug 2008 15:36:27 -0400

>element, in the same order as they are defined within the container

IMHO yes.  The only restriction should be that keys appear
before non-keys.

Thanks,
 Phil

---

From: Andy Bierman <[email-masked]>
Date: Fri, 08 Aug 2008 15:18:11 -0700

> IMHO yes.  The only restriction should be that keys appear

To be more precise:

A manager SHOULD send all XML elements in the specified order.

A manager MUST send the following items in the specified order:
   - list key leafs
   - ordered-by user (list, leaf-list)
   - anyxml

An agent MAY issue the (TBD) error-tag <rpc-error>
when it detects elements in the wrong error.

I do not want to force agents to issue errors for non-problems.

Andy