Example to send netconf-config-change

I understand the confd will automatically send a db change notification when changing a value in cdb database. However, there is a case I need to send a db change in the application code.
Can anyone point me to any sample code? Many thanks.

Configuration changes notifications are sent via the stream “NETCONF”, and are sent automatically by ConfD in case of configuration changes. I don’t see how you can tell confd to send one even when there are no changes; I can think of following alternatives:

  • It looks like nothing prevents you from registering your daemon for the “NETCONF” stream. Not sure if that is a good idea though, one problem I can see is that config change notifications are supposed to identify the change (see ietf-netconf-notifications YANG module).

  • You can add an artificial leaf to your data model whose sole purpose would be that your application cant trigger the configuration change notification. For instance, it can be a leaf artificial-notifications-counter that your application increments every time it needs to send a notification. Not ideal either, that leaf bears no semantic value and should not really be part of a data model; note that it may appear in configuration files saved by the operator.

  • If you have control over the notification subscriber I think your best bet would be to create a new notification stream, make the subscriber to subscribe to that stream too, and then your application is free to send notifications over that stream whenever it needs to.

You can send your own change notification over the NETCONF stream.

Yes, that was my first bullet; but then it is you (sort of), who is sending the notification, not ConfD.

Also: as we know, pretending that there is no configuration change when there are some is bad. Here it’s the other way round, we are pretending that there are configuration changes when there are none - it’s arguably better, but still somewhat fishy.