Skip to content

Latest commit

 

History

History
46 lines (34 loc) · 1.92 KB

File metadata and controls

46 lines (34 loc) · 1.92 KB

Exercise 2: PyBGPStream

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.

Rank peers based on the number of updates observed in 1 minute window

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.

Steps

  1. Use the code in the PyBGPStream tutorial as a starting point.

  2. Configure BGPStream to include only update data for a 1 minute window (e.g., 1483228800,1483228860) using the filter methods.

  3. 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 use collector|peer-AS|peer-IP as the ID of a peer).

  4. After processing the data from BGPStream output a ranking of peer update volume (from most to least) either to stdout or to a file.

  5. (Bonus) Separate the statistics by elem type (Annoucements, Withdrawal, and State Messages).