Base class for all operations, directly corresponding to rpc requests. Handles making the request, and taking delivery of the reply.
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).
Parameter: | op – operation to be requested |
---|---|
Return type: | RPCReply (sync) or RPC (async) |
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.
Depending on this exception raising mode, an rpc-error in the reply may be raised as RPCError exceptions. Valid values:
Timeout in seconds for synchronous waiting defining how long the RPC request will block on a reply before raising TimeoutExpiredError. By default there is no timeout, represented by None.
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 the attributes defined by this class and any subclasses.
Bases: ncclient.operations.errors.OperationError
Represents an rpc-error. It is a type of OperationError and can be raised like any other exception.
TODO
The operation classes are currently undocumented. See documentation of Manager for methods that utilize the operation classes. The parameters accepted by request() for these classes are the same.