Skip to content

Commit 13be9ae

Browse files
committed
WIP Add comments to P4 program
1 parent f7080d6 commit 13be9ae

File tree

6 files changed

+316
-195
lines changed

6 files changed

+316
-195
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ p4-build:
9090
p4-test:
9191
@cd ptf && ./run_tests
9292

93+
# Create container once, use it many times to preserve mvn repo cache.
9394
_create_mvn_container:
9495
@if ! docker container ls -a --format '{{.Names}}' | grep -q ${app_build_container_name} ; then \
9596
docker create -v ${curr_dir}/app:/mvn-src -w /mvn-src --name ${app_build_container_name} ${MAVEN_IMG} mvn clean package; \

app/src/main/java/org/p4/p4d2/tutorial/Ipv6RoutingComponent.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ private void setUpMyStationTable(DeviceId deviceId) {
190190
// Modify P4Runtime entity names to match content of P4Info file (look
191191
// for the fully qualified name of tables, match fields, and actions.
192192
// ---- START SOLUTION ----
193-
final String tableId = "IngressPipeImpl.l2_my_station";
193+
final String tableId = "IngressPipeImpl.my_station_table";
194194

195195
final PiCriterion match = PiCriterion.builder()
196196
.matchExact(
@@ -235,10 +235,10 @@ private GroupDescription createNextHopGroup(int groupId,
235235
// Modify P4Runtime entity names to match content of P4Info file (look
236236
// for the fully qualified name of tables, match fields, and actions.
237237
// ---- START SOLUTION ----
238-
final String tableId = "IngressPipeImpl.l3_table";
238+
final String tableId = "IngressPipeImpl.routing_v6_table";
239239
for (MacAddress nextHopMac : nextHopMacs) {
240240
final PiAction action = PiAction.builder()
241-
.withId(PiActionId.of("IngressPipeImpl.set_l2_next_hop"))
241+
.withId(PiActionId.of("IngressPipeImpl.set_next_hop"))
242242
.withParameter(new PiActionParam(
243243
// Action param name.
244244
PiActionParamId.of("dmac"),
@@ -270,7 +270,7 @@ private FlowRule createRoutingRule(DeviceId deviceId, Ip6Prefix ip6Prefix,
270270
// Modify P4Runtime entity names to match content of P4Info file (look
271271
// for the fully qualified name of tables, match fields, and actions.
272272
// ---- START SOLUTION ----
273-
final String tableId = "IngressPipeImpl.l3_table";
273+
final String tableId = "IngressPipeImpl.routing_v6_table";
274274
final PiCriterion match = PiCriterion.builder()
275275
.matchLpm(
276276
PiMatchFieldId.of("hdr.ipv6.dst_addr"),

app/src/main/java/org/p4/p4d2/tutorial/pipeconf/InterpreterImpl.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,8 @@ public class InterpreterImpl extends AbstractHandlerBehaviour
7575
.put(Criterion.Type.ETH_SRC, "hdr.ethernet.src_addr")
7676
.put(Criterion.Type.ETH_TYPE, "hdr.ethernet.ether_type")
7777
.put(Criterion.Type.IPV6_DST, "hdr.ipv6.dst_addr")
78-
.put(Criterion.Type.IP_PROTO, "local_metadata.ip_proto")
79-
.put(Criterion.Type.ICMPV4_TYPE, "local_metadata.icmp_type")
80-
.put(Criterion.Type.ICMPV6_TYPE, "local_metadata.icmp_type")
78+
.put(Criterion.Type.IP_PROTO, "hdr.ipv6.next_hdr")
79+
.put(Criterion.Type.ICMPV6_TYPE, "hdr.icmpv6.type")
8180
.build();
8281

8382
/**

0 commit comments

Comments
 (0)