Skip to content

Commit ac588a2

Browse files
authored
Final edits (#165)
* Final instructions tidying * Instructions * Add final slides
1 parent 948a890 commit ac588a2

File tree

7 files changed

+39
-43
lines changed

7 files changed

+39
-43
lines changed

P4_tutorial.pdf

8.12 MB
Binary file not shown.

P4_tutorial_labs.pdf

-4.73 MB
Binary file not shown.

README.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@ you get started with P4 programming, organized into several modules:
1616
* [Explicit Congestion Notification](./exercises/ecn)
1717
* [Multi-Hop Route Inspection](./exercises/mri)
1818

19-
4. Advanced Data Structures
19+
4. Advanced Behavior
2020
* [Source Routing](./exercises/source_routing)
2121
* [Calculator](./exercises/calc)
22-
23-
5. Dynamic Behavior
2422
* [Load Balancing](./exercises/load_balance)
2523

24+
## Presentation
25+
26+
The slides are available [online](http://bit.ly/p4d2-2018-spring) and
27+
in the P4_tutorial.pdf in the tutorial directory.
28+
2629
## Obtaining required software
2730

2831
If you are starting this tutorial at the Spring 2018 P4 Developer Day,

exercises/ecn/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ There are several ways that problems might manifest:
165165
error emitted from the compiler and stop.
166166
2. `ecn.p4` compiles but does not support the control plane rules in
167167
the `sX-runtime.json` files that `make` tries to install using
168-
the BMv2 CLI. In this case, `make` will log the CLI tool output
168+
a Python controller. In this case, `make` will log the controller output
169169
in the `logs` directory. Use these error messages to fix your `ecn.p4`
170170
implementation.
171171
3. `ecn.p4` compiles, and the control plane rules are installed, but

exercises/load_balance/README.md

+12-22
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ In this exercise, you will implement a form of load balancing based on
44
a simple version of Equal-Cost Multipath Forwarding. The switch you
55
will implement will use two tables to forward packets to one of two
66
destination hosts at random. The first table will use a hash function
7-
(applied to a 5-tuple consisting of the source and destination
8-
IP addresses, IP protocol, and source and destination TCP ports)
9-
to select one of two hosts. The second table will use the
10-
computed hash value to forward the packet to the selected host.
7+
(applied to a 5-tuple consisting of the source and destination IP
8+
addresses, IP protocol, and source and destination TCP ports) to
9+
select one of two hosts. The second table will use the computed hash
10+
value to forward the packet to the selected host.
1111

1212
> **Spoiler alert:** There is a reference solution in the `solution`
1313
> sub-directory. Feel free to compare your implementation to the
@@ -63,16 +63,9 @@ control plane. When a rule matches a packet, its action is invoked
6363
with parameters supplied by the control plane as part of the rule.
6464

6565
In this exercise, the control plane logic has already been
66-
implemented. As part of bringing up the Mininet instance, the
67-
`make` script will install packet-processing rules in the tables of
68-
each switch. These are defined in the `s1-commands.txt` file.
69-
70-
**Important:** A P4 program also defines the interface between the
71-
switch pipeline and control plane. The `s1-commands.txt` file contains
72-
a list of commands for the BMv2 switch API. These commands refer to
73-
specific tables, keys, and actions by name, and any changes in the P4
74-
program that add or rename tables, keys, or actions will need to be
75-
reflected in these command files.
66+
implemented. As part of bringing up the Mininet instance, the `make`
67+
script will install packet-processing rules in the tables of each
68+
switch. These are defined in the `sX-runtime.json` files.
7669

7770
## Step 2: Implement Load Balancing
7871

@@ -105,9 +98,6 @@ Follow the instructions from Step 1. This time, your message from
10598
`h1` should be delivered to `h2` or `h3`. If you send several
10699
messages, some should be received by each server.
107100

108-
### Food for thought
109-
110-
111101
### Troubleshooting
112102

113103
There are several ways that problems might manifest:
@@ -116,10 +106,10 @@ There are several ways that problems might manifest:
116106
report the error emitted from the compiler and stop.
117107

118108
2. `load_balance.p4` compiles but does not support the control plane
119-
rules in the `sX-commands.txt` files that `make` tries to install
120-
using the BMv2 CLI. In this case, `make` will log the CLI tool output
121-
in the `logs` directory. Use these error messages to fix your `load_balance.p4`
122-
implementation.
109+
rules in the `sX-runtime.json` files that `make` tries to install
110+
using the Python controller. In this case, `make` will log the
111+
controller output in the `logs` directory. Use the error messages to
112+
fix your `load_balance.p4` implementation.
123113

124114
3. `load_balance.p4` compiles, and the control plane rules are
125115
installed, but the switch does not process packets in the desired way.
@@ -139,4 +129,4 @@ mn -c
139129

140130
## Next Steps
141131

142-
Congratulations, your implementation works!
132+
Congratulations, your implementation works and you have finished the tutorial!

exercises/mri/README.md

+17-14
Original file line numberDiff line numberDiff line change
@@ -210,22 +210,26 @@ got a packet
210210
There are several ways that problems might manifest:
211211

212212
1. `mri.p4` fails to compile. In this case, `make` will report the
213-
error emitted from the compiler and stop.
213+
error emitted from the compiler and stop.
214+
214215
2. `mri.p4` compiles but does not support the control plane rules in
215-
the `sX-runtime.json` files that `make` tries to install using the BMv2 CLI.
216-
In this case, `make` will log the CLI tool output in the `logs` directory.
217-
Use these error messages to fix your `mri.p4` implementation.
216+
the `sX-runtime.json` files that `make` tries to install using a
217+
Python controller. In this case, `make` will log the controller
218+
output in the `logs` directory. Use these error messages to fix
219+
your `mri.p4` implementation.
220+
218221
3. `mri.p4` compiles, and the control plane rules are installed, but
219-
the switch does not process packets in the desired way. The
220-
`/tmp/p4s.<switch-name>.log` files contain trace messages describing
221-
how each switch processes each packet. The output is detailed and can
222-
help pinpoint logic errors in your implementation. The
223-
`build/<switch-name>-<interface-name>.pcap` also contains the pcap of
224-
packets on each interface. Use `tcpdump -r <filename> -xxx` to print
225-
the hexdump of the packets.
222+
the switch does not process packets in the desired way. The
223+
`/tmp/p4s.<switch-name>.log` files contain trace messages
224+
describing how each switch processes each packet. The output is
225+
detailed and can help pinpoint logic errors in your implementation.
226+
The `build/<switch-name>-<interface-name>.pcap` also contains the
227+
pcap of packets on each interface. Use `tcpdump -r <filename> -xxx`
228+
to print the hexdump of the packets.
229+
226230
4. `mri.p4` compiles and all rules are installed. Packets go through
227-
and the logs show that the queue length is always 0. Then either
228-
reduce the link bandwidth in `topology.json`.
231+
and the logs show that the queue length is always 0. Then either
232+
reduce the link bandwidth in `topology.json`.
229233

230234
#### Cleaning up Mininet
231235

@@ -241,4 +245,3 @@ make stop
241245

242246
Congratulations, your implementation works! Move on to [Source
243247
Routing](../source_routing).
244-

exercises/source_routing/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ to the specified port number.
1313
Your switch must parse the source routing stack. Each item has a bos
1414
(bottom of stack) bit and a port number. The bos bit is 1 only for the
1515
last entry of stack. Then at ingress, it should pop an entry from the
16-
stack and set the egress port accordingly. Note that the last hop can
17-
also revert back the etherType to `TYPE_IPV4`.
16+
stack and set the egress port accordingly. The last hop may also
17+
revert back the etherType to `TYPE_IPV4`.
1818

1919
> **Spoiler alert:** There is a reference solution in the `solution`
2020
> sub-directory. Feel free to compare your implementation to the
@@ -72,7 +72,7 @@ the P4 code so packets are delivered to their destination.
7272
## Step 2: Implement source routing
7373

7474
The `source_routing.p4` file contains a skeleton P4 program with key
75-
pieces of logic replaced by `TODO` comments. These should guide your
75+
pieces of logic replaced by `TODO` comments. These should guide your
7676
implementation---replace each `TODO` with logic implementing the
7777
missing piece.
7878

0 commit comments

Comments
 (0)