Skip to content

Commit 246dadc

Browse files
committed
[ONOS-8037] Update basic makefile and gitignore and recompiled the pipeline, tested with reactive forwarding
Change-Id: I655de81382bb4d4688736dcb634bcf065de72ceb
1 parent ab98a1f commit 246dadc

File tree

6 files changed

+58
-26
lines changed

6 files changed

+58
-26
lines changed

pipelines/basic/src/main/java/org/onosproject/pipelines/basic/BasicConstants.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import org.onosproject.net.pi.model.PiActionId;
2020
import org.onosproject.net.pi.model.PiActionParamId;
2121
import org.onosproject.net.pi.model.PiActionProfileId;
22+
import org.onosproject.net.pi.model.PiMeterId;
2223
import org.onosproject.net.pi.model.PiPacketMetadataId;
2324
import org.onosproject.net.pi.model.PiCounterId;
2425
import org.onosproject.net.pi.model.PiMatchFieldId;
@@ -92,10 +93,13 @@ private BasicConstants() {
9293
public static final PiActionProfileId INGRESS_WCMP_CONTROL_WCMP_SELECTOR =
9394
PiActionProfileId.of("ingress.wcmp_control.wcmp_selector");
9495
// Packet Metadata IDs
95-
public static final PiPacketMetadataId PADDING =
96-
PiPacketMetadataId.of("_padding");
9796
public static final PiPacketMetadataId INGRESS_PORT =
9897
PiPacketMetadataId.of("ingress_port");
9998
public static final PiPacketMetadataId EGRESS_PORT =
10099
PiPacketMetadataId.of("egress_port");
101-
}
100+
// Meter IDs
101+
public static final PiMeterId INGRESS_PORT_METERS_INGRESS_INGRESS_PORT_METER =
102+
PiMeterId.of("ingress.port_meters_ingress.ingress_port_meter");
103+
public static final PiMeterId EGRESS_PORT_METERS_EGRESS_EGRESS_PORT_METER =
104+
PiMeterId.of("egress.port_meters_egress.egress_port_meter");
105+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
p4c-out/*/tofino
2+
p4c-out/**/graphs
3+
p4c-out/**/*_pp.p4
Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
all: basic int constants
22

33
basic: basic.p4
4-
p4c-bm2-ss --arch v1model -o p4c-out/bmv2/basic.json \
5-
--p4runtime-files p4c-out/bmv2/basic_p4info.txt \
6-
basic.p4
4+
@./bmv2-compile.sh "basic" ""
75

86
int: int.p4
9-
p4c-bm2-ss --arch v1model -o p4c-out/bmv2/int.json "-DTARGET_BMV2" \
10-
--p4runtime-files p4c-out/bmv2/int_p4info.txt \
11-
int.p4
7+
@./bmv2-compile.sh "int" "-DTARGET_BMV2"
128

139
constants:
14-
onos-gen-p4-constants \
15-
-o $(ONOS_ROOT)/pipelines/basic/src/main/java/org/onosproject/pipelines/basic/BasicConstants.java \
16-
basic p4c-out/bmv2/basic_p4info.txt
10+
docker run -v $(ONOS_ROOT):/onos -w /onos/tools/dev/bin \
11+
--entrypoint ./onos-gen-p4-constants opennetworking/p4mn:stable \
12+
-o /onos/pipelines/basic/src/main/java/org/onosproject/pipelines/basic/BasicConstants.java \
13+
basic /onos/pipelines/basic/src/main/resources/p4c-out/bmv2/basic_p4info.txt
1714

1815
clean:
1916
rm -rf p4c-out/bmv2/*
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
PROFILE=$1
6+
OTHER_FLAGS=$2
7+
8+
SRC_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
9+
OUT_DIR=${SRC_DIR}/p4c-out/bmv2
10+
11+
mkdir -p ${OUT_DIR}
12+
mkdir -p ${OUT_DIR}/graphs
13+
14+
echo
15+
echo "## Compiling profile ${PROFILE} in ${OUT_DIR}..."
16+
17+
dockerImage=opennetworking/p4c:stable
18+
dockerRun="docker run --rm -w ${SRC_DIR} -v ${SRC_DIR}:${SRC_DIR} -v ${OUT_DIR}:${OUT_DIR} ${dockerImage}"
19+
20+
# Generate preprocessed P4 source (for debugging).
21+
(set -x; ${dockerRun} p4c-bm2-ss --arch v1model \
22+
${OTHER_FLAGS} \
23+
--pp ${OUT_DIR}/${PROFILE}_pp.p4 ${PROFILE}.p4)
24+
25+
# Generate BMv2 JSON and P4Info.
26+
(set -x; ${dockerRun} p4c-bm2-ss --arch v1model -o ${OUT_DIR}/${PROFILE}.json \
27+
${OTHER_FLAGS} \
28+
--p4runtime-files ${OUT_DIR}/${PROFILE}_p4info.txt ${PROFILE}.p4)

pipelines/basic/src/main/resources/p4c-out/bmv2/basic.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,13 @@
181181
"header_union_stacks" : [],
182182
"field_lists" : [],
183183
"errors" : [
184-
["NoError", 0],
185-
["PacketTooShort", 1],
186-
["NoMatch", 2],
187-
["StackOutOfBounds", 3],
188-
["HeaderTooShort", 4],
189-
["ParserTimeout", 5],
190-
["ParserInvalidArgument", 6]
184+
["NoError", 1],
185+
["PacketTooShort", 2],
186+
["NoMatch", 3],
187+
["StackOutOfBounds", 4],
188+
["HeaderTooShort", 5],
189+
["ParserTimeout", 6],
190+
["ParserInvalidArgument", 7]
191191
],
192192
"enums" : [],
193193
"parsers" : [

pipelines/basic/src/main/resources/p4c-out/bmv2/int.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -566,13 +566,13 @@
566566
}
567567
],
568568
"errors" : [
569-
["NoError", 0],
570-
["PacketTooShort", 1],
571-
["NoMatch", 2],
572-
["StackOutOfBounds", 3],
573-
["HeaderTooShort", 4],
574-
["ParserTimeout", 5],
575-
["ParserInvalidArgument", 6]
569+
["NoError", 1],
570+
["PacketTooShort", 2],
571+
["NoMatch", 3],
572+
["StackOutOfBounds", 4],
573+
["HeaderTooShort", 5],
574+
["ParserTimeout", 6],
575+
["ParserInvalidArgument", 7]
576576
],
577577
"enums" : [],
578578
"parsers" : [

0 commit comments

Comments
 (0)