Open biswajit84 opened 6 months ago
You can subscribe to netconf-session-start/stop
notifications. However, it is not really possible to detect whether a Call Home or a standard NETCONF session was established. No other way to detect a new session.
As per my understanding there is a nc_session_is_callhome in libnetconf which can detect whether the session is callhome session or not .. Is it possible to call nc_session_is_callhome from netopeer2 so that we can get the notification in our external application . If yes please share how can we achieve it ..
Well, yes, you can call that in neotpeer2 and then put this information into the notification (after you update its YANG definition). But that requires changing netopeer2 code, which you said you do not want to do.
The reason which I dont want to change is:whenever we will upgrade the netopeer version should be smooth one. As there is no other way of getting the callhome start session,then we have to modify the netopeer. "update its YANG definition " you mean to say I am supposed to modify the netconf-session-start/stop yang file. Whether I am supposed to invoke nc_session_is_callhome in np2srv_new_session_cb function. Let me know whether my understanding is correct or not..
When you are modifying netopeer2 code, I think you can simply "call" your callback meaning execute the code you want when a Call Home session is created. It will be simpler than modifying the notification.
Hi, I am getting Not found node with core dump.Can you please review what could be the mistake.
I have created a augmented yang file i.e notif-augment.yang having new leaf callhome-session node and installed the same using command sysrepoctl -i notif-augment.yang -v4 $sysrepoctl --list notif-augment | | I | biswajit:biswajit | 600 | 600 | |
pyang -f tree ietf-netconf-notifications@2012-02-06.yang notif-augment.yang +---n netconf-session-start | +--ro username string | +--ro session-id nc:session-id-or-zero-type | +--ro source-host? inet:ip-address | +--ro aug:callhome-session? boolean
When I callhome session is being initiated by netopeer2-client, I am getting core dump with "Not found node" error message.
[ERR]: SR: Not found node "callhome-session" in path. (path "/ietf-netconf-notifications:netconf-session-start")
[WRN]: NP: Failed to send a notification (libyang error).
free(): invalid next size (fast)
Aborted (core dumped)
diff common.c-orig common.c
462a463,467
>
> event_data[3].xpath = "/ietf-netconf-notifications:netconf-session-start/callhome-session";
> event_data[3].type = SR_BOOL_T;
> event_data[3].data.bool_val = nc_session_is_callhome(new_session);
> VRB("Callhome data:%d", event_data[3].data.string_val);
464c469
< c = sr_notif_send(np2srv.sr_sess, "/ietf-netconf-notifications:netconf-session-start", event_data, host ? 3 : 2,
---
> c = sr_notif_send(np2srv.sr_sess, "/ietf-netconf-notifications:netconf-session-start", event_data, host ? 4 : 2,
notif-augment.yang:
module notif-augment {
namespace "urn:ietf:params:xml:ns:yang:augment";
prefix aug;
import ietf-netconf-notifications {
prefix base;
}
augment "/base:netconf-session-start" {
leaf callhome-session {
type boolean;
description " It stores whether the current session is callhome session or not";
}
}
}
Regards, Biswajit
It is an augment, so you must use
event_data[3].xpath = "/ietf-netconf-notifications:netconf-session-start/notif-augment:callhome-session";
I have answered you now because the issue was trivial but you are asking me to help you debug your own code, that is really not the kind of support we provide.
Hi, As I dont want to change anything in netopeer, Is it possible to get callback of external application can be invoked during start/stop of callhome session.
Regards, Biswajit