[P4-dev] Announcement of new open source tool p4pktgen

Andy Fingerhut andy.fingerhut at gmail.com
Sat Dec 2 07:07:04 EST 2017

Andres Noetzli, Colin Burgin, Jehandad Khan, and I have developed a
tool called p4pktgen.  It is an automatic test case generator for P4
programs.  You can find the code, installation instructions, and a
first example of running it on some very short P4 programs, with
sample output, at its home page:


p4pktgen is a tool for generating input packets and table entries for
P4 programs that cover all paths of the program.

It supports programs written in either the P4_14 or P4_16 variants of
the language, as long as the program can be compiled using the open
source p4c-bm2-ss compiler (part of the https://github.com/p4lang/p4c
repository), compiled to a bmv2 JSON file for use with the
simple_switch software switch (part of the
https://github.com/p4lang/behavioral-model repository).

It currently covers all combinations of execution paths through the
parser and ingress control block, but ignores the egress control
block. It runs the test cases in simple_switch to check that the
packet follows the expected path of execution, and also writes out a
data file describing the test cases, which should be useful in
executing the test cases on other P4 implementations (additional work
is required to adapt the test cases to run on other implementations).

Please give it a try if this kind of tool interests you, and leave
suggestions for enhancements, or bug reports, as Github issues.

Andy Fingerhut
Cisco Systems, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20171202/17e59746/attachment-0002.html>

More information about the P4-dev mailing list