ConfD User Community

Displaying single record

Hello Team,

I want to display a table that can have only a single record. So basically, there is no specific key required. Please suggest an appropriate yang construct to achieve this.

I have a C structure similar to this to be displayed in a show command (show table details):

struct table {
  char interface[128];
  char fname[128];
  uint32 num-pkts;


Hello Saswat,

i think presence container (see RFC) fits this use case…

It’s like single list-entry with no extra key leaves.
It can exist/not exist, and has only non-key leaves - so something like this:

container table {
  presence: "explanation for this presence...";
  leaf interface { type string { length "1..127"; } }
  // COMMENT: 127/128 - depending on your type rules - string null termination
  leaf fname { type string { length "1..127"; } }
  leaf num-pkts { type uint32; }

Hello Joseph,
Can you please also suggest how to populate the values of these leaves from the C application? Usually, we define a callpoint under list construct in the yang. How would we do this in this specific scenario?


you can have callpoint on the container too no problem.

quickest way is to just implement:

  • exists_optional() - existence check for container table node itself
  • get_elem() - pattern for leaves inside table as usually for any other leaves
    (dont’f take check existence of leaf into account too, as it may not be guaranteed that exists_optional() will be invoked by ConfD before get_elem on insider leaves…)

If you have get_object() et.c callbacks, i think same rules apply as for list entries, you just won’t have the key value in request input keypath… (so some sort of array of xml-begin table, table values, xml-end table, etc.)