How to identify A.cdb or O.cdb changed without CLI

Hi @cohult

Is there any method available to check A.cdb is modified by any configuration.
Without using CLI or NetConf yang client.

Sorry if the query is basic.

Regards,
Chandra

Hi Chandra,
Please address the “ConfD user community” and not me directly with questions.
See About - ConfD User Community

There are several ways depending on what “check A.cdb is modified by any configuration”. You can:

  • Subscribe to configuration changes using the CDB API.
  • Check if the transaction ID has changed.
  • If you have rollbacks enabled, check if there is a new rollback file.
    etc.

Usually you implement a CDB API C, Java, Python, or Erlang application that subscribes to configuration updates through the IPC port, default port 4565. You can use the confd_cmd tool (C implementation) to test that. Example:

$CONFD_DIR/bin/confd_cmd -c 'subwait "/"'

or for example:

$CONFD_DIR/bin/confd_cmd -c 'subwait_mods "/path/to/my/config"'

to use “cdb_get_modifications()” to get the changes made to some config of interest.
The confd_cmd source code can be found under $CONFD_DIR/src/confd/tools/confd_cmd

Regards

Hi All,

Sorry @cohult , I will take care from next queries.

To be more specific, below explaining my query.

  • As part of development we will maintain A.cdb/C.dbb/O.cdb in RAM memory
  • Periodically (say 20 seconds) would like to copy these files from RAM memory to Flash memory by using a another process (say process A).
  • Due to this expectation, process A, just know if there is any change in cdb files, it doesn’t need to know, which path changed. Any change needs to be identified.
  • Here, we can use confd_cmd from process-A.

So, any possibility to check by confd_cmd for any changes in CDB files, irrespective of any path ?

Regards,
Chandrakanth S.

Hi,

Try using cab_get_txid() or confd_cmd -c txid, store the returned transaction id somewhere, and compare with it next time you check. The transaction id will be updated when you commit configuration, which will persisted to the A.cdb file.

Regards

Hi,

Thanks for the inputs, using confd_cmd as “confd_cmd -c txid” is working as expected.

In parallel

I tried to get txid of operational cdb as “confd_cmd -o -c txid”, but this again given txid of A.cdb

Example:
Collected debug dump as confd --cdb-debug-dump > tmp.txt

root@temp:bin> grep TXID tmp.txt
/0:0 (TXID) = 989-448961-20935, —> this refers to A.cdb
/0:0 (TXID) = 8374, —> this refers to O.cdb

then

root@temp:bin> ./confd_cmd -c txid
989-448961-20935
root@temp:bin> ./confd_cmd -o -c txid
989-448961-20935
root@temp:bin>

Here, though option "-o " has been used it fetches A.cdb txid

Regards,
Chandra

hi All,

Any inputs on above mentioned observation w.r.t the command "./confd_cmd -o -c txid’ (in above given example)

Regards,
Chandrakanth S.

For the operational datastore try:
confd_cmd -o -c 'mget "/confd-state/internal/cdb/datastore{operational}/transaction-id"'

Hi,

Above suggested command results in below error.

FAILED: maapi_get_elem(ms, mtid, &val, argv[0]), Error: item does not exist (1): /tfcm:confd-state/internal/cdb/datastore{operational} does not exist, in function do_maapi_get, line 1642

Regards,
Chandrakanth S.