On Wed, Nov 13, 2024 at 8:35 AM Kent Watsen <[email protected]> wrote:

> Hi Shiya,
>
> On Nov 13, 2024, at 10:09 AM, Shiya Ashraf (Nokia) <shiya.ashraf=
> [email protected]> wrote:
>
> Hi Kent,
>
> Sorry but I miss the point you made with the below statement:
>
> “*As a contributor, I feel that the concern is unwarranted.  My
> belief/hope is that templates are not themselves validated when defined,
> but rather only the fully expanded/flattened results of templates are
> validated.*“
>
> Shiya>> For mandatories, the problem that was highlighted was more about
> following the DRY approach for templates.  For instance, in the below
> example copied from #3, slide 6, assume if the ‘mtu’ was defined as a
> mandatory data node with in a non-presence container, you will be forced to
> add it anyway for each interface in the below example and thus loosing the
> advantage of templating for these special data nodes. Isn’t it?
>
>
> I don’t understand your comment, but I will state my worldview (as a
> contributor) which is:
>
> - any data model can be templatized (including already published YANG
> modules)
> - these data models may contain `mandatory` and `default` statements
>
> - templates are NOT themselves ever validated
> - only the post-expanded/flattened result is validated (e.g., in
> <intended>)
>
>
Agreed.
This is easily accomplished by using an 'anydata' wrapper for the template
content.

<template>
  <name>template1</name>
   <target>/ietf-interfaces:interfaces/interface</target>
   <data>
      <interface>
        ....
      </interface>
    <data>
</template>

This solution has been in deployment for over 7 years.
https://github.com/YumaWorks/yumapro-yang/blob/main/yumaworks/yumaworks-templates.yang

IMO the WG should try to support more than the basics (like ranges and
conditional logic).



> FWIW, I was referring to Slide 8 of Template Idea #1.
>
> K.
>
>
Andy


>
>
> <interfaces>
>   <interface yt:apply-templates=“set_physical_mtu”>
>     <name>GigabitEthernet0/0/0/0</name>
>   </interface>
>   <interface>
>     <name>GigabitEthernet0/0/0/1</name>
>   </interface>
> </interfaces>
>
> Thanks,
> Shiya
>
>
>
> _______________________________________________
> netmod mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
>
_______________________________________________
netmod mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to