Re: [YANG] keyref

Andy Bierman <ietf@andybierman.com> Tue, 22 January 2008 15:13 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 1JHKoh-0001Hp-SG; Tue, 22 Jan 2008 10:13:35 -0500
Received: from yang by megatron.ietf.org with local (Exim 4.43) id 1JHKog-0001HV-QI for yang-confirm+ok@megatron.ietf.org; Tue, 22 Jan 2008 10:13:34 -0500
Received: from [10.91.34.44] (helo=ietf-mx.ietf.org) by megatron.ietf.org with esmtp (Exim 4.43) id 1JHKog-0001HG-GA for yang@ietf.org; Tue, 22 Jan 2008 10:13:34 -0500
Received: from smtp121.sbc.mail.sp1.yahoo.com ([69.147.64.94]) by ietf-mx.ietf.org with smtp (Exim 4.43) id 1JHKog-00053t-0Y for yang@ietf.org; Tue, 22 Jan 2008 10:13:34 -0500
Received: (qmail 13937 invoked from network); 22 Jan 2008 15:13:33 -0000
Received: from unknown (HELO ?192.168.0.10?) (andybierman@att.net@67.126.240.103 with plain) by smtp121.sbc.mail.sp1.yahoo.com with SMTP; 22 Jan 2008 15:13:33 -0000
X-YMail-OSG: gd5kVi0VM1nKT.WQyzYwtVxiRmDzRH1U6.sooq2B0do8yRzX
X-Yahoo-Newman-Property: ymail-3
Message-ID: <479607AD.2040205@andybierman.com>
Date: Tue, 22 Jan 2008 07:11:41 -0800
From: Andy Bierman <ietf@andybierman.com>
User-Agent: Thunderbird 2.0.0.9 (Windows/20071031)
MIME-Version: 1.0
To: Martin Bjorklund <mbj@tail-f.com>
Subject: Re: [YANG] keyref
References: <20080122.094430.48542159.mbj@tail-f.com> <20080122085918.GC5210@elstar.local> <4795FECC.4090803@andybierman.com> <20080122.154525.119689047.mbj@tail-f.com>
In-Reply-To: <20080122.154525.119689047.mbj@tail-f.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Scan-Signature: d0bdc596f8dd1c226c458f0b4df27a88
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

Martin Bjorklund wrote:
> Andy Bierman <ietf@andybierman.com> wrote:
>> Not only is the TC approach simpler
> 
> As Juergen pointed out, there is no formalism to help tools.  Also, it
> becomes awkward to reference mulit-level and/or multi-key instances.
> 
>> but keyref does not support
>> the ability to hold a 'not-set' value, such as InterfaceIndexOrZero.
> 
> Mark it as optional instead - why set to some in-band invalid value?
> 
>       leaf mgmt-interface {
>           mandatory false;
>           type keyref {
>               path "/if:interfaces/if:interface/if:ifIndex";
>           }
>       }
> 
> If it is set, it has to point to an existing interface.
> 
>> YANG is also missing the ability to use key leafs from different
>> tables, like SMIv2.
> 
> No:
> 
>   list myIfTable {
>     key myIfIndex;
>     leaf myIfIndex {
>        type keyref {
>          path "/if:interfaces/if:interface/if:ifIndex";
>        }
>      }
>    }
>        
> covers this case.
> 

This is basically the same construct, except you have no
idea the data type is really InterfaceIndex.

IMO, leafref as a documentation clause does the same thing
but way simpler.  The DM reader should not have to be an expert
in Xpath, and need to hunt down the relevant documentation,
just to find out a leaf's data type.


> 
>>       leaf myInOctets {
>>         type smi:Counter32;
>>         leafref "/if:interfaces/if:interface/if:ifInOctets";
>>       }
>>    }
> 
> This is a very good example.  How can you tell which ifEntry's
> ifInOctets this myInOctets actually refer to??
> 

You could use any keyref 'path' expression in the leafref argument.

IMO, the whole issue of relationships between config database nodes is larger
than this keyref clause.  The requirements for machine readable
object constraint languages and object/entity relationships needs to
be documented in detail and agreed upon.


> 
> /martin
> 
> 

Andy


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