MRT format data parser
Project description
Introduction
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.
You can also download archives from the Route Views Projects, RIPE NCC.
Support
Python Version
If you want your code to run faster, you should use PyPy or PyPy3.
- Python2
- Python3
- PyPy
- PyPy3
MRT Type
Name | Value |
---|---|
TABLE_DUMP | 12 |
TABLE_DUMP_V2 | 13 |
BGP4MP | 16 |
BGP4MP_ET | 17 |
TABLE_DUMP Subtype
Name | Value |
---|---|
AFI_IPv4 | 1 |
AFI_IPv6 | 2 |
TABLE_DUMP_V2 Subtype
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 |
BGP4MP/BGP4MP_ET Subtype
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 |
BGP Capability
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 |
BGP Attribute
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 |
Installation
$ pip install mrtparse
or
$ git clone https://github.com/t2mune/mrtparse.git $ cd mrtparse $ python setup.py install
Usage
First, import the module.
from mrtparse import *
or
import mrtparse
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.
for entry in Reader(f): # Parsed data is stored in "entry.data" <statements>
We have prepared some example scripts and sample data in “examples” and “samples” directory.
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.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size mrtparse-2.0.1-py2.py3-none-any.whl (19.0 kB) | File type Wheel | Python version py2.py3 | Upload date | Hashes View |
Filename, size mrtparse-2.0.1.tar.gz (31.7 kB) | File type Source | Python version None | Upload date | Hashes View |
Close
Hashes for mrtparse-2.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 575ac5b5b5b01acc8b4151aedfb75bf7ecc2401022b2c7a774dd05f3408fdbc3 |
|
MD5 | 89a17c88e178dbf4a37e52450e4f2a92 |
|
BLAKE2-256 | 965eef919c0e99bc7e4651bf7f35b371953341fa9de606d22f084f72b1196bd0 |