Clear confd database on callhome

Hi,
We have a feature of on every call home,confd should clear the database. So is there any API available so that we can clear the existing data from the database.
If you can figure out any API through which we can clear the data from our application which is connected to the confd server, then it will be helpful.

Regards,
Biswajit

It depends on what you mean by “clear the existing data”. There is for instance maapi_delete_all which literally clears the existing data, but I don’t think this is what you intended. Can you elaborate?

Hi,
Thanks for your input.
Basically, I need to clear all the edit-config (R/W) leaf nodes of a container whenever there is a loss in a call home connection.
If there is any API that will delete all the leafs having config=true, then it will solve my problem

Regards,
Biswajit

Can you explain your use case in more detail? The transaction logic is “all or nothing”, so if a NETCONF connection drops in the middle of a transaction, no changes are applied. It looks like you are trying to repair an incomplete transaction after a connection loss, but that should not be necessary.

Hi ,
when ever the call home fails(netconf connection lost) after the successful connection.I need to delete all the configurations pushed by the client. For example, after call home succedded, Client has configured the Radio as Single carrier 4T4R.But once call home fails and again when it tries to connect i need to clear all the previous configurations pushed by client from confd data base so that the fresh data can be stored and configured accordingly.

Regards,
Biswajit

Can you use rollbacks for that? There is maapi_list_rollbacks to get a list of available rollbacks, and maapi_load_rollback/maapi_load_rollback_fixed to load a rollback into a transaction. I would say this is a better option than to “manually” revert the changes.

Hi ,
I have tried to use maapi_delete_all api. But it deletes everything including registered call point.
When i tried to deletes a container through an rpc as below, It deletes all the contents of the user-plane-configuration container.
The same feature I am looking for a api through which i can clear the contents of a container from confd application.
So whenever there is a loss in connection with a client, I can call the api to clear the container’s data only.

<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
<edit-config>
<target>
<running/>
</target>
<config>
<user-plane-configuration xmlns="urn:o-ran:uplane-conf:1.0" operation="delete">
 </user-plane-configuration>

Hope i am able to clarify my objective to achieve.

Regards,
Biswajit

If all you need is just to delete a single node, use maapi_delete - is this what you are looking for?

Hi ,
i was trying to use maapi_delete API instead of maapi_delete_all as below:

 char *user="admin";
 enum confd_dbname dbname=CONFD_RUNNING;
char *context="maapi";
struct confd_ip ip;
const char *groups[] = {"admin"};
ip.af = AF_INET;
inet_pton(AF_INET, "127.0.0.1", &ip.ip.v4);
int ret=0;
maapi_start_user_session(fd,user,context,groups, 1,&ip, CONFD_PROTO_TCP);
tid = maapi_start_trans(fd, dbname, CONFD_READ_WRITE);
if(tid<0)
  alwaysLog("UPLANE:maapi transaction start failed");
  maapi_set_namespace(fd, tid,o_ran_uplane_conf__ns);
//maapi_delete_all(fd,tid,MAAPI_DEL_ALL);
ret=maapi_delete(fd,tid,"user-plane-configuration");
 if(ret<0)
   alwaysLog("UPLANE: DELETE FAILED");

While executing the above piece of code,i am not getting error. But when i try to fetch the container data by :
netconf-console-tcp --host=10.10.11.172 -port=2023 --get -x /user-plane-configuration,
still it is showing the values in container.

where as if i uncomment the maapi_delete_all api and comment the maapi_delete api,then everything is getting deleted including all call points,action points etc…

Can you please figure out my mistake if any, then it will be really helpful.

Regards,
Biswajit

I see that you start the user session and the transaction, but I don’t see that you apply (maapi_apply_trans) and finish (maapi_finish_trans) the transaction .

Hi ,
I am extremely sorry for late reply.
Thanks a lot for your input.
Now i have added two API as suggested,but now it is also deleting all the call points and action points which was getting deleted by maapi_delete_all API earlier.

int fd=getMaapisockFd();
int tid;
char *user="admin";
enum confd_dbname dbname=CONFD_RUNNING;
char *context="maapi";
struct confd_ip IP;
const char *groups[] = {"admin"};
ip.af = AF_INET;
inet_pton(AF_INET, "127.0.0.1", &ip.ip.v4);
int ret=0;
maapi_start_user_session(fd,user,context,groups, 1,&ip, CONFD_PROTO_TCP);
tid = maapi_start_trans(fd, dbname, CONFD_READ_WRITE);
if(tid<0)
alwaysLog("UPLANE:maapi transaction start failed");
 maapi_set_namespace(fd, tid,o_ran_uplane_conf__ns);
//maapi_delete_all(fd,tid,MAAPI_DEL_ALL);
ret=maapi_delete(fd,tid,"user-plane-configuration");
if(ret<0)
alwaysLog("UPLANE: DELETE FAILED");
maapi_apply_trans(fd,tid,0);
if (maapi_finish_trans(fd, tid) != CONFD_OK)
{
    alwaysLog("Maapi Finish transaction failed");
}

actionpoints:
id=cb_rpc ** not registered
id=cb_rpc_file_download ** not registered
id=cb_rpc_file_upload ** not registered
id=cb_rpc_reset ** not registered
id=cb_rpc_ret_file_list ** not registered
id=cb_rpc_software_activate ** not registered
id=cb_rpc_software_download ** not registered
id=cb_rpc_software_install ** not registered
id=cb_rpc_start_trouble ** not registered

callpoints:
id=cb_op_fm ** not registered
id=cb_op_hw_component ** not registered
id=cb_op_ptp ** not registered
id=cb_op_rx_carrier ** not registered
id=cb_op_rx_pm ** not registered
id=cb_op_sfp ** not registered
id=cb_op_sw_inv ** not registered
id=cb_op_sync ** not registered
id=cb_op_trans_pm ** not registered
id=cb_op_tx_carrier ** not registered

Now when i execute :
netconf-console-tcp --host=10.21.10.234 -port=2023 --get -x /user-plane-configuration
I am getting message like: unexpected EOF in NETCONF transport

Can you please help me if i am missing anything else,then it will be really helpful.
Regards,
Biswajit

You cannot delete a callpoint or an action point. What happens is most likely that the application(s) that registered for the callpoints terminated or simply crashed. This is the meaning of the not registered status: there is no application that registers that callpoint.

The “unexpected EOF” is very likely related - if the data that should have been retrieved by that NETCONF query is provided by the application that is no longer running, this would be the response.

You should inspect logs of the application and investigate why it terminated.

Hi,
It took long time to find the reason of crashing.When i enabled the trace log,found application is halted for some time while executing the maapi_apply_trans API.Later it gave error like external error - application communication failure.
Log:
TRACE MAAPI_START_USER_SESSION --> CONFD_OK
TRACE MAAPI_START_TRANS --> CONFD_OK
TRACE MAAPI_SET_NAMESPACE --> CONFD_OK
TRACE MAAPI_DELETE user-plane-configuration --> CONFD_OK
TRACE MAAPI_APPLY_TRANS
DEBUG external error - application communication failure

If you can figure out what could be the probable reason,then it will help me in further debugging.

Regards,
Biswajit

This is not enough to tell what went wrong, look into the devel.log, maybe there’s more. My first guess would be that you have configuration stored in an external database and the communication between ConfD and the application responsible for the external database was broken for some reason.