/aiovty

Asyncio VTY implementation

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Description

aiovty is an asynchronous implementation of the VTY protocol.

Installation

Install the last released version using pip:

python3 -m pip install --user -U aiovty

Or install the latest version from sources:

git clone git@github.com:matan1008/aiovty.git
cd aiovty
python3 -m pip install --user -U -e .

Usage

To create a client, you need to supply the server's prompt name (e.g. 'Router'):

from aiovty import AioVtyClient

vty = AioVtyClient('Router')

Then you can connect giving address:

connection_string = await vty.connect('127.0.0.1', 23)

Note that connecting returns the "connection string", which is the data sent before the first prompt.

After connection you can send your command:

command_response = await vty.command(b'show ip')

You can also enter enabled mode:

await vty.enable()

And initialize a configure terminal:

await vty.configure_terminal()
await vty.command(b'router rip')
print(vty.node)  # Prints `config-router`