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

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.