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

From: "Tarek Saad (tsaad)" <[email-masked]>
Date: Thu, 29 Jan 2015 23:38:05 +0000

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

---

From: Ladislav Lhotka <[email-masked]>
Date: Fri, 30 Jan 2015 13:09:31 +0100

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)" <[email-masked]> writes:

> _______________________________________________
> Rtg-yang-coord mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/rtg-yang-coord

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