What is the difference between Validation Points and CDB two-phase subscriptions from the refusing/accepting config point of view?

I think we could refuse the invalid configuration in the prepare phase in cdb subscriber, and also do this in validation callback. I don’t know why confd bring in validation callpoint, is there any benefit?

These folloing two differences I’ve known:

  1. validation callpoint can accept config with warning, while cdb subscriber not.
  2. validation callpoint must explicit writen in yang and implement callback functions which can only validate the certain scope, while cdb subscriber seems much easier to validate any config without any modification in yang.

Do I misunderstand the configuration validation?

If you do validation in the prepare phase you have already updated the data base with the new config and will have to undo everything if validation fails.

Also, to support the :validate NETCONF capability or the validate CLI command you must ru all validation, be it must statements or C validation callbacks in the validation phase.

Yes, the prepare phase is after the write phase. If validation fails in prepare phase confd will undo everything, is that true?

The reason we have to validate the config in prepare phase is that, we don’t know whether the config is ok until we call the actually operation function, and check it’s return value.

Hi Lynn,

Correct, nothing will be set if you abort the transaction in the prepare phase.
As noted earlier above, the manager can abort the transaction in the prepare phase too, so if you do any changes in your system already at this phase outside of the scope of the transaction you must be able to undo them if you or the manager (initator of the transaction) decides to abort.

I highly recommend the ConfD example that show you a simple but very good implementation of an abort in the prepare phase:

See also confd_lib_cdb man pages:
cdb_sub_abort_trans() and cdb_sub_abort_trans_info()

Hi cohult, thank you very much.

If i’m planning to process all the config in prepare phase, is that safe?
the following pseudo code supposes each transaction enter prepare phase must be enter the commit phase without calling cdb_sub_abort_trans().

switch (type)
    task_ok = false;
    do {
        if(!do_task(cfg1)) break;
        if(!do_task(cfg2)) break;
        task_ok = true;
    if(task_ok == true) 
        cdb_sync_subscription_socket(ss, CDB_DONE_PRIORITY);
     cdb_sync_subscription_socket(ss, CDB_DONE_PRIORITY);

Not knowing the details of your do_task( ) implementation, your pseudo code looks fine to me.

The do_task() perform the actually action on some resources such as enables a router, dispatches acl rules to data plane, allocates ip address pool, creates interfaces and so on.