Skip to main content

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.BGPElement is not fully compatible with pybgpstream.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 -m or bgpreader (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


Download files

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

Source Distribution

pybgpkitstream-0.1.6.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pybgpkitstream-0.1.6-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file pybgpkitstream-0.1.6.tar.gz.

File metadata

  • Download URL: pybgpkitstream-0.1.6.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pybgpkitstream-0.1.6.tar.gz
Algorithm Hash digest
SHA256 be8bc44e5eb0c9f70d72e1fdc3cda846c3549fae1322141ffe0c39b334582394
MD5 56a8f33057cca8259eeb3743f26e49c6
BLAKE2b-256 58b894c4634f502cfd611ff9b3ed1c79dfb329e1f9c0b101fb09ee487d6241f9

See more details on using hashes here.

File details

Details for the file pybgpkitstream-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: pybgpkitstream-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pybgpkitstream-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 bd6454c882c387c5090f237c2bd87d0ec6c55a8e085fde196e99b66e39efe881
MD5 117b70eb5f0d21614bb41e0a2da17c10
BLAKE2b-256 dbc29c3df48339ad9425dcd46bc7532a891f62fd9bc27b39ccc88548ed4bc27c

See more details on using hashes here.

Supported by

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