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.
Lab-1 assignment in Github Classroom: https://classroom.github.com/a/Re9pXmXp

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

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.

Report

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.
1
$ sudo chown $USER:$USER <file>
Copied!
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.
1
(syenv) [email protected]:~/switchyard$ ls -l
2
total 88
3
-rw-rw-r-- 1 cyq cyq 35147 2月 20 17:33 COPYING
4
-rw-rw-r-- 1 cyq cyq 427 2月 20 17:33 Dockerfile
5
drwxrwxr-x 6 cyq cyq 4096 2月 20 17:33 docs
6
drwxrwxr-x 3 cyq cyq 4096 2月 20 17:33 documentation
7
drwxrwxr-x 4 cyq cyq 4096 2月 21 00:01 examples
8
-rw-rw-r-- 1 cyq cyq 5119 2月 20 17:33 README.rst
9
-rw-rw-r-- 1 cyq cyq 144 2月 20 17:33 requirements.txt
10
-rwxrwxr-x 1 cyq cyq 405 2月 20 17:33 runtests.sh
11
-rw-rw-r-- 1 cyq cyq 2266 2月 20 17:33 setup.py
12
drwxrwxr-x 4 cyq cyq 4096 2月 20 17:33 switchyard
13
drwxrwxr-x 6 cyq cyq 4096 2月 20 17:37 syenv
14
-rw-r--r-- 1 root root 181 2月 21 21:42 lab_1.pcap
15
drwxrwxr-x 2 cyq cyq 4096 2月 20 17:33 tests
Copied!
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:
1
.
2
├── README.md
3
├── myhub.py
4
├── report
5
│ ├── 123456789拾佰仟_lab_1.pdf
6
│ └── lab_1.pcap
7
├── start_mininet.py
8
└── testcases
9
├── myhub_testscenario.py
10
└── test_lab1.py
Copied!
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:
1
$ git push
Copied!
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