How to change a Yang Leaf value programatically

I have a Yang file in which there is a leaf node named “status” with boolean default value as false.

Once I change the value of node “status” from false to true, I am getting notification and I am doing some operations as part of that notification.

What I want to do is after I am done with those operations I want to set the node “status” value to false again using the C program.

Is there any way to do that?

Is this leaf configuration or operational data? Is the data being stored in CDB?

This is a configuration data. Yes it is being stored in CDB.

This is a configuration data. Yes it is being stored in CDB.

It is not advised to have a self modifying configuration value in your data model as this will cause problem for service orchestration software to stay synchronized with your device, unless this is hidden from the northbound interfaces, such as NETCONF.

You can use the MAAPI interface to write configuration data into CDB. Take a look at examples.confd/misc/maapi_cli in your ConfD distribution for example code of how to work with MAAPI. You will want to perform the write operation outside of your CDB subscription code to prevent any deadlock situation. You will also need to take care to note the difference in your subscriber code between the end user making the change through the northbound interfaces versus the changes made through MAAPI.