Subject: [Rtg-yang-coord] extensions to a base module in extended modules

From: "Tarek Saad (tsaad)" <[email-masked]>
Date: Thu, 20 Nov 2014 03:50:15 +0000

Hi yang¹ers,

Working on a base model (e.g. ietf-mpls-te.yang) that defines a container,
say:

module ietf-mpls-te {
    container tunnels-cfg {
    ...
    }
}

We expect other module(s), e.g. ietf-mpls-te-foo to add data nodes under
the same tunnels-cfg defined in ietf-mpls-te.

Assuming new module mpls-te-foo defines a grouping as:
module ietf-mpls-te-foo {

...
    grouping tunnel-extensions {
        container tunnel-extensions {
           ...
        }
    }
...
}

see this can be done in two ways:

1. the module mpls-te-foo augments the specific path for the node defined
in ietf-mpls-te as:
augment "/mpls-te:tunnels-cfg/mpls-te:tunnel" {
    uses tunnel-extensions;
    }

or 

2. module ietf-mpls-te would import ietf-mpls-te-foo and use the grouping
directly under the container tunnels-cfg:
module ietf-mpls-te {
    container tunnels-cfg {
        uses mpls-te-foo:tunnel-extensions;
    }
}

I¹m after the recommended path of doing this 1) vs. 2).. Personally, think
1) is more extensible as defining new extensions to the base module in
extensions modules do not have to edit/revise the base module. But, let me
know if there are reasons why 2) would be preferred.

Regards,
Tarek

---

From: Juergen Schoenwaelder <[email-masked]>
Date: Thu, 20 Nov 2014 09:24:09 +0100

On Thu, Nov 20, 2014 at 03:50:15AM +0000, Tarek Saad (tsaad) wrote:

[...]

> I¹m after the recommended path of doing this 1) vs. 2).. Personally,
> think 1) is more extensible as defining new extensions to the base
> module in extensions modules do not have to edit/revise the base
> module. But, let me know if there are reasons why 2) would be
> preferred.

I think you got it right - option 1) gives you extensibility without
having to revise the base document and hence this is usually the
better solution.

/js

-- 
Juergen Schoenwaelder           Jacobs University Bremen gGmbH
Phone: +49 421 200 3587         Campus Ring 1, 28759 Bremen, Germany
Fax:   +49 421 200 3103         <http://www.jacobs-university.de/>