quagga — PyCI Quagga Module

class QuaggaConfig(filepath)

Class object to store Quagga configuration files

parse_config(filepath)

Parses the given quagga configuration file and returns a list of configuration pairs like so: [

(‘hostname’, ‘foo’), (‘password’, ‘insertpasswordhere’), (‘enable password’, ‘insertpasswordhere’), (‘comment’, ‘! interfaces
‘),
(‘interface’, ‘lo’), (‘interface’, ‘eth0’), (‘interface’, ‘vlan0’), (‘interface’, ‘vlan1’), (‘ip’, ‘route 10.10.10.0/24 Null0 255’), (‘line’, ‘vty’), (‘access-class’, ‘vty’)

]

valid_commands()
Returns a list of valid quagga commands (just the command, no options)
valid_options(command)
Returns a list of valid options that can be passed to ‘command’
validate_config(filepath)

Validates the commands in the config file found at ‘filepath’. Returns None if no errors are found. Returns an error list with the following format if errors are found:

[[line_number, error_message, line], ...]
Example:
>>> f = open('/tmp/zebra.conf', 'w')
>>> f.write('foo start')
>>> f.close()
>>> validate_config('/tmp/zebra.conf')
[[123, "foo is not a valid Quagga command", "foo start"]]
vtysh_command(command, password, enable=False, enable_password=None, host='127.0.0.1', port=None, daemon=None, timeout=2)
Executes the given command via Quagga’s vtysh (telnet) interface on the given host/port and returns the result as a string. if ‘daemon’ is set to the name of one of the Quagga daemons (e.g. ‘zebra’, ‘bgpd’, etc) the default port for that daemon will be used. If ‘enable’ is True then Enable Mode will be entered using ‘enable_password’ before any commands are executed. The telnet connection will attempt to stay open after the command is executed to allow things like multi-line commands to work properly.

Previous topic

pcyi_db — PyCI DB Module

Next topic

utils — PyCI Utility Module

This Page

Quick search