Define how errors indicated by RPC should be handled.
Note that any error_filters defined in the device handler will still be applied, even if ERRORS or ALL is defined: If the filter matches, an exception will NOT be raised.
Don’t look at the error-type, always raise.
Raise only when the error-type indicates it is an honest-to-god error.
Base class for all operations, directly corresponding to rpc requests. Handles making the request, and taking delivery of the reply.
session is the Session instance
device_handler” is the :class:`~ncclient.devices..*DeviceHandler` instance
async specifies whether the request is to be made asynchronously, see is_async
timeout is the timeout for a synchronous request, see timeout
raise_mode specifies the exception raising mode, see raise_mode
Subclasses can specify their dependencies on capabilities as a list of URI’s or abbreviated names, e.g. ‘:writable-running’. These are verified at the time of instantiation. If the capability is not available, MissingCapabilityError is raised.
Subclasses can use this method to verify that a capability is available with the NETCONF server, before making a request that requires it. A MissingCapabilityError will be raised if the capability is not available.
Implementations of request() call this method to send the request and process the reply.
In synchronous mode, blocks until the reply is received and returns RPCReply. Depending on the raise_mode a rpc-error element in the reply may lead to an RPCError exception.
In asynchronous mode, returns immediately, returning self. The event attribute will be set when the reply has been received (see reply) or an error occured (see error).
op is the operation to be requested as an Element
Exception type if an error occured or None.
Note
This represents an error which prevented a reply from being received. An rpc-error does not fall in that category – see RPCReply for that.
Event that is set when reply has been received or when an error preventing delivery of the reply occurs.
Specifies whether this RPC will be / was requested asynchronously. By default RPC’s are synchronous.
Depending on this exception raising mode, an rpc-error in the reply may be raised as an RPCError exception. Valid values are the constants defined in RaiseMode.
Subclasses must implement this method. Typically only the request needs to be built as an Element and everything else can be handed off to _request().
Timeout in seconds for synchronous waiting defining how long the RPC request will block on a reply before raising TimeoutExpiredError.
Irrelevant for asynchronous usage.
Represents an rpc-reply. Only concerns itself with whether the operation was successful.
Note
If the reply has not yet been parsed there is an implicit, one-time parsing overhead to accessing some of the attributes defined by this class.
No-op by default. Gets passed the root element for the reply.
List of RPCError objects. Will be empty if there were no rpc-error elements in reply.
Boolean value indicating if there were no errors.
rpc-reply element as returned.
Bases: ncclient.operations.errors.OperationError
Represents an rpc-error. It is a type of OperationError and can be raised as such.
XML string or None; representing the error-info element.
The contents of the error-message element if present or None.
The contents of the error-path element if present or None.
The contents of the error-severity element.
The contents of the error-tag element.
The contents of the error-type element.
Bases: ncclient.operations.rpc.RPC
The get RPC.
session is the Session instance
device_handler” is the :class:`~ncclient.devices..*DeviceHandler` instance
async specifies whether the request is to be made asynchronously, see is_async
timeout is the timeout for a synchronous request, see timeout
raise_mode specifies the exception raising mode, see raise_mode
Retrieve running configuration and device state information.
filter specifies the portion of the configuration to retrieve (by default entire configuration is retrieved)
Seealso: | Filter parameters |
---|
Bases: ncclient.operations.rpc.RPC
The get-config RPC.
session is the Session instance
device_handler” is the :class:`~ncclient.devices..*DeviceHandler` instance
async specifies whether the request is to be made asynchronously, see is_async
timeout is the timeout for a synchronous request, see timeout
raise_mode specifies the exception raising mode, see raise_mode
Retrieve all or part of a specified configuration.
source name of the configuration datastore being queried
filter specifies the portion of the configuration to retrieve (by default entire configuration is retrieved)
Seealso: | Filter parameters |
---|
Bases: ncclient.operations.rpc.RPCReply
Adds attributes for the data element to RPCReply.
data element as an Element
data element as an XML string
Bases: ncclient.operations.rpc.RPC
Generic retrieving wrapper
session is the Session instance
device_handler” is the :class:`~ncclient.devices..*DeviceHandler` instance
async specifies whether the request is to be made asynchronously, see is_async
timeout is the timeout for a synchronous request, see timeout
raise_mode specifies the exception raising mode, see raise_mode
rpc_command specifies rpc command to be dispatched either in plain text or in xml element format (depending on command)
source name of the configuration datastore being queried
filter specifies the portion of the configuration to retrieve (by default entire configuration is retrieved)
Seealso: | Filter parameters |
---|
Examples of usage:
dispatch('clear-arp-table')
or dispatch element like
xsd_fetch = new_ele('get-xnm-information')
sub_ele(xsd_fetch, 'type').text="xml-schema"
sub_ele(xsd_fetch, 'namespace').text="junos-configuration"
dispatch(xsd_fetch)
Bases: ncclient.operations.rpc.RPC
edit-config RPC
session is the Session instance
device_handler” is the :class:`~ncclient.devices..*DeviceHandler` instance
async specifies whether the request is to be made asynchronously, see is_async
timeout is the timeout for a synchronous request, see timeout
raise_mode specifies the exception raising mode, see raise_mode
Loads all or part of the specified config to the target configuration datastore.
target is the name of the configuration datastore being edited
config is the configuration, which must be rooted in the config element. It can be specified either as a string or an Element.
default_operation if specified must be one of { “merge”, “replace”, or “none” }
test_option if specified must be one of { “test_then_set”, “set” }
error_option if specified must be one of { “stop-on-error”, “continue-on-error”, “rollback-on-error” }
The “rollback-on-error” error_option depends on the :rollback-on-error capability.
Bases: ncclient.operations.rpc.RPC
delete-config RPC
session is the Session instance
device_handler” is the :class:`~ncclient.devices..*DeviceHandler` instance
async specifies whether the request is to be made asynchronously, see is_async
timeout is the timeout for a synchronous request, see timeout
raise_mode specifies the exception raising mode, see raise_mode
Delete a configuration datastore.
target specifies the name or URL of configuration datastore to delete
Seealso: | Source and target parameters |
---|
Bases: ncclient.operations.rpc.RPC
copy-config RPC
session is the Session instance
device_handler” is the :class:`~ncclient.devices..*DeviceHandler` instance
async specifies whether the request is to be made asynchronously, see is_async
timeout is the timeout for a synchronous request, see timeout
raise_mode specifies the exception raising mode, see raise_mode
Create or replace an entire configuration datastore with the contents of another complete configuration datastore.
source is the name of the configuration datastore to use as the source of the copy operation or config element containing the configuration subtree to copy
target is the name of the configuration datastore to use as the destination of the copy operation
Seealso: | Source and target parameters |
---|
Bases: ncclient.operations.rpc.RPC
validate RPC. Depends on the :validate capability.
session is the Session instance
device_handler” is the :class:`~ncclient.devices..*DeviceHandler` instance
async specifies whether the request is to be made asynchronously, see is_async
timeout is the timeout for a synchronous request, see timeout
raise_mode specifies the exception raising mode, see raise_mode
Validate the contents of the specified configuration.
source is the name of the configuration datastore being validated or config element containing the configuration subtree to be validated
** modified to only accept valid string as source argument. Elements no longer accepted - earies - 04/22/2013
Seealso: | Source and target parameters |
---|
Bases: ncclient.operations.rpc.RPC
commit RPC. Depends on the :candidate capability, and the :confirmed-commit.
session is the Session instance
device_handler” is the :class:`~ncclient.devices..*DeviceHandler` instance
async specifies whether the request is to be made asynchronously, see is_async
timeout is the timeout for a synchronous request, see timeout
raise_mode specifies the exception raising mode, see raise_mode
Commit the candidate configuration as the device’s new current configuration. Depends on the :candidate capability.
A confirmed commit (i.e. if confirmed is True) is reverted if there is no followup commit within the timeout interval. If no timeout is specified the confirm timeout defaults to 600 seconds (10 minutes). A confirming commit may have the confirmed parameter but this is not required. Depends on the :confirmed-commit capability.
confirmed whether this is a confirmed commit
timeout specifies the confirm timeout in seconds
Bases: ncclient.operations.rpc.RPC
discard-changes RPC. Depends on the :candidate capability.
session is the Session instance
device_handler” is the :class:`~ncclient.devices..*DeviceHandler` instance
async specifies whether the request is to be made asynchronously, see is_async
timeout is the timeout for a synchronous request, see timeout
raise_mode specifies the exception raising mode, see raise_mode
Revert the candidate configuration to the currently running configuration. Any uncommitted changes are discarded.
Bases: ncclient.operations.rpc.RPC
lock RPC
session is the Session instance
device_handler” is the :class:`~ncclient.devices..*DeviceHandler` instance
async specifies whether the request is to be made asynchronously, see is_async
timeout is the timeout for a synchronous request, see timeout
raise_mode specifies the exception raising mode, see raise_mode
Allows the client to lock the configuration system of a device.
target is the name of the configuration datastore to lock
Bases: ncclient.operations.rpc.RPC
unlock RPC
session is the Session instance
device_handler” is the :class:`~ncclient.devices..*DeviceHandler` instance
async specifies whether the request is to be made asynchronously, see is_async
timeout is the timeout for a synchronous request, see timeout
raise_mode specifies the exception raising mode, see raise_mode
Release a configuration lock, previously obtained with the lock operation.
target is the name of the configuration datastore to unlock
Bases: ncclient.operations.rpc.RPC
close-session RPC. The connection to NETCONF server is also closed.
session is the Session instance
device_handler” is the :class:`~ncclient.devices..*DeviceHandler` instance
async specifies whether the request is to be made asynchronously, see is_async
timeout is the timeout for a synchronous request, see timeout
raise_mode specifies the exception raising mode, see raise_mode
Request graceful termination of the NETCONF session, and also close the transport.
Bases: ncclient.operations.rpc.RPC
kill-session RPC.
session is the Session instance
device_handler” is the :class:`~ncclient.devices..*DeviceHandler` instance
async specifies whether the request is to be made asynchronously, see is_async
timeout is the timeout for a synchronous request, see timeout
raise_mode specifies the exception raising mode, see raise_mode
Force the termination of a NETCONF session (not the current one!)
session_id is the session identifier of the NETCONF session to be terminated as a string