Subject: Re: [netmod] [Netconf] yang ordering

From: "Bert Wijnen (IETF)" <[email-masked]>
Date: Wed, 12 Oct 2011 16:24:49 +0200

I suppose that this belongs in the NETMOD WG, not NETCONF

Bert

On 10/12/11 3:33 PM, David Reid wrote:
> I have 2 questions about ordering in yang. Both questions are related to
> the mib to yang conversion tool I'm working on.
>
> 1. In YANG, does the order in which the leaf objects that are part of the key
> appear in a list matter? APPLICATION-MIB (RFC 2564) defines:
>
>     applSrvInstToRunApplElmtEntry OBJECT-TYPE
>             SYNTAX                ApplSrvInstToRunApplElmtEntry
>             MAX-ACCESS            not-accessible
>             STATUS                current
>             DESCRIPTION "..."
>             INDEX { applSrvIndex, sysApplElmtRunIndex }
>             ::= { applSrvInstToRunApplElmtTable 1 }
>
>     ApplSrvInstToRunApplElmtEntry ::= SEQUENCE
>             {
>                     applSrvIndex       Unsigned32
>             }
>
> When I convert to yang, I put sysApplElmtRunIndex in the list before
> applSrvIndex, which is not the order that they are defined in the
> MIB INDEX or YANG key. I noticed that smidump also does it this way.
> Here is the yang produced:
>
>      list applSrvInstToRunApplElmtEntry {
>        smiv2:oid "1.3.6.1.2.1.62.1.1.3.1";
>        key "applSrvIndex sysApplElmtRunIndex";
>        description "...";
>
>        leaf sysApplElmtRunIndex {
>          type leafref {
>            path "/sysappl-mib:sysApplElmtRunTable...
>          }
>        }
>
>        leaf applSrvIndex {
>          smiv2:oid "1.3.6.1.2.1.62.1.1.3.1.1";
>          type uint32 {
>            range "1..4294967295";
>          }
>          description "...";
>          smiv2:max-access read-only;
>        }
>
> I believe the yang spec requires that the encoding on the wire puts
> applSrvIndex first and sysApplElmtRunIndex second. I'm not sure that
> it matters what order they are in in the yang document. It seems to me
> that we should agree on an ordering that we all follow, but I'm
> wondering if it really matters.
>
>
>
> 2. Does the order in which objects appear in a yang module matter. The IF-MIB
>     defines the following 5 tables in this order:
>
>      ifTable
>      ifXTable
>      ifStackTable
>      ifRcvAddressTable
>      ifTestTable
>
> When I convert to yang, I sort lexigraphically before printing the yang
> module. That results in the yang table containers or augments in this order:
>
>      ifTable
>      ifXTable
>      ifStackTable
>      ifTestTable
>      ifRcvAddressTable
>
> smidump prints the table containers first followed by the augments, resulting
> in this order:
>
>      ifTable
>      ifStackTable
>      ifRcvAddressTable
>      ifXTable
>      ifTestTable
>
> Do we need to agree on an order? Or is it OK for different tools to produce a
> different ordering?
>
> -David Reid
>
> _______________________________________________
> Netconf mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/netconf
>