Confd_load doesn't load my backup configurations

Hi All,

I have some configurations in my device. When I try to delete the configurations and load my previous back up using confd_load -D -l -F x configs.xml it cannot delete the existing configs and load the back up.

I get an error as
Error:- “confd_load: 673: maapi_apply_trans_flags(sock, tid, 0, aflags) failed: external error (19): /router-dcl:network/vrf{test}/interface{ppp 2 access}/vrf-if-id: Vrf interface with id 2 already exists”

Suppose, I remove all the configurations manually and then try this
confd_load -D -l -F x configs.xml,

I get another error as:
confdload: 673: maapi_apply_trans_flags(sock, tid, 0, aflags) failed: external error (19): application error_

But, I don’t get this error if we use replace option(confd_load -r -l -F configs.xml). It replaces with the backup but allows only to edit this backup configuration. We cannot make new configurations that are not in the backup. So, we can’t use replace.

How can I get through this? Please help.

Hi,

Looks like your validation application reported a validation failure.
Check which ones you have registered by doing something like this:
$ confd --status | grep -A 10 "validation points"

Hi,
Thank you. But, the validation must also apply to replace option. There are no validation errors when we use replace option. How can it stop here only when we use either -D -l or just -l?

Hi,
I don’t know what or how your validation code/application determine that there is a validation error.

Your validation application should preferably not be written to validate changes/operations (seems like it does and then determines that the validation failed), rather it should validate the resulting changes.

You can point your application validation developer to ConfD UG Chapter 9.5. Validation Logic.

The difference between your two examples is that there is a maapi_delete_all() call before the configuration file is loaded. Use the “-d -d” option with the confd_load tool to get the libconfd trace output.

Using the validate/c example

$ pwd
/Users/tailf/confd-6.4.1/examples.confd/validate/c
$ confd_load -d -d -r -F p -p /mtest
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">
  <mtest xmlns="http://tail-f.com/ns/example/mtest">
    <a_number>34</a_number>
    <b_number>4</b_number>
  </mtest>
TRACE MAAPI_SAVE_CONFIG_RESULT  --> CONFD_OK
</config>
TRACE MAAPI_END_USER_SESSION  --> CONFD_OK
$ cat test.xml
<config xmlns="http://tail-f.com/ns/config/1.0">
  <mtest xmlns="http://tail-f.com/ns/example/mtest">
    <a_number>3</a_number>
    <b_number>4</b_number>
  </mtest>
$ confd_load -d -d -l -F p test.xml
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_LOAD_CONFIG_FILE  --> CONFD_OK
TRACE MAAPI_APPLY_TRANS DEBUG external error - /mtest:mtest/a_number: a_number is <= b_number 
 --> CONFD_ERR
confd_load: 682: maapi_apply_trans_flags(sock, tid, 0, aflags) failed: external error (19): /mtest:mtest/a_number: a_number is <= b_number 
$ confd_load -d -d -D -l -F p test.xml
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_DELETE_ALL  --> CONFD_OK
TRACE MAAPI_LOAD_CONFIG_FILE  --> CONFD_OK
TRACE MAAPI_APPLY_TRANS DEBUG external error - /mtest:mtest/a_number: a_number is <= b_number 
 --> CONFD_ERR
confd_load: 682: maapi_apply_trans_flags(sock, tid, 0, aflags) failed: external error (19): /mtest:mtest/a_number: a_number is <= b_number

You can see the difference of the confd_load tool -r and -D flags compared to default behaviour just by typing confd_load -h, or in the confd_load man page, or in the confd_load source code that comes with ConfD:

$ confd_load -h
...
 Valid options are (for further details, see the manpage):
    -d            debug flag
...
    -m            when loading config, merge [default is delete and replace]
    -r            when loading config, replace [default is delete and replace]
...
    -D            do maapi_delete_all(MAAPI_DEL_ALL) before loading