[YANG] keyref

Andy Bierman <ietf@andybierman.com> Mon, 21 January 2008 17:02 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 1JH02R-0006JH-Nl; Mon, 21 Jan 2008 12:02:23 -0500
Received: from yang by megatron.ietf.org with local (Exim 4.43) id 1JH02N-0006IR-NX for yang-confirm+ok@megatron.ietf.org; Mon, 21 Jan 2008 12:02:19 -0500
Received: from [10.91.34.44] (helo=ietf-mx.ietf.org) by megatron.ietf.org with esmtp (Exim 4.43) id 1JH02N-0006Gw-37 for yang@ietf.org; Mon, 21 Jan 2008 12:02:19 -0500
Received: from smtp118.sbc.mail.sp1.yahoo.com ([69.147.64.91]) by ietf-mx.ietf.org with smtp (Exim 4.43) id 1JH02L-0004T5-GB for yang@ietf.org; Mon, 21 Jan 2008 12:02:19 -0500
Received: (qmail 3198 invoked from network); 21 Jan 2008 17:02:14 -0000
Received: from unknown (HELO ?192.168.0.10?) (andybierman@att.net@67.126.240.103 with plain) by smtp118.sbc.mail.sp1.yahoo.com with SMTP; 21 Jan 2008 17:02:14 -0000
X-YMail-OSG: eGNJiS4VM1mtUYjrOaa2QNCKs4fOaFsqyOhzc9JLGyYOqn4jwsKarEBL4SxwOQXi10i_col5faAYCVxi3tXeCF87
X-Yahoo-Newman-Property: ymail-3
Message-ID: <4794D016.10107@andybierman.com>
Date: Mon, 21 Jan 2008 09:02:14 -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: 8fbbaa16f9fd29df280814cb95ae2290
Subject: [YANG] keyref
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,

The keyref builtin type is confusing.
It is not very clear why this needs to be a built-in type,
or why all the various forms are needed.

What do all these clauses within a leaf mean for a keyref?
   - units
   - must
   - default
   - config
   - mandatory

What does it mean for a keyref leaf to have different values of these clauses
than the leaf for the target of the 'path' statement?

Does a keyref variable always contain the value of the variable
it points to, or not?   If not, when?

Can a keyref be status current and the path reference
a leaf that is deprecated or obsolete?

What are writable keyrefs used for?

Why are keyrefs needed within a configuration database?

The notification use case in the example below makes sense,
but that's it.  I would rather have a mechanism within
the notification clause to deal with this feature, not a built-in
data type that can be used everywhere.

---------

4.2.10.  Notification Definitions

    YANG allows the definition of notifications suitable for NETCONF.
    YANG data definition statements are used to model the content of the
    notification.

    YANG Example:

      notification link-failure {
          description "A link failure has been detected";
          leaf if-index {
              type int32 { range "1 .. max"; }
          }
          leaf if-name {
              type keyref {
                  path "/interfaces/interface/name";
              }
          }
      }

    NETCONF XML Encoding:

      <notification
          xmlns="urn:ietf:params:netconf:capability:notification:1.0">
        <eventTime>2007-09-01T10:00:00Z</eventTime>
        <link-failure xmlns="http://acme.example.com/system">
          <if-name>so-1/2/3.0</if-name>
        </link-failure>
      </notification>


Why is it sufficient to make the if-index leaf an int32
but the if-name needs to be a keyref to something inside the
interfaces entry?  Clearly, when the notification is generated,
both of these values come from a particular interface.

---------

 From section 8.8.4:

      leaf mgmt-interface {
          type keyref {
              path "../interface/name";
          }
      }


    The following keyrefs refer to an existing address of an interface:

   container default-address {
       leaf ifname {
           type keyref {
               path "../../interface/name";
           }
       }
       leaf address {
           type keyref {
               path "../../interface[name = $this/../ifname]/address/ip";
           }
       }
   }

    A corresponding XML snippet is e.g.:

      <interface>
        <name>eth0</name>
        <address>
          <ip>192.0.2.1</ip>
        </address>
        <address>
          <ip>192.0.2.2</ip>
        </address>
      </interface>
      <interface>
        <name>lo</name>
        <address>
          <ip>127.0.0.1</ip>
        </address>
      </interface>

      <default-address>
        <ifname>eth0</ifname>
        <ip>192.0.2.2</ip>
      </default-address>


IMO, this 2nd form is complicated, and I don't really see why WGs
need it, or why they will use it.  The simple absolute-schema-nodeid form
makes sense to me, as a mechanism within notifications to reference
config data that is copied into the notification.



Andy






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