Fix for issue 32. (#33)

* This commit includes example tutorials and solutions for P4D2 2017.
- Added example P4 programs for ipv4_forwarding, mri, arp, calc
- Added python code to invoke compiler, start bmv2, run mininet
- Added solutions to above programs
- Added README files that describe exercises

* Fix for issue #32. The text had said the name of the action should be ipv4_forward, when it should have been set_dst_info.
This commit is contained in:
Robert Soulé 2017-09-22 09:32:00 -07:00 committed by Nate Foster
parent fe61fa61a7
commit 119f267938
2 changed files with 14 additions and 3 deletions

View File

@ -117,11 +117,11 @@ well as a hard-coded MAC address for the switch.
1. An action for `drop`. 1. An action for `drop`.
1. An action (named `ipv4_forward`) to store information in the metadata 1. An action (named `set_dst_info`) to store information in the metadata
structure, rather than immediately writing to the packet header. structure, rather than immediately writing to the packet header.
1. A table (named `ipv4_lpm`) that will match on the destination IP address 1. A table (named `ipv4_lpm`) that will match on the destination IP address
and invoke the `ipv4_forward` action. and invoke the `set_dst_info` action.
1. An action to send an ICMP reply. 1. An action to send an ICMP reply.

View File

@ -173,10 +173,21 @@ control MyIngress(
/* TODO: Define actions and tables here */ /* TODO: Define actions and tables here */
action set_dst_info(mac_addr_t mac_da,
mac_addr_t mac_sa,
port_id_t egress_port)
{
/*
* TODO: add logic to store mac addresses and
* egress ports in meta data
*/
}
table ipv4_lpm { table ipv4_lpm {
key = { meta.dst_ipv4 : lpm; } key = { meta.dst_ipv4 : lpm; }
actions = { /* TODO: add actions */ drop; } actions = { set_dst_info; drop; }
default_action = drop(); default_action = drop();
} }