44 bool connect(
const std::string& ip,
int port,
const std::string& user,
const std::string& password);
55 [[nodiscard]] [[nodiscard]]
bool isConnected()
const;
62 struct lyd_node*
getData(
const std::string& xpath =
"");
69 bool editData(
const std::string& configXml);
83 bool subscribe(
const std::string& xpath, std::function<
void(
struct lyd_node*)> callback);
Manages a NETCONF client session and basic datastore operations for a network device.
Definition NetconfSession.h:22
bool isConnected() const
Checks if the NETCONF session is currently connected.
Definition NetconfSession.cpp:98
void stopNotificationListener()
Stops the background notification listener thread and cleans up resources.
Definition NetconfSession.cpp:190
std::atomic< bool > listening_
Definition NetconfSession.h:29
NetconfSession()
Definition NetconfSession.cpp:38
bool editData(const std::string &configXml)
Edits the configuration data on the NETCONF server into the candidate datastore.
Definition NetconfSession.cpp:284
bool commit()
Commits the current configuration from the candidate datastore into the running datastore.
Definition NetconfSession.cpp:344
std::thread listenerThread_
Definition NetconfSession.h:28
void startNotificationListener()
Starts a background thread to listen for incoming notifications and dispatch them to registered callb...
Definition NetconfSession.cpp:151
~NetconfSession()
Definition NetconfSession.cpp:53
struct nc_session * session_
Definition NetconfSession.h:25
std::map< std::string, std::function< void(struct lyd_node *)> > subscriptions_
Definition NetconfSession.h:27
struct lyd_node * getData(const std::string &xpath="")
Retrieves data from the NETCONF server using the specified XPath filter.
Definition NetconfSession.cpp:203
bool connect(const std::string &ip, int port, const std::string &user, const std::string &password)
Establishes a NETCONF session with the specified device via SSH.
Definition NetconfSession.cpp:59
bool subscribe(const std::string &xpath, std::function< void(struct lyd_node *)> callback)
Subscribes to notifications matching the specified XPath filter and registers a callback.
Definition NetconfSession.cpp:102
void disconnect()
Disconnects the NETCONF session.
Definition NetconfSession.cpp:90
Definition NetconfSession.h:14