Skip to content
This repository has been archived by the owner. It is now read-only.
OpenBMP Kafka File Consumer of parsed and BMP raw messages
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Openbmp Basic File Consumer

A basic file consumer of OpenBMP parsed and RAW BMP Kafka streams. You can use this file consumer in the following ways:

  • Working example to develop your own consumer that works with either parsed or RAW BMP binary messages
  • Record BMP feeds (identical as they are sent by the router) so they can be replayed to other BMP parsers/receivers
  • Log parsed BMP and BGP messages in plain flat files

See Consumer Developer Integration for more details on the OpenBMP Kafka feeds and message syntax.

Parsed Log Format

The current format of the log messages are an attempt to be human readable. If you plan to use grep, awk or other tools to filter/interact with the flat files, then you will want to update src/bin/openbmp-file-consumer source file to change the logging format. You can easily change the format to whatever you want. For example, you can make it PIPE delimited, you can filter what's logged, etc.


You can either run the code within the git directory or you can install it in your python path.

If you are going to run it within the git directory, see running instructions.

Install Dependancies:

sudo apt-get install libsnappy-dev 
sudo pip install python-snappy
sudo pip install kafka-python
sudo pip install pyyaml

git clone
cd openbmp-python-api-message
sudo python install

Installation of openbmp-python-api-message library is shown above.

You might have to install 'pip' if you don't already have that. You can do so using apt-get install python-pip python-dev

See Kafka-python Install Instructions for more details.

Install openbmp-file-consumer:

git clone
cd openbmp-file-consumer
sudo python install


If you install the python code, then you should be able to run from a terminal

openbmp-file-consumer -b <host e.g.> <base path for parsed message e.g. /var/openbmp>

If you are running from within the git directory, you can run it as follows:

PYTHONPATH=./src/site-packages python src/bin/openbmp-file-consumer -c src/etc/openbmp-file-consumer.yml


Usage: src/bin/openbmp-file-consumer [OPTIONS]

  -h, --help                  Print this help menu
  -c, --config                Config filename (default is sys.prefix/etc/openbmp-file-consumer.yml)


Configuration is in YAML format via the openbmp-file-consumer.yml file.


tievens$ PYTHONPATH=./src/site-packages python src/bin/openbmp-file-consumer -c src/etc/openbmp-file-consumer.yml
Base path '/tmp/openbmp-log' does not exist, attempting to create it
Connecting to [''] ... takes a minute to load offsets and topics, please wait
Connected, now consuming
Logs are stored under '/tmp/openbmp-log'
tievens$ tail -f /var/tmp/openbmp/COLLECTOR_e086aa137fa19f67d27b39d0eca18610/ROUTER_x.x.x.x/ 
2015-08-07 17:01:30.439892  Prefix:                           Origin AS: 705       
           AS Count: 3      NH:       LP: 0   MED: 0        Origin: igp          Aggregator:   ClusterList:  Originator Id: 
               Path:  3356 701 705 
        Communities: 3356:3 3356:86 3356:575 3356:666 3356:2050
2015-08-07 17:01:29.556874  Prefix:                          Origin AS: 5438      
           AS Count: 4      NH:       LP: 0   MED: 0        Origin: igp          Aggregator:   ClusterList:  Originator Id: 
               Path:  3356 6762 2609 5438 
        Communities: 3356:3 3356:22 3356:86 3356:575 3356:666 3356:2039 6762:1 6762:92 6762:13950
2015-08-07 17:02:07.260264  Prefix:                         Origin AS: 10118     
           AS Count: 6      NH:       LP: 0   MED: 0        Origin: igp          Aggregator: 64519  ClusterList:  Originator Id: 
               Path:  3356 1273 9381 10118 10118 10118 
        Communities: 1273:13344 1273:39760 3356:3 3356:22 3356:100 3356:123 3356:575 3356:2003 65003:0

Directory Structure

Files are stored hierarchical as depicted below. Files are rotated automatically after a size of 300MB. The max rotated file count is 20. You can adjust these settings if you wish by updating the src/bin/openbmp-file-consumer initLogger() function.

Root/base directory
    |---- FILE: collectors.txt                    # Collector messages
    |---- DIR: <collector hash id>
        |---- FILE: routers.txt                   # Router messages
        |---- DIR: <router name and ip>
            |---- FILE: bmp_feed.raw              # RAW BMP feed messages (stream)
            |---- FILE: peers.txt                 # Peer messages
            |---- DIR: <peer name and ip>
                |---- FILE: bmp_stats.txt         # BMP statistic messages
                |---- FILE: base_attributes.txt   # Base Attribute messages
                |---- FILE: unicast_prefixes.txt  # Unicast Prefix messages
                |---- FILE: ls_nodes.txt          # Link-state Node messages
                |---- FILE: ls_links.txt          # Link-state Link messages
                |---- FILE: ls_prefixs.txt        # Link-state Prefix messages
You can’t perform that action at this time.