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.

Is the operational datastore enabled in your confd.conf? See the confd.conf(5) man page.

Sorry for late reply. Yes it is enabled in confd.conf as below

<confdConfig xmlns="http://tail-f.com/ns/confd_cfg/1.0">
</cdb>
    <operational>
      <enabled>true</enabled>
      <persistent>always</persistent>
    </operational>
</cdb>
</confdConfig>

What version of ConfD are you using?

it is V8.0

./confd --version
8.0

And what does ConfD return when you run something like below?:

confd_load -dd -Fp -O -p '/confd-state/internal/cdb/datastore'

Below is the output

TRACE Connected (maapi) to ConfD
starting user session ctxt=system user=system groups=[system]
TRACE MAAPI_START_USER_SESSION  --> CONFD_OK
TRACE MAAPI_START_TRANS  --> CONFD_OK
TRACE MAAPI_SAVE_CONFIG  --> CONFD_OK
TRACE Connected (stream) to ConfD
<config xmlns="http://tail-f.com/ns/config/1.0">
TRACE MAAPI_SAVE_CONFIG_RESULT  --> CONFD_OK
</config>
TRACE MAAPI_END_USER_SESSION  --> CONFD_OK

One of the files below has been modified (by you) and compiled to a new FXS variant to exclude the datastore list or more of the data under the confd-state container. Check how you rebuilt these files that comes with ConfD:
$CONFD_DIR/src/confd/yang/tailf-confd-monitoring.yang annotated by $CONFD_DIR/src/confd/yang/tailf-confd-monitoring-ann.yang and uses
$CONFD_DIR/src/confd/yang//tailf-common-monitoring.yang annotated by $CONFD_DIR/src/confd/yang/tailf-common-monitoring-ann.yang

The FXS files are normally loaded by ConfD at startup from $CONFD_DIR/etc/confd/