manager – High-level API

Customizing

These attributes control what capabilties are exchanged with the NETCONF server and what operations are available through the Manager API.

Factory functions

A Manager instance is created using a factory function.

Manager

Exposes an API for RPC operations as method calls. The return type of these methods depends on whether we are in asynchronous or synchronous mode.

In synchronous mode replies are awaited and the corresponding RPCReply object is returned. Depending on the exception raising mode, an rpc-error in the reply may be raised as an RPCError exception.

However in asynchronous mode, operations return immediately with the corresponding RPC object. Error handling and checking for whether a reply has been received must be dealt with manually. See the RPC documentation for details.

Note that in case of the get() and get_config() operations, the reply is an instance of GetReply which exposes the additional attributes data (as Element) and data_xml (as a string), which are of primary interest in case of these operations.

Presence of capabilities is verified to the extent possible, and you can expect a MissingCapabilityError if something is amiss. In case of transport-layer errors, e.g. unexpected session close, TransportError will be raised.

Special kinds of parameters

Some parameters can take on different types to keep the interface simple.

Source and target parameters

Where an method takes a source or target argument, usually a datastore name or URL is expected. The latter depends on the :url capability and on whether the specific URL scheme is supported. Either must be specified as a string. For example, “running”, “ftp://user:pass@host/config”.

If the source may be a config element, e.g. as allowed for the validate RPC, it can also be specified as an XML string or an Element object.

Filter parameters

Where a method takes a filter argument, it can take on the following types:

  • A tuple of (type, criteria).

    Here type has to be one of “xpath” or “subtree”.

    • For “xpath” the criteria should be a string containing the XPath expression or a tuple containing a dict of namespace mapping and the XPath expression.

    • For “subtree” the criteria should be an XML string or an Element object containing the criteria.

  • A list of spec

    Here type has to be “subtree”.

    • the spec should be a list containing multiple XML string or multiple Element objects.

  • A <filter> element as an XML string or an Element object.