Skip to content

Commit 5cc9026

Browse files
authored
Fix loadbalancer tutorial (#622)
* added apply for ecmp_group and ecmp_nhop, which fixes error of compiler not running through * adjusted README to reflect the initial state of the p4 program
1 parent c141eaf commit 5cc9026

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

exercises/load_balance/README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ value to forward the packet to the selected host.
1616
## Step 1: Run the (incomplete) starter code
1717

1818
The directory with this README also contains a skeleton P4 program,
19-
`load_balance.p4`, which initially drops all packets. Your job (in
20-
the next step) will be to extend it to properly forward packets.
19+
`load_balance.p4`, which initially sends all packets of the load balance IP to h2.
20+
Your job (in the next step) will be to extend it to properly forward packets.
2121

2222
Before that, let's compile the incomplete `load_balance.p4` and bring
2323
up a switch in Mininet to test its behavior.
@@ -48,12 +48,11 @@ up a switch in Mininet to test its behavior.
4848
```bash
4949
./send.py 10.0.0.1 "P4 is cool"
5050
```
51-
The message will not be received.
5251
5. Type `exit` to leave each XTerm and the Mininet command line.
5352

54-
The message was not received because each switch is programmed with
55-
`load_balance.p4`, which drops all packets on arrival. Your job is to
56-
extend this file.
53+
The message will only be received by h2 because each switch is programmed
54+
with `load_balance.p4`, which does not yet select between different switches.
55+
Your job is to extend this file.
5756

5857
### A note about the control plane
5958

exercises/load_balance/load_balance.p4

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ control MyIngress(inout headers hdr,
135135
/* TODO: apply ecmp_group table and ecmp_nhop table if IPv4 header is
136136
* valid and TTL hasn't reached zero
137137
*/
138+
ecmp_group.apply();
139+
ecmp_nhop.apply();
138140
}
139141
}
140142

0 commit comments

Comments
 (0)