Python cdb.connect fails with 'insufficient keypath depth/keys'

The cdb.connect() function fails with insufficient keypath depth/keys. The API displays this message, I am using dhcpd_conf.py provided in examples.confd/intro/1-2-3-start-query-model:

usp-build-sla > python dhcpd_conf.py
Traceback (most recent call last):
File “dhcpd_conf.py”, line 168, in
run()
File “dhcpd_conf.py”, line 144, in run
sub = Subscriber(10, ‘/dhcp’)
File “dhcpd_conf.py”, line 35, in init
_confd.CONFD_PORT, self.path)
_confd.error.Error: Bad protocol usage or unexpected retval (21): Library MAXDEPTH/MAXKEYLEN 20/9 for confd_hkeypath_t are too small, ConfD needs 22/6

The server displays this message:

26-Oct-2016::23:39:11.657 usp-build-sla confd[13287]: - Got connect from library with insufficient keypath depth/keys support (20/9, needs 22/6)

Using confd 6.1. The machine is Fedora 21.

More information: the problem goes away after starting confd with fewer fxs files, while initially it was started with 15 files generated out of YANG modules of various degrees of complexity.

What determines the error?

  • Depth of nesting of YANG definitions?
  • Number of YANG definitions?
  • ?

How to solve the issue?

Hi,

As your YANG data model is quite deep for some reason, in order to use such a depth you need to rebuild both libconfd and your application where you tune the MAXDEPTH to your data model.

See ConfD UG Chapter 27.13. “Tuning the size of confd_hkeypath_t” and on the libconfd source code tar ball libconfd/README section “Tuning the size of confd_hkeypath_t”

Yes, but… - @tbmarconi is using the Python API (which is implemented on top of the C API), and I’m not 100% sure of the implications in this case. libconfd definitely needs to be rebuilt, and the Python API (at least the shared object that implements the C interface) almost certainly needs to be rebuilt, but the Python application should probably not be affected.

Hi Per,
I am seeing the same issue. What are the steps to rebuild the Python API. I have already rebuilt libconfd and the C applications. But still see the problem for Python applications.

The documentation should be updated with these instructions for Python API

thanks
alpesh