Deviating a augment statement

We have a situation ,
where there is a augment statement , that needs to be suppressed when a certain deviation is present .
Is there a way to do that ?

we have something like

deviate “path_x/path_y/path_z/leaf”
deviate not-supported;

and then there is augment which uses that path somewhere .
augment “path_x/path_y”
uses some_foo;

Should the augmentation controlled by Makfile or it can be controled by Deviations too ?

Thanks in advance.

No, you cannot deviate an augment statement, just like you cannot augment an augment statement - both for deviate as well as for augment the argument has to identify a schema node.

If the module with the augment statement is owned by you, you have a number of options:

  • Remove the augment in compile time, as you write. But you should not do that if the module has already been published or is going to be published or generally used elsewhere with the augment.
  • Add if-feature statement to augment; I think it’s a bit more ok-ish than the previous option in case of already published module

If you do not own the module, you should not touch it; as far as I can tell, in that case you can only deviate all nodes within the some_foo grouping that appear under path_y.

1 Like

As Martin mentioned, I also think if-feature is much better for this scenario, but for both the deviation and the augment. If instead of deviating you use the if-feature, it will be better from a conformance perspective.

You can also add a when statement for the augment, with a condition that some leaf config is not present for example.