Get_elem() getting called twice with CLI show command and with NETCONF its getting executed properly once

Hi ,

We have a requirement, where we should have show & NETCONF support to fetch the data.

e.g, CLI > show next-free-id

O/P:

next-free-id 1234

Code snip for both CLI & netconf:

    pd->get_elem = get_free_id;
    pd->get_next = NULL;
    pd->exists_optional =  NULL;
    pd->get_object = NULL;
    pd->num_instances = NULL;
pd->get_object = NULL;

So when we execute it via CLI get_elem() is getting called twice.
Hence we getting o/p not as 1234 , its 1236… if executed again it will print 1238 so on.
Same if we execute from netconf we getting proper o/p like 1234, 1235, 1236 etc.

So can you please help us , how to fix the show command execution properly like of netconf… making get_elem() once when show command getting executed from CLI/.

See for example Get_next is called many time before get_object, when CLI command is executed twice - #4 by cohult

I agree get_next() is called twice based on when TAB is executed.
But get_elem() getting called twice is a issue.

I have get get_next() to NULL , just using one callback get_elem().

In container X → leaf Y config “false” callpoint ;

Can you please help in understanding how get_elem() is getting called twice

Another explanation:

Your data provider application should not assume one callback invocation from ConfD per request.
If you want to support allocating an identifier, I suggest you use an action instead of an operational data provider.