NetconfSession

class ydk::path::NetconfSession : public path::Session

Implementation of Session for the netconf protocol.

NetconfSession(const std::string &address, const std::string &username, const std::string &password, int port = 830, const std::string &protocol = "ssh", bool on_demand = true, bool common_cache = false, int timeout = -1)

Constructs an instance of the NetconfSession to connect to a server which has to support model download

Parameters:
  • address – IP address of the device supporting a netconf interface
  • username – Username to log in to the device
  • password – Password to log in to the device
  • port – Device port used to access the netconf interface. Default value is 830
  • protocolssh or tcp.
  • on_demand – Enable on demand downloading by default.
  • common_cache – Use different directories for different connections by default.
  • timeout – The timeout in microseconds, -1 for infinite timeout, 0 for non-blocking
NetconfSession(const path::Repository &repo, const std::string &address, const std::string &username, const std::string &password, int port = 830, const std::string &protocol = "ssh", bool on_demand = true, int timeout = -1)

Constructs an instance of the NetconfSession using the provided Repository

Parameters:
  • repo – Reference to an instance of Repository
  • address – IP address of the device supporting a netconf interface
  • username – Username to log in to the device
  • password – Password to log in to the device
  • port – Device port used to access the netconf interface. Default value is 830
  • protocolssh or tcp.
  • on_demand – Enable on demand downloading by default.
  • timeout – The timeout in microseconds, -1 for infinite timeout, 0 for non-blocking
NetconfSession(const std::string &address, const std::string &username, const std::string &private_key_path, const std::string &public_key_path, int port = 830, bool on_demand = true, bool common_cache = false, int timeout = -1)

Constructs an instance of the NetconfSession to connect to a server which has to support model download

Parameters:
  • address – IP address of the device supporting a netconf interface
  • username – Username to log in to the device
  • private_key_path – Path to private key file.
  • public_key_path – Path to public key file.
  • port – Device port used to access the netconf interface. Default value is 830
  • on_demand – Enable on demand downloading by default.
  • common_cache – Use different directories for different connections by default.
  • timeout – The timeout in microseconds, -1 for infinite timeout, 0 for non-blocking
NetconfSession(const path::Repository &repo, const std::string &address, const std::string &username, const std::string &private_key_path, const std::string &public_key_path, int port = 830, bool on_demand = true, int timeout = -1)

Constructs an instance of the NetconfSession using the provided Repository

Parameters:
  • repo – Reference to an instance of Repository
  • address – IP address of the device supporting a netconf interface
  • username – Username to log in to the device
  • private_key_path – Path to private key file
  • public_key_path – Path to public key file.
  • port – Device port used to access the netconf interface. Default value is 830
  • on_demand – Enable on demand downloading by default.
  • timeout – The timeout in microseconds, -1 for infinite timeout, 0 for non-blocking
path::RootSchemaNode &get_root_schema() const

Returns the RootSchemaNode tree supported by this instance of the NetconfSession.

Returns:Pointer to the RootSchemaNode or nullptr if one could not be created.
std::shared_ptr<path::DataNode> invoke(path::Rpc &rpc) const

Invokes or executes the given RPC and returns a DataNode pointer if the Rpc has an output modelled in YANG.

Parameters:rpc – Reference to the Rpc node.
Returns:Shared pointer to the DataNode representing the output.
std::shared_ptr<path::DataNode> invoke(path::DataNode &datanode) const

Invokes or executes the given DataNode containing a YANG 1.1 action and returns a DataNode pointer if the action has an output modeled in YANG.

param datanode:Reference to the DataNode node.
return:Pointer to the DataNode representing the output.
std::string execute_netconf_operation(path::Rpc &rpc) const

Sends the specified RPC to device (similar to invoke function) and returns device response in XML encoded string.

Parameters:rpc – Reference to the Rpc node.
Returns:std::string, which represents the RPC output.
std::vector<std::string> get_capabilities() const

Returns a vector of the client’s capabilities

Returns:A vector of std::string representing the client/server capabilities
~NetconfSession()