How to identify if a node is a list vs a container in the confd_cs_node data structure?

Here’s some example code snippet to work with the confd_cs_node data structure:

Given the following YANG data model:

module notif {
  namespace "http://tail-f.com/ns/test/notif";
  prefix notif;

  container interfaces {
    list interface {
      key ifIndex;
      leaf ifIndex {
        type uint32;
      }
      leaf desc {
        type string;
      }
    }
  }
}

Following is code snippet for finding the confd_cs_node structure for the interfaces container node followed by the interface list node:

struct confd_cs_node *object = confd_cs_node_cd(NULL,"/interfaces");
//object->info.keys equals NULL
object = object->children;
//object->info.keys now points to the XML tag of the ifIndex key
1 Like