ConfD User Community

When statement to hide display of certain list entries


My yang is something like this.

container global {
  list mylist
    key "name";
    leaf name {
      type string;
      description "key field";

My requirement is to block the display of the list mylist when the key matches some regex pattern.
For example, I would need the list entries to be displayed when key matches one of these


but not for these.


Is it possible to achieve this by annotating the list.

I tried having annotation as below.

tailf:annotate global/mulist {
  when "(re-match(./name, 'abc.*') = 'true'");

But from confd xpath tracing logs, this statement evaluates to false, so nothing gets displayed
Any help is appreciated.

Vaishnavi CU


The failure is likely due to the incorrect keypath. One way is to replace the subject part of the re-match expression with /global/mylist/name instead of ./name.