Help required in implementing call home feature

Hi,
Currently, i am trying to implement the call home feature.
Objective: whenever the netconf client connects to the server, I need to initiate the call home. As of now, i was using builtin ssh for the same. But once the client restarts its application, again i have to manually need to execute the conf_cmd command for the call home.
So can you please help me, so that I will overcome this issue.
what should be the best option to handle the session and whenever the client disconnects server will get notified and i can restart the call home using maapi_netconf_ssh_call_home.
If you can provide the sample example fo the same then it will be really helpful.

Regards,
Biswjait

This sounds strange, at least this is not the standard use-case for the call-home feature. When you go over typical motivations for the feature, they all assume that the netconf server is either unreachable for the client or the client does not know that the server is available. You start with “whenever the netconf client connects to the server”, clearly a different use case; what is the point in using call-home when the client is already connected?

Hi,
Thanks alot in figuring out the wrong understanding which I was having.
summery on my understanding.
To implement the call home
When ever I will initiate confd application,after successful connection with the confd server,I should call maapi_netconf_ssh_call_home.
But I didn’t get how to implement other scenarios mentioned in the RFC.Also please me what are the pre requisite apis need to invoke before calling maapi_netconf_ssh_call_home api.it will be better if you have sample application which has call home implementation.
Regards,
Biswajit

The example set contains two call-home examples, one using the built-in SSH server, the other showing, how call-home can be implemented using the OpenSSH server. The built-in variant, if that’s enough for you, shows that there is not much that you need to do - just make sure you have SSH transport enabled and invoke maapi_netconf_ssh_call_home (the example does that using confd_cmd, but that’s certainly not the only option).

So as to invoke the function you only need to have a standard MAAPI socket - just open a socket and invoke maapi_connect_socket, that’s it.

Hi ,
Really appreciate your help. Just one more doubts,
How can I monitor it .so that when ever there is loss of connection with the server,I can call the maapo_netconf_ssh_call_home api again.
Regards,
Biswajit

If you want to react to such events, your best bet is probably the ConfD notifications API (not related to NETCONF notifications). Go through the Notification chapter in the ConfD user guide (chapter 15. for the 7.4 release), confd_lib_events manpage, and misc/notifications example.

Briefly, the API allows your application to be notified about events of many types; of those types the ones that can be useful for you are probably user session notifications, maybe NETCONF notifications.

Hi,
After going through the RFC and our requirement I understood that:
Requirement:

My understanding:
Basically in my application, I need to check whether any active netconf session with the provided IP & port is there or not .on timer expiry, If there is no active netconf session,then I have to repeat the call home procedure.

If my understanding is correct, then I am not sure how to check the active netconf session is
there or not.So please help me on that.If there is any api available then it will be really helpful.

Regards,
Biswajit

You can use maapi_get_user_sessions to get a list of sessions and then maapi_get_user_session to populate the confd_user_info struct for each session - the field context says what northbound interface was used to create the session; so this is how you can check if there are any NETCONF sessions. Is this what you are looking for?

Hi, Could you please share the example where you are using maapi_connect for socket connect and maapi_netconf_call_home api.
I am facing issues wherein the maapi_connect fails whereas normal socket connect succeeds.
For my application, I am unable to perform call home connection.

Getting error as
FAILED: maapi_connect(sockfd, (struct sockaddr*)&sAddr, sizeof(struct sockaddr_in)), Error: internal error (18): Failed to decode data