Python代写|BGP Measurements Project


In this project we will use the BGPStream tool and its Python interface PyBGPStream to understand the BGP protocol and interact with BGP data. The goal is to gain a better understanding of BGP and to experience how researchers, practitioners and engineers have been using BGPStream to gain insights. More specifically we will be using a newly developed tool that gives us the option to browse both real-time BGP data as well as historical BGP data.

Folder Structure and Canvas Submission The .zip file accompanying this assignment has the folder structure that will be used for grading.

It is as follows:




This project only has a coding component. You will need to complete the functions in the

The file is the only file that you need to modify.

Before submitting your assignment, make sure all your code works with this folder structure on the course VM. Your code submission will be auto graded in the course VM.

The included file includes a basic set of tests for you to run to make sure the code in your file is formatted properly. Passing all these tests may still not guarantee a full grade.

This project is designed to work in the class VM where the BGPStream libraries are installed.

Your code will need to run without modification in the course VM.

Required Background

The tool we will be using is called BGPStream. It is an open-source tool that provides access to historical and real-time BGP data.

Read the resources

A high-level overview about how the BGPStream tool was developed was published by the Center for Applied Internet Data Analysis (CAIDA). The paper, BGPStream: A Software Framework for Live and Historical BGP Data Analysis, can be found here:

This paper provides useful background and practical examples of BGPStream so be sure you read it.Additionally, a practical illustrates about how the BGP collection system works is here:

Run Example Code Snippets

For the following tasks, we require that you use the Python interface of BGPStream (PyBGPStream). You are strongly encouraged to browse the following resources to familiarize yourself with the tool, and run the example code snippets:

– PyBGPStream API:

– PyBGPStream API Tutorial:

– PyBGPStream Repository:

– Official Examples:

Familiarize Yourself with the BGP Record Format and BGP Attributes

Moving forward with the assignment, it is useful to familiarize yourself with the BGP record format, the fields (attributes), and their meaning. A detailed explanation of BGP records and attributes can be found here:

Also, the BGPReader command-line tool provides access to BGP records and their attributes,which you can use for illustration purposes.

In this assignment you will not have to interact with the BGP records in this format, because PyBGPStream (the main tool you will be working with) allows you to extract the BGP attributes from BGP records using code. Nevertheless, it is helpful to look through some examples and understand the fields.

Here, we will show sample command line output from BGPReader for illustration purposes.


The box below contains an example of an update record. In the record, the “|” character separates different fields. In yellow we have highlighted the type (A stands for Advertisement),the advertised prefix (, the path (11666 3356 3786), and the origin AS (3786).