The way applications interact with CDB is by using the Libraries that ConfD provides.
The MOAPI (Managed Object API) is the API intended for applications to read and write to CDB.
CDB is an integrated database and is only managed through ConfD (initialization, upgrade, etc…).
An external program can still interact directly with CDB through the cdb_* interface by linking with the libconfd library.
Any program linked with libconfd can interact with ConfD either locally or remotely; The case of blades in a chassis system running applications, interested in configuration stored in CDB, is a valid case. Some remote systems might be running under a different environment (Processor, OS, etc…), confdLib can be rebuilt for these targets as the source code and build instructions are available to developers.
Details about this can be found in: confd-basic-.libconfd.tar.gz
For matters related to CDB backup and restore, ConfD provides commands that allow users to safely backup CDB when ConfD is running:
man confd ...
--loadxmlfiles File ...
Load configuration in XML format from Files. The configuration is completely
replaced by the contents in Files.
--mergexmlfiles File ...
Load configuration in XML format from Files. The configuration is merged with the
contents in Files. The XML may use the 'operation' attribute, in the same way as it
is used in a NETCONF <edit-config> operation.
Save a snapshot of the CDB database into a GZipp:ed tar archive file (given by the
File argument). If the File argument is a relative path, the file will be saved
relative the ConfD daemon's current working directory. Only configuration data
stored in CDB is saved (persistent CDB operational data is not). Note: if the
database is locked for writing, the command will fail.`
If ConfD is not running, CDB files can be copied and saved for a future restore operation.
From the above, I understand that it is possible to save a configuration using “confd_load”, and to restore the configuration using “confd --loadxmlfiles”.
These mechanisms presume access to the shell. Is there a way to retrieve a complete configuration backup in XML format, and to load such a backup, using the REST API?
I understand that individual nodes can be accessed via the REST API by using GET, POST, PATCH, and so forth, to specific URLs underneath /api/config. However, if I try to retrieve the entire configuration by doing a GET to /api/config or /api/running, nothing is returned.
Similarly, I would like to upload a configuration via REST and have it overwrite the currently running configuration, similar to the way “confd --loadxmlfiles” does in the shell.
Thank you. The DELETE operation, as you have described in the example with “DELETE http://127.0.0.1:8008/api/running/sys” appears to work for a subtree “sys” in the configuration.
However, I would like to clear the entire configuration and then restore it. When I try the DELETE operation on the entire configuration with “DELETE http://127.0.0.1:8008/api/running”, it does not work. Is this not supported, or is there a different way to accomplish this via REST?