NetconfSession¶
-
class
ydk.path.
NetconfSession
(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. - port – (
int
) Device port 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. - private_key_path – (
str
) Path to private key file. Requires public_key_path field. - public_key_path – (
str
) Path to public key file. Does not allow password field, if specified.
-
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.Parameters: rpc – ( Rpc
) Given RPC to be executed.Returns: DataNode
.
-
invoke
(datanode) Invokes or executes the given DataNode and returns a
DataNode
pointer if the action has an output modeled in YANG.Parameters: datanode – ( Rpc
) Given DataNode containing YANG 1.1 action to be executed.Returns: DataNode
.
-
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 of the client
Returns: A list of str
representing the client’s/server’s capabilities
- address – (