Re: [Rtg-yang-coord] apply to subset of all configuration in YANG model

Ladislav Lhotka <lhotka@nic.cz> Fri, 30 January 2015 12:09 UTC

Return-Path: <lhotka@nic.cz>
X-Original-To: rtg-yang-coord@ietfa.amsl.com
Delivered-To: rtg-yang-coord@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 42B921A8BBF for <rtg-yang-coord@ietfa.amsl.com>; Fri, 30 Jan 2015 04:09:36 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] autolearn=ham
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 hUQ2YsqFZ-eJ for <rtg-yang-coord@ietfa.amsl.com>; Fri, 30 Jan 2015 04:09:34 -0800 (PST)
Received: from trail.lhotka.name (trail.lhotka.name [77.48.224.143]) by ietfa.amsl.com (Postfix) with ESMTP id 531101A8A7E for <rtg-yang-coord@ietf.org>; Fri, 30 Jan 2015 04:09:34 -0800 (PST)
Received: from localhost (unknown [217.31.205.2]) by trail.lhotka.name (Postfix) with ESMTPSA id CF3A01CC03BB; Fri, 30 Jan 2015 13:09:40 +0100 (CET)
From: Ladislav Lhotka <lhotka@nic.cz>
To: "Tarek Saad (tsaad)" <tsaad@cisco.com>, "rtg-yang-coord@ietf.org" <rtg-yang-coord@ietf.org>
In-Reply-To: <D0F02E89.16C4E0%tsaad@cisco.com>
References: <D0F02E89.16C4E0%tsaad@cisco.com>
User-Agent: Notmuch/0.18.1 (http://notmuchmail.org) Emacs/24.4.51.2 (x86_64-apple-darwin14.0.0)
Date: Fri, 30 Jan 2015 13:09:31 +0100
Message-ID: <m2pp9wsc5g.fsf@Birdie.labs.office.nic.cz>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Archived-At: <http://mailarchive.ietf.org/arch/msg/rtg-yang-coord/40mFkC2IS6g8qTTqT6RH3vRFdDA>
Cc: Xufeng Liu <xufeng.liu@ericsson.com>
Subject: Re: [Rtg-yang-coord] apply to subset of all configuration in YANG model
X-BeenThere: rtg-yang-coord@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: "\"List to discuss coordination between the Routing related YANG models\"" <rtg-yang-coord.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/rtg-yang-coord>, <mailto:rtg-yang-coord-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/rtg-yang-coord/>
List-Post: <mailto:rtg-yang-coord@ietf.org>
List-Help: <mailto:rtg-yang-coord-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/rtg-yang-coord>, <mailto:rtg-yang-coord-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 30 Jan 2015 12:09:36 -0000

Hi Tarek,

I think #2 is an easy and elegant solution for this particular
case. Templates are needed in cases where the data hierarchy is not
aligned with the needs for parameter inheritance - see the parallel
thread in this list about templates for routing instances and
routing protocol instances.

Lada

"Tarek Saad (tsaad)" <tsaad@cisco.com> writes:

> Hi YANG experts,
>
> There are cases where the same configuration data is to be applied on all (or some) nodes of a list and we’re seeking for advice. for example, if we have a list of interfaces (under a routing protocol "routing-proto" and I am trying to enable property foo on all such interfaces. We thought this could be done in several ways, and seeking thoughts and/or if consensus has been reach on it..
> 1) The trivial way is to configure foo repeatedly under all interfaces:
> routing-proto
>   interface A
>      foo 20
>   interface B
>      foo 30
>   interface C
>      foo 20
>
> 2) If apply “all” is sought, hierarchy can be used so to allow overriding defaults on all interfaces:
> routing-proto
>   foo 20
>   interface A
>   interface B
>      foo 30
>   interface C
>
> 3) Alternatively,  an apply-group (or template) or a reference to a set of configs can be used. In the referenced configuration set (apply-group or template), attribute foo is configured once and it applies to all interfaces referencing it. The apply-group ALL association with interfaces association can be *implicit* (not needing to configure it under every interface), but when configured for non-ALL case, it is flexible such that different apply-groups NAMES can be associated with different interfaces.
> apply-group ALL
>     interface ‘*’
>        foo
>
> routing-proto
> interface A
>   apply-group ALL
> interface B
>   apply-group ALL
> ….
>
> We can see this can be translated to YANG as:
> For this, an approach can be
> container ALL {
>        list interface {
>             key "interface";
>             leaf interface {
>                  type if:interface-ref;
>             }
>             leaf foo { type uint32; }
>             leaf apply-group { type leafref "/apply-group/name" }
> }
>
> Is there any recommendation or preference on adopting 2) or 3) or both?
>
> Regards,
> Tarek
>
>
> _______________________________________________
> Rtg-yang-coord mailing list
> Rtg-yang-coord@ietf.org
> https://www.ietf.org/mailman/listinfo/rtg-yang-coord

-- 
Ladislav Lhotka, CZ.NIC Labs
PGP Key ID: E74E8C0C