Duplicate/Repeated callbacks for same paths (and nested paths within that) with find_next_object

I have yang model that has a bunch of nested lists (I’d say somewhere around 6 levels).
I have a top level callpoint that has find_next_object callback registered. This callpoint serves every nested list in this hierarchy by checking the path.

This works but I am getting repeated duplicate callbacks when I use a show command with CLI.

  • The pattern I see is that a few entries of the top level list is returned (along with every nested sub lists in each of those top level entries). Callback for every list entry within them can also be seen.
  • Then it again starts from the first top level list entry and fills everything inside it by continuous callbacks to entries of each nested list.
  • Then it goes one level deeper (into the first entry of nested list within the first entry of the top level list) and again recursively gets eveything within this.

This leads to repeated callbacks, the leaf node the inner most nested list being the most affected.
So what it basically does is a DFS on the nested trees, by triggering callbacks for all nested list entries within a top level entry. But when it goes to the list that is one level deeper, it ends up triggering the same callbacks and so on till it reaches the inner most list.

The weird part is that this is not seen when I use netconf as the northbound interface.

Just to re-iterate, everything is find_next_object (since I force it with next=-1), I always return the last entry with NULL and next = -1 so I think the find_next_object is handled clean.

As a result, my netconf query finishes running in 8 mins but the cli show command has been running for more than an hour. It is kind of in adherence with the behaviour we see.

So, instead of 1 callback per kpath (as in the case of netconf), I end up getting ‘n callbacks’ for the same kpath where n = the level of nested list.