From ce7c3c372b65aa63821688129c6e978b4bb06622 Mon Sep 17 00:00:00 2001 From: sibanez12 Date: Mon, 6 Nov 2017 19:56:27 -0800 Subject: [PATCH] Updated basic* README files (#80) * Adding initial implementation of basic_encap example * Updated basic_encap example to count the number of valid packets * Updated basic_encap example to put encapsulation layer after Ethernet header. * Added solution file for basic_encap example * Changed the name of the basic_encap example to basic_tunnel and called the new header myTunnel. Also changed the myTunnel field names slightly. * Updated the README file for the basic_tunnel exercise. Also added topo.pdf image to serve as a reference during implementation. * Updated basic/README.md to point to basic_tunnel as the next exercise. * Updated the README for basic to point to basic_tunnel. Updated the starter code for basic_tunnel to look like basic solution with todo comments. Updated send.py and receive.py to be able to send both plain IP packets and tunneled IP packets. Updated basic_tunnel.p4 to have same control flow as p4runtime exercise. * Updated the basic and basic_tunnel README files to remove references to the old run.sh script. Updated TODO list in basic_tunnel README --- P4D2_2017_Fall/exercises/basic/README.md | 10 ++++---- .../exercises/basic_tunnel/README.md | 24 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/P4D2_2017_Fall/exercises/basic/README.md b/P4D2_2017_Fall/exercises/basic/README.md index b335042..93ea699 100644 --- a/P4D2_2017_Fall/exercises/basic/README.md +++ b/P4D2_2017_Fall/exercises/basic/README.md @@ -39,7 +39,7 @@ up a switch in Mininet to test its behavior. * start a Mininet instance with three switches (`s1`, `s2`, `s3`) configured in a triangle, each connected to one host (`h1`, `h2`, and `h3`). - * The hosts are assigned IPs of `10.0.1.1`, `10.0.2.2`, etc. + * The hosts are assigned IPs of `10.0.1.1`, `10.0.2.2`, and `10.0.3.3`. 2. You should now see a Mininet command prompt. Open two terminals for `h1` and `h2`, respectively: @@ -79,7 +79,7 @@ the control plane as part of the rule. In this exercise, we have already implemented the the control plane logic for you. As part of bringing up the Mininet instance, the -`run.sh` script will install packet-processing rules in the tables of +`make run` command will install packet-processing rules in the tables of each switch. These are defined in the `sX-commands.txt` files, where `X` corresponds to the switch number. @@ -140,12 +140,12 @@ Other questions to consider: There are several problems that might manifest as you develop your program: -1. `basic.p4` might fail to compile. In this case, `run.sh` will +1. `basic.p4` might fail to compile. In this case, `make run` will report the error emitted from the compiler and halt. 2. `basic.p4` might compile but fail to support the control plane rules in the `s1-commands.txt` through `s3-command.txt` files that -`run.sh` tries to install using the Bmv2 CLI. In this case, `run.sh` +`make run` tries to install using the Bmv2 CLI. In this case, `make run` will report these errors to `stderr`. Use these error messages to fix your `basic.p4` implementation. @@ -157,7 +157,7 @@ detailed and can help pinpoint logic errors in your implementation. #### Cleaning up Mininet -In the latter two cases above, `run.sh` may leave a Mininet instance +In the latter two cases above, `make run` may leave a Mininet instance running in the background. Use the following command to clean up these instances: diff --git a/P4D2_2017_Fall/exercises/basic_tunnel/README.md b/P4D2_2017_Fall/exercises/basic_tunnel/README.md index effbc4b..e4250e4 100644 --- a/P4D2_2017_Fall/exercises/basic_tunnel/README.md +++ b/P4D2_2017_Fall/exercises/basic_tunnel/README.md @@ -25,7 +25,7 @@ to ensure that the IP routing is working as expected. 1. In your shell, run: ```bash - ./run.sh + make run ``` This will: * compile `basic_tunnel.p4`, and @@ -66,11 +66,11 @@ within each table are inserted by the control plane. When a rule matches a packet, its action is invoked with parameters supplied by the control plane as part of the rule. -In this exercise, you will need to add a couple of static control plane -rules for the tunneling protocol. As part of bringing up the Mininet -instance, the `run.sh` script will install packet-processing rules in -the tables of each switch. These are defined in the `sX-commands.txt` -files, where `X` corresponds to the switch number. +For this exercise, we have already added the necessary static control +plane entries. As part of bringing up the Mininet instance, the +`make run` command will install packet-processing rules in the tables +of each switch. These are defined in the `sX-commands.txt` files, +where `X` corresponds to the switch number. **Important:** A P4 program also defines the interface between the switch pipeline and control plane. The commands in the files @@ -89,8 +89,8 @@ does not exist in the packet. Your job will be to do the following: -1. **TODO:** Add a new header type called `myTunnel_t` that contains two 16-bit fields: `proto_id` and `dst_id`. -2. **TODO:** Add a `myTunnel_t` header to the `headers` struct. +1. **NOTE:** A new header type has been added called `myTunnel_t` that contains two 16-bit fields: `proto_id` and `dst_id`. +2. **NOTE:** The `myTunnel_t` header has been added to the `headers` struct. 2. **TODO:** Update the parser to extract either the `myTunnel` header or `ipv4` header based on the `etherType` field in the Ethernet header. The parser should also extract the `ipv4` header after the `myTunnel` header if `proto_id` == `TYPE_IPV4` (i.e. 0x0800). 3. **TODO:** Define a new action called `myTunnel_forward` that simply sets the egress port (i.e. `egress_spec` field of the `standard_metadata` bus) to the port number provided by the control plane. 4. **TODO:** Define a new table called `myTunnel_exact` that perfoms an exact match on the `dst_id` field of the `myTunnel` header. This table should invoke either the `myTunnel_forward` action if the there is a match in the table and it should invoke the `drop` action otherwise. @@ -134,12 +134,12 @@ Hints: There are several problems that might manifest as you develop your program: -1. `basic_tunnel.p4` might fail to compile. In this case, `run.sh` will +1. `basic_tunnel.p4` might fail to compile. In this case, `make run` will report the error emitted from the compiler and halt. 2. `basic_tunnel.p4` might compile but fail to support the control plane rules in the `s1-commands.txt` through `s3-command.txt` files that -`run.sh` tries to install using the Bmv2 CLI. In this case, `run.sh` +`make run` tries to install using the Bmv2 CLI. In this case, `make run` will report these errors to `stderr`. Use these error messages to fix your `basic_tunnel.p4` implementation or forwarding rules. @@ -151,12 +151,12 @@ detailed and can help pinpoint logic errors in your implementation. #### Cleaning up Mininet -In the latter two cases above, `run.sh` may leave a Mininet instance +In the latter two cases above, `make` may leave a Mininet instance running in the background. Use the following command to clean up these instances: ```bash -mn -c +make stop ``` ## Next Steps