Skip to main content

bgpdumpy

Overview

bgpdumpy is a libbgpdump Python CFFI wrapper for analyzing MRT and MRTv2 BGP table dump files.

Build Requirements

Debian/Ubuntu

  • ca-certificates
  • gcc
  • make
  • autoconf
  • python-setuptools
  • python-dev
  • libbz2-dev
  • zlib1g-dev
  • libffi-dev

Example

from bgpdumpy import BGPDump, TableDumpV2

with BGPDump('latest-bview.gz') as bgp:
    for entry in bgp:

        # entry.body can be either be TableDumpV1 or TableDumpV2
        if not isinstance(entry.body, TableDumpV2):
            continue  # I expect an MRT v2 table dump file

        # get a string representation of this prefix
        prefix = '%s/%d' % (entry.body.prefix, entry.body.prefixLength)

        # get a list of each unique originating ASN for this prefix
        originatingASs = set([
            route.attr.asPath.split()[-1]
            for route
            in entry.body.routeEntries])

        # just print it for demonstration purposes
        print('%s -> %s' % (prefix, '/'.join(originatingASs)))

# 1.0.0.0/24 -> 15169
# 1.0.4.0/24 -> 56203
# 1.0.5.0/24 -> 56203
# 1.0.6.0/24 -> 56203
# 1.0.7.0/24 -> 38803
# 1.0.38.0/24 -> 24155
# 1.0.64.0/18 -> 18144
# 1.0.128.0/17 -> 9737
# 1.0.128.0/18 -> 9737
# 1.0.128.0/19 -> 9737
# ...
# 2001::/32 -> 6939
# 2001:4:112::/48 -> 112
# 2001:200::/32 -> 2500
# 2001:200:900::/40 -> 7660
# 2001:200:c000::/35 -> 23634

Metadata

Release files for bgpdumpy 1.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bgpdumpy 1.1.4
File Size Uploaded
bgpdumpy-1.1.4.tar.gz 142.9 kB Details

Release files / bgpdumpy-1.1.4.tar.gz

Download URL bgpdumpy-1.1.4.tar.gz
Size 142.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1e936b41b679275ace2ebce650443d71261762310b1db03af18825f81b9da7a5
BLAKE2b-256 checksum
How to use checksums
a10409850bbe7ff2a9dfac03b6e417226570945196ebb8770ff1ce94b0456840
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.4

Release history Release notifications | RSS feed

This release

1.1.4 This release

1 release file

1.1.3

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page