NetconfSession
- class ydk.path.NetconfSession(repo, address, username, password, port=830, protocol="ssh", on_demand=True, common_cache=False, int timeout=None, repo=None, private_key_path="", public_key_path="")
Constructs an instance of the NetconfSession class and connects to Netconf server, which must support model download.
- Parameters
address – (
str
) IP address or DNS name of device, which supports Netconf server; required parameter.username – (
str
) Username to log in to the device; required parameter.password – (
str
) Password to log in to the device; not required, if public_key_path specified.port – (
int
) Device port number, which is used to access the Netconf interface; default value is 830.protocol – (
str
) Currently supported “ssh” for secure connection and “tcp” for insecure connection; default - “ssh”.on_demand – (
bool
) On demand model downloading by default.common_cache – (
bool
) Use common cache directory, if enabled.timeout – (
int
) The timeout in microseconds: None or -1 for infinite timeout, 0 - for non-blocking.repo – (
Repository
) User provided repository - directory, which stores cached YANG models. If not specified, the temporary repository at “~/.ydk/<address>” is created.private_key_path – (
str
) Path to private key file. This is optional parameter, which requires public_key_path field.public_key_path – (
str
) Path to public key file. This is optional parameter.
- get_root_schema()
Return
RootSchemaNode
for this Netconf session.- Returns
RootSchemaNode
for this Netconf session.
- invoke(rpc)
Invokes or executes the given RPC and returns a
DataNode
pointer, if the RPC has an output modeled in YANG.
- invoke(datanode)
Invokes or executes the given DataNode and returns a
DataNode
pointer if the action has an output modeled in YANG.
- execute_netconf_operation(rpc)
Sends specified RPC to device (similar to invoke function) and returns device response as XML encoded string.
- Parameters
rpc – (
Rpc
) The RPC to be executed.- Returns
str
- reply from device in XML encoded string.
- get_capabilities()
Returns a list of capabilities for the Netconf server.
- Returns
A list of
str
representing the Netconf server capabilities.