Re: [netmod] Question on modeling of restriction using YANG capabilities

Martin Bjorklund <mbj@tail-f.com> Tue, 15 March 2016 08:58 UTC

Return-Path: <mbj@tail-f.com>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id AB2B512D970 for <netmod@ietfa.amsl.com>; Tue, 15 Mar 2016 01:58:57 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.902
X-Spam-Level:
X-Spam-Status: No, score=-1.902 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UReSjntZBmFp for <netmod@ietfa.amsl.com>; Tue, 15 Mar 2016 01:58:56 -0700 (PDT)
Received: from mail.tail-f.com (mail.tail-f.com [46.21.102.45]) by ietfa.amsl.com (Postfix) with ESMTP id D41F712D90B for <netmod@ietf.org>; Tue, 15 Mar 2016 01:58:55 -0700 (PDT)
Received: from localhost (unknown [173.38.220.52]) by mail.tail-f.com (Postfix) with ESMTPSA id CC6F91AE03CA; Tue, 15 Mar 2016 09:58:53 +0100 (CET)
Date: Tue, 15 Mar 2016 09:58:55 +0100
Message-Id: <20160315.095855.447134777226792207.mbj@tail-f.com>
To: bart.bogaert@nokia.com
From: Martin Bjorklund <mbj@tail-f.com>
In-Reply-To: <D62E05768DBAFF42A72B9F4954476D65F634318C@FR712WXCHMBA09.zeu.alcatel-lucent.com>
References: <D62E05768DBAFF42A72B9F4954476D65F634318C@FR712WXCHMBA09.zeu.alcatel-lucent.com>
X-Mailer: Mew version 6.5 on Emacs 24.3 / Mule 6.0 (HANACHIRUSATO)
Mime-Version: 1.0
Content-Type: Text/Plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Archived-At: <http://mailarchive.ietf.org/arch/msg/netmod/jwkrIRVb6L4aFMZBom89izTpLdA>
Cc: netmod@ietf.org
Subject: Re: [netmod] Question on modeling of restriction using YANG capabilities
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 15 Mar 2016 08:58:57 -0000

Hi,

"Bogaert, Bart (Nokia - BE)" <bart.bogaert@nokia.com> wrote:
> Dear Yang specialists,
> 
>  
> 
> I have a question concerning what is possible in must statements in case of
> recursive models.

What do you mean when you write "recursive model"?

> Assume the following "limits" depending on a plugable
> board (just arbitrary examples):
> 
>  
> 
> +------------+---------+----------------+
> 
> | Board type | # ports | max VLAN ports |
> 
> +------------+---------+----------------+
> 
> |      A     |  8      |  80            |
> 
> |      B     |  4      |  40            |
> 
> |      C     |  2      |  40            |
> 
> |      D     |  16     |  100           |
> 
> +------------+---------+----------------+
> 
>  
> 
> The entity model is a recursive one where you start from the root (below is
> just an example to depict the nature of the problem):
> 
>  
> 
> /entity
> 
>     | [Contains]
> 
>     + chassis
> 
>         | [contains]
>         + Board
> 
>              | [Contains]
> 
>              +  Port
> 
>                  |
> 
>                  | reference to /interfaces/interface
> 
>  
> 
> /interfaces
> 
>      |
> 
>      + interface
> 
>           | various augments depending on the if-type but
> 
>           | no "back-reference" to port in /entity
> 
>  
> 
> Problem is two-fold:
> 
> -          Recursiveness needs to be expressed in the XPATH statement: when
> a client wants to create a port it needs to perform a check based on the
> board identification.  So in case of Board A the maximum number of ports
> that the client should be allowed to make is 8, for B it is 4, for D it is
> 16

I can't answer this until I know what you mean with "recursive model",
see above.

> -          From the interfaces table (for the VLAN port case) there is no
> back reference to the entity table, so how would one retrieve the "board" on
> top of which this interface has been defined in order to pick up the max
> VLAN ports value if we would like to perform a must check in this (as the
> value depends on the board identification).  So 100 in case the interface is
> defined and an port of board D, 40 in case the interface is defined on a
> port of board C (or B).  Should we then have to add a backwards leafref to
> the port in /entity (otherwise this must statement will end up in a complete
> /entity table look-up to find the port leafref matching the instance from
> /interfaces)?
> 
>  
> 
> Is this something that can be expressed in YANG with XPATH
> expressions?

Probably.

>  How
> will that look like (and will that be understandable.)?  Don't we need
> XQUERY to do this (which is not part of YANG)?
> 
> What is the performance of this (so in fact what is the impact on the
> server)?  Is it recommended to do it that way and if not: how would you
> suggest to model these kind of restrictions?

The performance is implementation-dependent.  An implementation that
uses a plain XPath evaluator might be slow if you have 1000s or 10000s
"entities".  Some implementations supports specification of secondary
indexes to speed up things like this.  And some implementations lets
you (or forces you) to implement the constraint yourself in code.

It is not a good idea to add "back-references" to the model in order
to solve implementation-specific problems.





/martin


> 
>  
> 
> Thanks in advance.
> 
>  
> 
> Best regards - Vriendelijke groeten,
> 
> Bart Bogaert
> 
>  
>