Lab 1: Switchyard & Mininet


In this chapter we will introduce all preparations for our network experiments. Then your are going to modify the examples we provide according to our requirements.
Lab-1 assignment in Github Classroom:


Our lab assignments are based on CS640 in University of Wisconsin. Most materials are the same. In the future, we will improve the experiment based on your feedback.
In this lab assignment, you will gradually master our experimental environment. But some preliminary abilities are required in our experiments such as how to program and debug in Linux. If you are not familiar with these, feel free to contact TAs. We will provide you with some helpful information to get started quickly.


The platform of our labs is Switchyard. You can implement a device with various functions in Switchyard by writing Python codes. Then you can run your device in Mininet and capture packets using Wireshark. You will use Git to manage your projects and submit them. All these software are installed on Linux. We recommend using Visual Studio Code as your editor.
Here is the list of softwares we mentioned (sorted by learning order).
  • Linux
  • Python
  • Git
  • Mininet
  • Wireshark
  • Switchyard
  • VS Code

Your Tasks

The sentences marked with ✅ are related to the content of your report. Please pay attention.

Task 1: Get Ready

Meet the requirements for using Linux, Python and Git. We assume that you have a basic understanding of these contents.

Task 2: An Example

Meet the requirements for using Mininet, Wireshark and Switchyard. At the meantime you will learn how to complete this assignment.

Task 3: GitHub Classroom

Sign up on GitHub and prepare for submission.

Task 4: Your Modification

After Task 1 2 3, you are ready to do some exercises on our platform and count 4.

Handing it in

Create a directory named report/ in your repository and place your report, capture files and other materials in it.


We will provide a template of your lab assignment report here. You need to submit the report in your repository named <student ID><name>_lab_1.pdf. The format of your report should be PDF. An example is 123456789拾佰仟_lab_1.pdf.

Capture file

The capture file's name should be lab_1.pcapng or lab_1.pcap. If you capture packets using superuser, you may meet some problems. Read the tips below.
You may (or as I expect you must) meet the error when you try to modify/delete the files generated by Wireshark or Switchyard programs running on hosts in Mininet. It is because the owner of these files is superuser root. You need to change the owner to your login user. Run the command below on your capture file. Replace <file> to the file path of your capture file.
$ sudo chown $USER:$USER <file>
Another useful command ls -l can check if the owner of the file is root. You can see the file belonging to root is test.log in the example.
(syenv) [email protected]:~/switchyard$ ls -l
total 88
-rw-rw-r-- 1 cyq cyq 35147 2月 20 17:33 COPYING
-rw-rw-r-- 1 cyq cyq 427 2月 20 17:33 Dockerfile
drwxrwxr-x 6 cyq cyq 4096 2月 20 17:33 docs
drwxrwxr-x 3 cyq cyq 4096 2月 20 17:33 documentation
drwxrwxr-x 4 cyq cyq 4096 2月 21 00:01 examples
-rw-rw-r-- 1 cyq cyq 5119 2月 20 17:33 README.rst
-rw-rw-r-- 1 cyq cyq 144 2月 20 17:33 requirements.txt
-rwxrwxr-x 1 cyq cyq 405 2月 20 17:33
-rw-rw-r-- 1 cyq cyq 2266 2月 20 17:33
drwxrwxr-x 4 cyq cyq 4096 2月 20 17:33 switchyard
drwxrwxr-x 6 cyq cyq 4096 2月 20 17:37 syenv
-rw-r--r-- 1 root root 181 2月 21 21:42 lab_1.pcap
drwxrwxr-x 2 cyq cyq 4096 2月 20 17:33 tests
In this case, running the command sudo chown $USER:$USER ./lab_1.pcap can change the owner to my user cyq. As we mentioned before, be careful when using sudo since it may have potential risks.

Submit to GitHub Classroom

Finally, the directory should be in this structure:
├── report
│ ├── 123456789拾佰仟_lab_1.pdf
│ └── lab_1.pcap
└── testcases
Commit the change.
Only commit your source code to your local repository. If there are some generated files that are not source code, ignore them by adding them in the file .gitignore.
After you’ve committed you final codes and report, push the repository to GitHub by inputing command:
$ git push
After a few seconds, you can see the changes on your repository web page, which means you have handed in successfully.
Last modified 8mo ago