[YANG] key clause issues

Andy Bierman <ietf@andybierman.com> Tue, 08 January 2008 00: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 1JC2UC-0000Tx-Ue; Mon, 07 Jan 2008 19:38:32 -0500
Received: from yang by megatron.ietf.org with local (Exim 4.43) id 1JC2UB-0000Ts-QE for yang-confirm+ok@megatron.ietf.org; Mon, 07 Jan 2008 19:38:31 -0500
Received: from [10.91.34.44] (helo=ietf-mx.ietf.org) by megatron.ietf.org with esmtp (Exim 4.43) id 1JC2UB-0000Tk-1V for yang@ietf.org; Mon, 07 Jan 2008 19:38:31 -0500
Received: from smtp124.sbc.mail.sp1.yahoo.com ([69.147.64.97]) by ietf-mx.ietf.org with smtp (Exim 4.43) id 1JC2UA-0003qT-Hg for yang@ietf.org; Mon, 07 Jan 2008 19:38:31 -0500
Received: (qmail 94323 invoked from network); 8 Jan 2008 00:38:30 -0000
Received: from unknown (HELO ?192.168.0.10?) (andybierman@att.net@68.120.80.25 with plain) by smtp124.sbc.mail.sp1.yahoo.com with SMTP; 8 Jan 2008 00:38:29 -0000
X-YMail-OSG: u76rpoUVM1l5fyA.dYAN.Ugl6R45iD2CpHRTVX0qp6U1DM3s
Message-ID: <4782C606.5010109@andybierman.com>
Date: Mon, 07 Jan 2008 16:38:30 -0800
From: Andy Bierman <ietf@andybierman.com>
User-Agent: Thunderbird 2.0.0.9 (Windows/20071031)
MIME-Version: 1.0
To: yang <yang@ietf.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Scan-Signature: 34d35111647d654d033d58d318c0d21a
Subject: [YANG] key clause issues
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

Hi,

I have a few concerns with the key clause...

 From -00:
7.8.2.  The list's key Statement

    The "key" statement, which MUST be present if the list represents
    configuration, and MAY be present otherwise, takes as an argument a
    string which specifies a space separated list of leaf identifiers of
    this list.  A leaf identifier MUST NOT appear more than once in the
    key.

Issue 1)

   From an interoperability perspective, the key needs to
   be defined any time there are multiple named instances
   of an element (i.e., every list).  Config vs. read-only is irrelevant.
   Operators and manager applications need to know how list entries
   are indexed for interoperability.  SNMP is mostly for monitoring.
   I can't imagine how operators and DM readers would be able to talk about
   tables and rows if all the INDEX clauses were removed from read-only tables.

Issue 2)

   Why is the CLR about a leaf appearing more than once in the key needed?
   It should be up to the DM writer to decide if this makes sense or not:

    list addr-pairs {
      key "addr-type src-addr addr-type dest-addr";

      leaf addr-type { type ietf:InetAddressType; }
      leaf src-addr { type ietf:InetAddress; }
      leaf dest-addr { type ietf:InetAddress; }
      // ... rest of list entry
    }

    Why is this illegal?
    It may be bad practice (according to RFC 4001), but should it be illegal?

Issue 3)

 From the ABNF:

      key-stmt               = key-keyword sep key-arg-str stmtend

      key-arg-str            = < a string which matches the rule
                                 key-arg >

      key-arg                = 1*(identifier sep)


   Why is the key statement limited to top-level sibling nodes
   within the list?  The unique-stmt (and keyref) allows
   descendant-schema-nodeid instead of just identifier:

       unique "foo/item1 foo/bar/item2";

   With this constraint on the key-stmt, YANG cannot support
   indexing using reusable containers.  (There needs to be
   exactly one instance of the key component per list entry,
   so 'list' and 'choice' nodes cannot be used within a key.)

   There are many use-cases, such as reusable (addr-type, addr) or
   (addr, port) data types.  The whole point of the container
   is that it provides the DM writer with an abstraction that
   represents a containerized set of objects, bound together for some reason.

   YANG has no support direct support for reusable complex types,
   but there is a workaround with grouping/uses:

    grouping addr-pair {
      leaf addr-type { type ietf:InetAddressType; }
      leaf addr { type ietf:InetAddress; }
    }

    list addr-pairs {
      key "src/addr-type src/addr dest/addr-type dest/addr";

      container src {
        uses addr-pair;
      }

      container dest {
        uses addr-pair;
      }
      // ... rest of list entry
    }

   This sort of indexing is very useful and needs to be supported by YANG.


Andy




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