Initializing default data in CDB for the managed object

Hi,

I have a yang file defined for my managed object which gets loaded in ConfD with no initialization data. The data entry has to be dynamically added when my managed object boots up.
How do I initialize default configuration for my managed object in the CDB?
How do I add an entry for my managed object?

Note My managed object boots up in some random IP address so I can’t have a default static configuration in a .xml file. Every time a managed object boots up, I want to add an entry to my CDB.

How can I add an entry to the CDB from my managed object?

Regards.

There are several ways that you might add dynamic configuration information at start-up.

One way would be to use the confd_load command right after ConfD starts to load a file containing the device specific information. Some application would need to collect the information and write it to the file. This could be done in an init script or as part of start-up script where you start ConfD.

Another way is to write a small application using MAAPI (the Management Agent API), to write data into CDB at start-up for those items in your YANG model which are device specific and can only be determined at start-up.

Thank you @greg. As directed by you I have written an application using MAAPI which writes data into CDB. Things are working absolutely fine so far; however, I want to know how is confD supposed to know when my managed object goes down?
When my managed object goes down I want to delete all of its configurations and operational data from the CDB?
Do I have to subscribe to notification socket in my confD server to the managed object?
What is the best approach to achieve this?

Regards.

I think you can also use XML init file to initialize dynconfig

<config xmlns="http://tail-f.com/ns/config/1.0">
  <confdConfig xmlns="http://tail-f.com/ns/confd_dyncfg/1.0">
.....
  </confdConfig>
</config>

Not really sure what is Managed Object in you scenario? Is it ConfD Application daemon that accesses ConfD via Maapi or reads Subscriptions? Or is it some device that ConfD configures and you want to automatically remove its config from CDB what it goes down?

Yes, its a device which confD configures. So the thing is, when the device boots up it uses MAAPI’s to initialize(write) its configuration data in the CDB.
The question is
Is there any possible way with confD that I can monitor the device’s node so that whenever the node goes down I can delete the device configuration and operation data from the CDB?

Regards.

Thanks for clarification. I understood that during boot an ConfD application is started on your device and it writes its configuration data (for all device nodes) to ConfD.
Some of the device nodes can go down (device itself is still up). There is no ConfD application running on the nodes. Is it correct?

I think for such scenario you should have ConfD application (maybe same that wrote config data) monitoring your device nodes and deleting configuration form CDB. I don’t think ConfD has capability to simly monitor nodes of your device, especially if they do not run any ConfD app.

I think you got me wrong here. I mean all my devices will be running confD application. When the devices boot up they create a list element of their own in the CDB.

So here, as the confD application is started in my devices I can use MAAPI’s to create and add list element to the CDB. but when the device goes down (power off), I want to remove that device’s list element from the CDB. At this point, my device is completely off so I won’t be able to use MAAPI to delete that element from the CDB.

So the question is, is there any possible way through which ConfD can monitor the running Confd applications? and when the connection to that application or device is lost the configuration data and operation data of that specific device be deleted from the CDB?

All my devices are running confD application. How can I monitor their nodes?

Yes, I understood ConfD is running on the device. But I also understood that device has (one or more) nodes (from Is there any possible way with confD that I can monitor the device’s node). Node is something that ConfD is not running on. Is it true?

My suggestion was you implement monitoring of nodes in your application running on device (All my devices are running ConfD application.) yourself. Once you detect node goes down, your delete corresponding config in CDB (with MAAPI).

I don’t think ConfD can monitor node. You even have not describe how to detect the node is down (e.g. process disappears, heartbeat tick stops, etc.). There are many ways to check this, so I believe it is user’s application that has to check it.