Question:

Is there a simple function to find the referenced object of a leafref object?


leaf a
    type string;

leaf b
   type leafref;
   path “/a” 


Solution:

Use the obj_get_leafref_targobj() function

   

obj_template_t *leafref_obj = obj_get_leafref_targobj(leaf_obj);