Welcome to VyMGMT’s documentation!

Contents:

class vymgmt.Router(address, user, password='', port=22, ssh_key='')

Router configuration interface class

commit()

Commits configuration changes

You must call the configure() method before using this one.

Raises:VyOSError, ConfigError, CommitError, ConfigLocked
configure()

Enters configuration mode on the router

You cannot use this methods before you log in. You cannot call this method twice, unless you log out and log back in.

Raises:VyOSError
delete(path)

Deletes a node from configuration on the router

You must call the configure() method before using this one.

Parameters:path – Configuration node path. e.g. ‘protocols static route … next-hop … distance …’
Raises:ConfigError
exit(force=False)

Exits configuration mode on the router

You must call the configure() method before using this one.

Unless the force argument is True, it disallows exit when there are unsaved or uncommited changes. Any uncommited changes are discarded on forced exit.

If the session is not in configuration mode, this method does nothing.

Parameters:force (bool) – Force exit despite uncommited or unsaved changes
Raises:VyOSError
login()

Logins to the router

logout()

Logouts from the router

Raises:VyOSError
run_conf_mode_command(command)

Executes a VyOS configuration command

Parameters:command – VyOS configuration command
Returns:Command output
Raises:VyOSError
run_op_mode_command(command)

Executes a VyOS operational command

Parameters:command (str) – VyOS operational command
Returns:string – Command output
save()

Saves the configuration after commit

You must call the configure() method before using this one. You do not need to make any changes and commit then to use this method. You cannot save if there are uncommited changes.

Raises:VyOSError
set(path)

Creates a new configuration node on the router

You must call the configure() method before using this one.

Parameters:path – Configuration node path. e.g. ‘protocols static route … next-hop … distance …’
Raises:ConfigError

Indices and tables

Quick introduction

A python library for executing commands on VyOS systems.

Generic methods should also work with any of the Vyatta descendants (EdgeOS, Brocade vRouter).

The library is compatible with both python2 and python3.

It is released under the MIT license.

Usage example:

import vymgmt

vyos = vymgmt.Router('192.0.2.1', 'vyos', password='vyos', port=22)

vyos.login()
vyos.configure()

vyos.set("protocols static route 203.0.113.0/25 next-hop 192.0.2.20")
vyos.delete("system options reboot-on-panic")

vyos.commit()
vyos.save()
vyos.exit()
vyos.logout()