Skip to main content

BIRD interface handler for Python

Project description

pybird - BIRD interface handler for Python

PyBird is a Python interface to the BIRD Internet Routing Daemon's UNIX control
socket, handling the socket connections and parsing the output.

In it's current state, you can use it to query the status of specific or all
BGP peers.

Usage example

>>> from pybird import PyBird
>>> pybird = PyBird(socket_file='/var/run/bird.ctl')
>>> peer_state = pybird.get_peer_status('KPN')
>>> peer_state['up']
>>> peer_state['import_updates_received']
>>> peer_state['last_change']
datetime.datetime(2011, 6, 19, 19, 57, 0, 0)

You can also call ``get_peer_status()`` without a peer name, to get an array
with all the BGP peers.

Full field list

All fields that are decoded, if present:

- ``name``: Name as configured in BIRD
- ``protocol``: Currently always "BGP"
- ``last_change``: Last state change as a ``datetime.datetime`` object
- ``state``: String of the peer status, e.g. "Established" or "Passive"
- ``up``: Boolean, True if session is Established
- ``routes_imported``: Number of imported routes
- ``routes_exported``: Number of exported routes
- ``router_id``: BGP router id

And all combinations of:
which BIRD supports.

Test suite

There is a series of tests in ````. This includes a ``MockBird``: a
mocked BIRD instance, with fixed but real responses, that listens on a real
UNIX socket. This means the tests do not only test parsing, but also socket


The source is kept on BitBucket:

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pybird-1.0.2.tar.gz (5.2 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page