Get snmp_oid of leaf in subscription

Hi All,

Can anyone please tell me. How can we know the snmp-oid of a leaf from a subscription function.
E.g.
leaf esModemRxFreq {
type esModemRxFreqType;
tailf:snmp-oid “1.3.6.1.4.1.119.2.3.69.501.4.2.1.4”;
}

This is one esModemRxFreq leaf. I want to get snmp-oid value in subscription. So, which cdb api will be useful to get this info.

Regards,
Anup

These annotations are not available to the runtime code. You have following options instead:

  • copy it so that you can access it in the runtime, e.g. using tailf:meta-data or directly in your code - this is obviously acceptable only if you have just a few such leaves;
  • process the YANG module (in the compile time, presumably) so that you can access the data - transform it to YIN and extract from that, or write a pyang plugin that generates a C-struct or something that you can use in your code.

Hi mvf,

Thanks for sharing info.
Can you share one example of pyang plugin generation using C.

Regards,
Anup

You will have to write that pyang plugin, I haven’t seen an example available for such.

A likely much simpler solution is to use tailf:meta-data statements as @mvf suggests. C-example: