cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1519
Views
5
Helpful
1
Replies

tags="delete" device template best practice when using "when"

ryan-hitch
Level 4
Level 4

Is it a best practice to test for the presence of a variable and include a tags="delete" in device templates, or just rely on NSO to remove leafs that were deployed with a service when there are no more refcounters to that leaf?

 

For example, lets say I create a leaf called "multicast-enable" and have the following in a device template as I only want this configuration deployed when "multicast-enable" is defined.

 

<pim when="{multicast-enable}">

</pim>

 

NSO is pretty reliable at removing this configuration section when the leaf is not defined, however I am sure there are some corner cases for which I am not aware. Is it a best practice to have a when="not" for every when defined to cover for these?

 

For example, should I also have an equivalent delete for every when??

<pim when="{not(multicast-eanble)}" tags="delete">

</pim>

1 Reply 1

yfherzog
Cisco Employee
Cisco Employee

Hi,

 

You should leave it to Fastmap to remove the configs that the service created.

 

If you want the service to make sure some pre-existing configurations are removed when the service is deployed then you should add tags="delete" on those nodes. NSO will not do it automatically just because there's nothing that explicitly configures it (however, if you use tags="replace" on the node above, then NSO will move all nodes under it to their default values)

 

In your example, if you want your service to enable multicast when such input is provided and disable it when this input is not provided, then you should have multiple pim blocks with complementing when statements (e.g. when true, when false).

 

Yftach