File tree Expand file tree Collapse file tree 6 files changed +58
-26
lines changed
java/org/onosproject/pipelines/basic Expand file tree Collapse file tree 6 files changed +58
-26
lines changed Original file line number Diff line number Diff line change 1919import org .onosproject .net .pi .model .PiActionId ;
2020import org .onosproject .net .pi .model .PiActionParamId ;
2121import org .onosproject .net .pi .model .PiActionProfileId ;
22+ import org .onosproject .net .pi .model .PiMeterId ;
2223import org .onosproject .net .pi .model .PiPacketMetadataId ;
2324import org .onosproject .net .pi .model .PiCounterId ;
2425import 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+ }
Original file line number Diff line number Diff line change 1+ p4c-out /* /tofino
2+ p4c-out /** /graphs
3+ p4c-out /** /* _pp.p4
Original file line number Diff line number Diff line change 11all : basic int constants
22
33basic : 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
86int : 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
139constants :
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
1815clean :
1916 rm -rf p4c-out/bmv2/*
Original file line number Diff line number Diff line change 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)
Original file line number Diff line number Diff line change 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" : [
Original file line number Diff line number Diff line change 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" : [
You can’t perform that action at this time.
0 commit comments