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']
True
>>> peer_state['import_updates_received']
4214
>>> 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:
``[import,export]_[updates,withdraws]_[received,rejected,filtered,ignored,accepted]``
which BIRD supports.


Test suite
==========

There is a series of tests in ``tests.py``. 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
interaction.

Source
====

The source is kept on BitBucket: http://bitbucket.org/erikr/pybird

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 details)

Uploaded Source

File details

Details for the file pybird-1.0.2.tar.gz.

File metadata

  • Download URL: pybird-1.0.2.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pybird-1.0.2.tar.gz
Algorithm Hash digest
SHA256 b99ceb773169f329636e2ea3b1ab78a1758af3137c0d4d8462153c89a81ec908
MD5 fdac417bca5209fa022cb00c62102a5a
BLAKE2b-256 aaec5244524a4797a92616b8f6f39509c7a4b3bfeea97c46e4a6cf38233ace87

See more details on using hashes here.

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