How to use set-hook in leaf-list?

Hi All,

 I all. I am using set-hook inside a list as shown in the below code. But yang is not invoking the callback function. I am able to invoke the callback function using container. But I really don;t know why set-hook is not working in leaf-list.

Can someone please suggest how to invoke a callback function from leaf-list ?

leaf-list code, with set-hook not working:

list set_channel_reverse {
config true;
tailf:callpoint olt {
tailf:set-hook subtree;
}
key value;
leaf value {
type enumeration {
enum “Disable”;
enum “Enable”;
}
}
}

Container code with set-hook working:

container set_system {
leaf host_msg_timeout {
config true;
tailf:callpoint olt {
tailf:set-hook subtree;
}
type uint16 {
range “0 … 10000”;
}
}
}

Any help on this would be rally appreciated.

Can you share the code where you register callbacks for the hook?

Example:

olt_hook.create   = olt_hook_create;
olt_hook.remove   = olt_hook_remove;
olt_hook.set_elem   = olt_hook_set_elem;
strcpy(olt_hook.callpoint, "olt");

If you ommit one of the callbacks registration, it will be set to NULL.
For example if you only register the create and remove callbacks, the set_elem callback will be set to NULL and you won’t trigger your application code if you set a leaf under an already created list.

So make sur you have the set_elem callbacks registered as well.

-Nabil

For me for list callback is invoked but looks like I can’t have more than 1 leaf node. Since for other leaf nodes also it keeps showing the values fetched from the callpoint.

Btw setting mandatory=TRUE does the trick in the list calling the hook function. But not sure why its a must…