forked from 20c/pybird
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PKG-INFO
108 lines (82 loc) · 4.31 KB
/
PKG-INFO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
Metadata-Version: 1.1
Name: pybird
Version: 1.0.10
Author: Erik Romijn
Author-email: eromijn at solidlinks nl
Summary: BIRD interface handler for Python
License: There's also ``get_prefix_info()`` to get the route info for a specified prefix, optionally limited to a specific peer.
Description: .. -*- restructuredtext -*-
==========================================
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, to query the routes received, accepted and rejected from a peer,
or the general status of BIRD (router ID, last config change)
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)
>>> rejected = pybird.get_peer_prefixes_rejected('KPN')
>>> rejected[0]['as_path']
'23456 65592'
>>> status = pybird.get_status()
>>> status['last_reconfiguration_time']
datetime.datetime(2012, 1, 3, 12, 46, 40)
>>> status['router_id']
"192.168.0.1"
You can also call ``get_peer_status()`` without a peer name, to get an array
with all the BGP peers. There's also ``get_prefix_info()`` to get the route info for a specified prefix, optionally limited to a specific peer.
Full field list for peers
=========================
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.
Full field list for routes
==========================
All fields that are decoded, if present:
- ``origin``: BGP origin, e.g. "IGP"
- ``as_path``: AS path as string
- ``next_hop``: BGP next hop
- ``local_pref``: Local pref, e.g. '100'
- ``community``: Communities in string format, e.g. '8954:220 8954:620'
And any other BGP attribute fields BIRD has found.
Full field list for BIRD status
===============================
- ``router_id``: BGP Router ID as string
- ``last_reboot``: Last BIRD restart time as datetime
- ``last_reconfiguration``: Last BIRD config change as datetime
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.
Release notes
=============
1.0.10
-----
- Fixed bug in support for new BIRD last status change syntax
1.0.9
-----
- Added support for BIRD syntax changes, noticed in 1.3.10 but may have been introduced earlier
- Added `get_prefix_info()` call, contributed by Jens Ott
Keywords: bird bgp
Classifier: Development Status :: 4 - Beta