Drop-in replacement for PyBGPStream using BGPKIT
Project description
PyBGPKITStream
A drop-in replacement for PyBGPStream using BGPKIT
Features
- Effortless BGP Stream Switching:
- Seamless, drop-in replacement (example)
- Lazy message generation: generates time-ordered BGP messages on the fly, consuming minimal memory and making it suitable for large datasets
- Supports multiple route collectors
- Supports both ribs and updates
- Caching with concurrent downloading is enabled and is fully compatible with the BGPKIT parser's caching functionality.
- Similar performance to PyBGPStream
- A CLI tool
Quick start
Installation:
pip install pybgpkitstream
Usage:
import datetime
from pybgpkitstream import BGPStreamConfig, BGPKITStream
config = BGPStreamConfig(
start_time=datetime.datetime(2010, 9, 1, 0, 0),
end_time=datetime.datetime(2010, 9, 1, 1, 59),
collectors=["route-views.sydney", "route-views.wide"],
data_types=["ribs", "updates"],
)
stream = BGPKITStream.from_config(config)
n_elems = 0
for _ in stream:
n_elems += 1
print(f"Processed {n_elems} BGP elements")
or in the terminal:
pybgpkitstream --start-time 2010-09-01T00:00:00 --end-time 2010-09-01T01:59:00 --collectors route-views.sydney route-views.wide --data-types updates > updates.txt
Motivation
PyBGPStream is great but the implementation is complex and stops working when UC San Diego experiences a power outage. BGPKIT broker and parser are great, but cannot be used to create an ordered stream of BGP messages from multiple collectors and multiple data types.
Missing features
- live mode
pybgpkitstream.BGPElementis not fully compatible withpybgpstream.BGPElem: missing record_type (BGPKIT limitation), project (BGPKIT limitation), router (could be improved), router_ip (could be improved)- CLI output is not yet compatible with
bgpdump -morbgpreader(right now a similar-looking output is produced)
Issues
- Program will crash when working with many update files per collector (~ more than few hours of data), only when caching is disabled. This might be caused by BGPKIT parser not being lazy. See details and workaround fix
- Filters are designed with BGPKIT in mind, and can slightly differ to pybgpstream. See this file for a conversion to PyBGPStream filter. Note that for now the filters have not been heavily tested...
- ... just like the rest of the project. Use at your own risk. The only tests I did are in /tests
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pybgpkitstream-0.1.1.tar.gz.
File metadata
- Download URL: pybgpkitstream-0.1.1.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b91d8f1098dfa608ffb99841bcfc1bedbf7d3aa58ceaba4ceda2b9dfcfb1e09b
|
|
| MD5 |
e04a6fd0abedb765a92aa881ed437cca
|
|
| BLAKE2b-256 |
537afbd16ead9e76ebfcb409b34dde7bcce30ef26cf630762e9356eae2cdeea5
|
File details
Details for the file pybgpkitstream-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pybgpkitstream-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1907b9193f69967aff4b78f6f5b7a92001e6fd58e0055715fa1b2b60097d42a
|
|
| MD5 |
af1667ff9927ddab5ff0376276ac84f2
|
|
| BLAKE2b-256 |
1c0a7fa42aae1f035f736316b6544c3bb94f7ca790ce09f6a04c259c9bba2b00
|