M2M API¶
This collection of pages describes the external M2M Python API, which gives access to the IOS-XR management plane intended for direct use by Cisco customers. Example usage:
from xrm2m import RootOper, connect
conn = connect()
for path, info in conn.get(RootOper.Interfaces):
print(path["InterfaceName"], info["MTU"], info["ActualState"])
The interface also has facilities for operating asynchronously, and remotely over SSH.
See Usage examples for more examples.
The main module exports are:
connect()
: Function to connect to a router, and return aConnection
object.Connection
objects have methods which perform manageability and schema requests/operations on the server (eg. get, set).connect_async()
: Asynchronous equivalent toconnect()
which returns aAsyncConnection
object, which is an asynchronous equivalent of theConnection
object.sync()
can be called on aAsyncConnection
object to give the equivalentConnection
object without creating a new underlying connection.RootCfg
andRootOper
which arePath
objects, from which all other paths are created via attribute access and calling syntax.- Transport classes which define a method of connection to a remote router.
Arguments include identifying information (eg. IP address) for the router in
question, and user credentials as necessary. Currently only
SSHTransport
is supported, which uses SSH to connect to a router remotely.
Asynchronous functions and methods return asyncio Future objects on Python 3, and Trollius Future objects on Python 2.