ConfD User Community

Api for cdb schema path

cdb_exists() can be used to check if a node exists in cdb. Is there an api that can be used to check whether the schema is defined or not. For exmaple in the following schema I need to veriy if “test/bar/path” exists. The cdb_exists() api always logs an error

DEBUG badly formatted or nonexistent path - Bad path element “bar” after: /test/

container test {
   container foo {
      leaf path {
           type empty;
      }
  }
}

The standard mechanism for runtime path checking is using confd_cs_node tree, together with functions like confd_find_cs_root, confd_find_cs_node etc. You can (mis)use CDB API functions and watch for the CONFD_ERR_BADPATH error, but other than that, confd_find_cs_node is as close as you can get.

1 Like