Re: [YANG] keyref

Andy Bierman <ietf@andybierman.com> Tue, 22 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 1JHMWV-0002IL-E2; Tue, 22 Jan 2008 12:02:55 -0500
Received: from yang by megatron.ietf.org with local (Exim 4.43) id 1JHMWT-00026B-ML for yang-confirm+ok@megatron.ietf.org; Tue, 22 Jan 2008 12:02:53 -0500
Received: from [10.91.34.44] (helo=ietf-mx.ietf.org) by megatron.ietf.org with esmtp (Exim 4.43) id 1JHMWT-00023o-Bo for yang@ietf.org; Tue, 22 Jan 2008 12:02:53 -0500
Received: from smtp119.sbc.mail.sp1.yahoo.com ([69.147.64.92]) by ietf-mx.ietf.org with smtp (Exim 4.43) id 1JHMWR-0000ir-Nd for yang@ietf.org; Tue, 22 Jan 2008 12:02:53 -0500
Received: (qmail 70421 invoked from network); 22 Jan 2008 17:02:50 -0000
Received: from unknown (HELO ?192.168.0.10?) (andybierman@att.net@67.126.240.103 with plain) by smtp119.sbc.mail.sp1.yahoo.com with SMTP; 22 Jan 2008 17:02:50 -0000
X-YMail-OSG: wg9uuSUVM1lU76EBScNMAll1Oo9_4oHHM6LuxLGN3YbQO2J0
X-Yahoo-Newman-Property: ymail-3
Message-ID: <4796213F.5050703@andybierman.com>
Date: Tue, 22 Jan 2008 09:00:47 -0800
From: Andy Bierman <ietf@andybierman.com>
User-Agent: Thunderbird 2.0.0.9 (Windows/20071031)
MIME-Version: 1.0
To: Balazs Lengyel <balazs.lengyel@ericsson.com>
Subject: Re: [YANG] keyref
References: <47954F24.905@andybierman.com> <20080122.091246.105352306.mbj@tail-f.com> <20080122081821.GA5210@elstar.local> <20080122.094430.48542159.mbj@tail-f.com> <20080122085918.GC5210@elstar.local> <4795FECC.4090803@andybierman.com> <47960C6E.5060804@ericsson.com>
In-Reply-To: <47960C6E.5060804@ericsson.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Scan-Signature: 6e922792024732fb1bb6f346e63517e4
Cc: yang@ietf.org
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

Balazs Lengyel wrote:
> Hello,
> We are trying to define a formal way to specify relationships between 
> config database nodes. The this problem has many facets
> - reference to multi-keyed items
> - reference to leafs versus keys
> - constraining references to certain items or having free pointers
> - reference integrity
> 
> The problem we try to solve is how to define these relations in a way 
> that allows automatic checking. We need some solution, even if we do not 
> solve the complete problem. E.g. I think referential integrity is a too 
> high goal.
> 

Human usability is the highest priority.
That has to be balanced with machine readability.

Ex 1) become an expert in Xpath first, then hunt around the draft to
       find out the real data type for 'address'

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

Ex 2) data type for 'address' is in the leaf clause

       leaf address {
           type yang:ip-address;
           leafref "../../interface[name = $this/../ifname]/address/ip";
       }

Win-win scenario: works for humans, and works for tools.


----


One reason I was confused -- a bug in the example on p. 94-95:


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


OLD:

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

NEW:

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


> Balazs


Andy


> 
> Andy Bierman wrote:
>> IMO, it is not clear what problem is being solved by keyref.
>> There seems to be some assumption that the purpose of all this
>> complexity is justified because of all the value it provides.
>>
>> The InterfaceIndex approach is well-established and simple.
>>
>>      leaf mgmt-interface {
>>          type keyref {
>>              path "/if:interfaces/if:interface/if:ifIndex";
>>          }
>>      }
>>
>>      leaf mgmt-interface {
>>          type if:InterfaceIndex;
>>      }
>>
>> Not only is the TC approach simpler, but keyref does not support
>> the ability to hold a 'not-set' value, such as InterfaceIndexOrZero.
> 
> 



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