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

"Bogaert, Bart (Nokia - BE)" <bart.bogaert@nokia.com> Tue, 15 March 2016 09:03 UTC

Return-Path: <bart.bogaert@nokia.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 EBB0112D90B for <netmod@ietfa.amsl.com>; Tue, 15 Mar 2016 02:03:45 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.921
X-Spam-Level:
X-Spam-Status: No, score=-6.921 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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 IRXlS2oFtXUf for <netmod@ietfa.amsl.com>; Tue, 15 Mar 2016 02:03:41 -0700 (PDT)
Received: from smtp-fr.alcatel-lucent.com (fr-hpida-esg-02.alcatel-lucent.com [135.245.210.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 174E512D940 for <netmod@ietf.org>; Tue, 15 Mar 2016 02:03:40 -0700 (PDT)
Received: from fr712umx3.dmz.alcatel-lucent.com (unknown [135.245.210.42]) by Websense Email Security Gateway with ESMTPS id 756F38282AE5; Tue, 15 Mar 2016 09:03:37 +0000 (GMT)
Received: from fr711usmtp1.zeu.alcatel-lucent.com (fr711usmtp1.zeu.alcatel-lucent.com [135.239.2.122]) by fr712umx3.dmz.alcatel-lucent.com (GMO-o) with ESMTP id u2F93cpn026342 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 15 Mar 2016 09:03:38 GMT
Received: from FR711WXCHHUB01.zeu.alcatel-lucent.com (fr711wxchhub01.zeu.alcatel-lucent.com [135.239.2.111]) by fr711usmtp1.zeu.alcatel-lucent.com (GMO) with ESMTP id u2F93Was009508 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Tue, 15 Mar 2016 10:03:38 +0100
Received: from FR712WXCHMBA09.zeu.alcatel-lucent.com ([169.254.5.203]) by FR711WXCHHUB01.zeu.alcatel-lucent.com ([135.239.2.111]) with mapi id 14.03.0195.001; Tue, 15 Mar 2016 10:02:43 +0100
From: "Bogaert, Bart (Nokia - BE)" <bart.bogaert@nokia.com>
To: EXT Martin Bjorklund <mbj@tail-f.com>
Thread-Topic: [netmod] Question on modeling of restriction using YANG capabilities
Thread-Index: AdF+kOk7Mu/8N02FSMa3htoCCAR63////ziA///u5DA=
Date: Tue, 15 Mar 2016 09:02:43 +0000
Message-ID: <D62E05768DBAFF42A72B9F4954476D65F63433B9@FR712WXCHMBA09.zeu.alcatel-lucent.com>
References: <D62E05768DBAFF42A72B9F4954476D65F634318C@FR712WXCHMBA09.zeu.alcatel-lucent.com> <20160315.095855.447134777226792207.mbj@tail-f.com>
In-Reply-To: <20160315.095855.447134777226792207.mbj@tail-f.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: yes
X-MS-TNEF-Correlator:
x-originating-ip: [135.239.27.40]
Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="SHA1"; boundary="----=_NextPart_000_00D5_01D17EA1.CF802010"
MIME-Version: 1.0
Archived-At: <http://mailarchive.ietf.org/arch/msg/netmod/JvHVutNtvEuEcUmaYYYcxmga6HI>
Cc: "netmod@ietf.org" <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 09:03:46 -0000

Martin,

Thanks for the reply.

This is from the entity model:

$ pyang -f tree ietf-entity.yang -p ..
module: ietf-entity
   +--ro entity-state
   |  +--ro last-change?       yang:date-and-time
   |  +--ro physical-entity* [name]
   |     +--ro name              string
   |     +--ro class             identityref
   |     +--ro physical-index?   int32 {entity-mib}?
   |     +--ro description?      string
   |     +--ro contained-in*     -> ../../physical-entity/name
   |     +--ro contains-child*   -> ../../physical-entity/name
   |     +--ro parent-rel-pos?   int32
   |     +--ro hardware-rev?     string
   |     +--ro firmware-rev?     string


So contained-in and contains-child define a containment of entities within
entities, hence my reference to recursive

Best regards - Vriendelijke groeten,
Bart Bogaert

-----Original Message-----
From: EXT Martin Bjorklund [mailto:mbj@tail-f.com] 
Sent: 15 March 2016 09:59
To: Bogaert, Bart (Nokia - BE)
Cc: netmod@ietf.org
Subject: Re: [netmod] Question on modeling of restriction using YANG
capabilities

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
> 
>  
>