Skip to main content

MRT format data parser

Project description

mrtparse is a module to read and analyze the MRT format data.
The MRT format can be used to export routing protocol messages, state changes, and routing information base contents, and is defined in RFC6396.
Programs like Quagga / Zebra, BIRD, OpenBGPD and PyRT can dump the MRT format data.
You can also download archives from the Route Views Projects, RIPE NCC.

Supported MRT types

Name

Value

TABLE_DUMP

12

TABLE_DUMP_V2

13

BGP4MP

16

BGP4MP_ET

17

Supported TABLE_DUMP subtypes

Name

Value

AFI_IPv4

1

AFI_IPv6

2

Supported TABLE_DUMP_V2 subtypes

Name

Value

PEER_INDEX_TABLE

1

RIB_IPV4_UNICAST

2

RIB_IPV4_MULTICAST

3

RIB_IPV6_UNICAST

4

RIB_IPV6_MULTICAST

5

RIB_GENERIC

6

RIB_IPV4_UNICAST_ADDPATH

8

RIB_IPV4_MULTICAST_ADDPATH

9

RIB_IPV6_UNICAST_ADDPATH

10

RIB_IPV6_MULTICAST_ADDPATH

11

RIB_GENERIC_ADDPATH

12

Supported BGP4MP/BGP4MP_ET subtypes

Name

Value

BGP4MP_STATE_CHANGE

0

BGP4MP_MESSAGE

1

BGP4MP_MESSAGE_AS4

4

BGP4MP_STATE_CHANGE_AS4

5

BGP4MP_MESSAGE_LOCAL

6

BGP4MP_MESSAGE_AS4_LOCAL

7

BGP4MP_MESSAGE_ADDPATH

8

BGP4MP_MESSAGE_AS4_ADDPATH

9

BGP4MP_MESSAGE_LOCAL_ADDPATH

10

BGP4MP_MESSAGE_AS4_LOCAL_ADDPATH

11

Supported BGP capabilities

Name

Value

Multiprotocol Extensions for BGP-4

1

Route Refresh Capability for BGP-4

2

Outbound Route Filtering Capability

3

Graceful Restart Capability

64

Support for 4-octet AS number capability

65

ADD-PATH Capability

69

Supported BGP attributes

Name

Value

ORIGIN

1

AS_PATH

2

NEXT_HOP

3

MULTI_EXIT_DISC

4

LOCAL_PREF

5

ATOMIC_AGGREGATE

6

AGGREGATOR

7

COMMUNITY

8

ORIGINATOR_ID

9

CLUSTER_LIST

10

MP_REACH_NLRI

14

MP_UNREACH_NLRI

15

EXTENDED_COMMUNITIES

16

AS4_PATH

17

AS4_AGGREGATOR

18

AIGP

26

LARGE_COMMUNITY

32

ATTR_SET

128

Requirements

Python2 or Python3 or PyPy or PyPy3

Installation

$ pip install mrtparse

or

$ git clone https://github.com/YoshiyukiYamauchi/mrtparse.git
$ cd mrtparse
$ python setup.py install

Usage

from mrtparse import *

or

import mrtparse

Programming

First, import the module.

from mrtparse import *
And pass a MRT format data as a filepath string or file object to a class Reader().
It is also supported gzip and bzip2 format.
You can retrieve each entry from the returned object using a loop and then process it.
d = Reader(f)
for m in d:
    <statements>

We have prepared some example scripts and sample data in “examples” and “samples” directory.

Authors

Tetsumune KISO t2mune@gmail.com
Yoshiyuki YAMAUCHI info@greenhippo.co.jp
Nobuhiro ITOU js333123@gmail.com

License

Licensed under the Apache License, Version 2.0
Copyright (C) 2020 Tetsumune KISO

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

mrtparse-1.8.tar.gz (34.9 kB view details)

Uploaded Source

Built Distribution

mrtparse-1.8-py2.py3-none-any.whl (16.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file mrtparse-1.8.tar.gz.

File metadata

  • Download URL: mrtparse-1.8.tar.gz
  • Upload date:
  • Size: 34.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for mrtparse-1.8.tar.gz
Algorithm Hash digest
SHA256 8d251d84216865879ad256d7dfe90ea42296e57c2fe380257826f5300e214e0d
MD5 a0acc259b6e90ff4b4f687d6c5c9c9d8
BLAKE2b-256 0179ee7d720cf00dbc2583a2d73b249749682a7ca6286fb5a6e6f41aca78bbd0

See more details on using hashes here.

File details

Details for the file mrtparse-1.8-py2.py3-none-any.whl.

File metadata

  • Download URL: mrtparse-1.8-py2.py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for mrtparse-1.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2cd9eff9cda1d41b58b6eeb54b1d3542c438365a69a2b46783136a29fe942fb2
MD5 a35fb626096e24298e4cd979814ee4bb
BLAKE2b-256 3af71fef0c61ac7eebadd8ea12f87c383df8328355a12417765d7f871c447090

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