Set and transaction hook order


I believe the order of set and transaction hooks are not guaranteed, am I correct?

Is there a way to make the hooks are called in a particular order? Thanks.


Apart from the obvious order like that a callback for a sub-element of a list is never invoked before the parent list’s create callback (if it is registered), there is no guaranteed ordering indeed. For transaction hooks you can rely to some extent on that they are invoked in the data model order; set hooks are invoked as the corresponding nodes are changed - for CLI this is clear, but I’m not sure what this means for interfaces like NETCONF, you may need to experiment. I don’t think you can affect the order by any other means.

In either case, if you can make your callbacks not dependent on their invocation order, it’s worth the effort - usually this is possible, though not always easy.

1 Like