I'm happy to announce the availability of pybgpdump 0.1, a tool to assist in the rapid analysis of BGP routing datasets. It combines the functionality of libbgpdump and the ease of python to parse BGP messages from MRT dumps.
Currently, analysis of BGP routing data is primarily done in C, using either libbgpdump (RIPE) or route_btoa (Labovitz). While effective in their own right, they lack the ease, speed, and simplicity of python development.
pybgpdump currently supports parsing the MRT BGP4MP_MESSAGE entries found in the Zebra dumps, such as the UPDATES files archived at Routeviews and RIPE, into convenient python objects. It also has the capability to transparently process MRT dumps compressed with gzip or bzip2.
The follow sample usage demonstrates how easy it is to utilize pybgpdump. This sample rips through the entries of a MRT dump and simply tracks the cumulative number of BGP update messages, announced routes, and withdrawn routes.
dump = BGPDump(filename) for mrt_h, bgp_h, bgp_m in dump: messages += 1 announced += len(bgp_m.update.announced) withdrawn += len(bgp_m.update.withdrawn)