Lab 1: Switchyard & Mininet
Overview
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.
Details
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.
Platform
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
[!NOTE] 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: NJU GitLab
Sign up on NJU GitLab and prepare for submission.
[!DANGER] Do not skip this task. We use NJU GitLab to collect your projects.
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
Report
We will provide a template of your lab assignment report here. You need to submit the report in your repository named <学号><姓名>_lab_1
. The format of your report can be Microsoft Doc or 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.
[!WARNING] 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 isroot
. You can see the file belonging toroot
istest.log
in the example.(syenv) cyq@cyq-VirtualBox:~/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 runtests.sh -rw-rw-r-- 1 cyq cyq 2266 2月 20 17:33 setup.py 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 usercyq
. As we mentioned before, be careful when usingsudo
since it may have potential risks.
Submit to NJU GitLab
When you are ready to submit, do the following.
Modify your code according to Task 3, complete your report and save your capture file.
When you have done your work, put your report, code and capture file in the folder
lab_1
and commit them. Tag the commit named<学号/lab_1>
which you want to submit. An example is123456789/lab_1
. For more about tag, read Git 基础 - 打标签. Finally your project will look likeswitchyard/ ├─docs/ ├─.../ m ├─lab_1/ + │ ├─123456789拾佰仟_lab_1.pdf m │ ├─hubtests.py + │ ├─lab_1.pcapng m │ ├─myhub.py m │ └─start_mininet.py ├─.gitignore └─...
[!WARNING] The file names in your submission have to exactly match the file names above. Otherwise, you will lose points!
Submit your work by pushing your local repository to your remote repository with your tags by running the command
git push origin --tags
.[!WARNING] 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
.