How to know operdata executed for which leaf node in the list?

Hi Experts!

We have a following yang file format

container root {
  list systemmonitor {
    config false;
    tailf:cli-incomplete-show-path;

    key name;
    tailf:callpoint respcp;

    leaf name {
      type string
    }

    leaf cpu-usage {
      type string..
    }
    leaf memory-usage {
      type string..
    }
    leaf harddisk-usage {
      type string..
    }
  }
}

I would want to return value based on the leaf node selected. So its basically their are many entries in the list… like

name => CPUMonitorHigh this has only cpu-usage field set with HIGH String
name => CPUMonitorLow this has only cpu-usage filed set with LOW String

one way I do is “show … | include HIGH” but is their anyway to know in the code that show is executed with this leaf-node ? i.e “cpu-usage / mem-usage…” so on…

rgds
Balaji

Hello,

to understand more, please can you describe your show command (perhaps write full show command for your example)?

In case you mean something like this:

show root systemmonitor CPUMonitorHigh cpu-usage , then you would receive data provider get_elem callback directly for leaf cpu-usage

If you mean something like show root systemmonitor | include CPUMonitorHigh, then you will get all list elements (lines) which contains CPUMonitorHigh. The filtering is done on CLI level, so in the C callback you will get request for all data (won’t be able to figure out the filter after include). You can test it with simple data provider implementation (see examples intro\5-c_stats)

As this is more detailed CLI question (CLI filtering), it is better to use support and open RT ticket for it.