PyBGPStream is Python package that provides bindings to the libBGPStream library, allowing Python scripts to configure and read a stream of BGP measurement data.
The goal of this exercise to to familiarize you with the PyBGPStream API, which will be used in all subsequent exercises.
See the PyBGPStream API documentation and tutorial for usage information.
This task is identical to Task 2 of the BGPReader exercise, except you will use PyBGPStream and standard Python features to extract and post-process the BGP data rather than using command line tools.
In the BGPReader task, you configured BGPStream by specifying command-line arguments. PyBGPStream supports all the same filtering options as BGPReader, but these filters are applied programmatically using method calls.
-
Use the code in the PyBGPStream tutorial as a starting point.
-
Configure BGPStream to include only update data for a 1 minute window (e.g.,
1483228800,1483228860
) using the filter methods. -
Modify the inner
while
loop (that iterates over Elems) to build a data structure that tracks the number of elems from each peer (remember to usecollector|peer-AS|peer-IP
as the ID of a peer). -
After processing the data from BGPStream output a ranking of peer update volume (from most to least) either to
stdout
or to a file. -
(Bonus) Separate the statistics by elem type (Annoucements, Withdrawal, and State Messages).