English

P4Testgen: An Extensible Test Oracle For P4

Networking and Internet Architecture 2023-08-08 v3 Symbolic Computation Software Engineering

Abstract

We present P4Testgen, a test oracle for the P416_{16} language. P4Testgen supports automatic test generation for any P4 target and is designed to be extensible to many P4 targets. It models the complete semantics of the target's packet-processing pipeline including the P4 language, architectures and externs, and target-specific extensions. To handle non-deterministic behaviors and complex externs (e.g., checksums and hash functions), P4Testgen uses taint tracking and concolic execution. It also provides path selection strategies that reduce the number of tests required to achieve full coverage. We have instantiated P4Testgen for the V1model, eBPF, PNA, and Tofino P4 architectures. Each extension required effort commensurate with the complexity of the target. We validated the tests generated by P4Testgen by running them across the entire P4C test suite as well as the programs supplied with the Tofino P4 Studio. Using the tool, we have also confirmed 25 bugs in mature, production toolchains for BMv2 and Tofino.

Cite

@article{arxiv.2211.15300,
  title  = {P4Testgen: An Extensible Test Oracle For P4},
  author = {Fabian Ruffy and Jed Liu and Prathima Kotikalapudi and Vojtěch Havel and Hanneli Tavante and Rob Sherwood and Vladyslav Dubina and Volodymyr Peschanenko and Anirudh Sivaraman and Nate Foster},
  journal= {arXiv preprint arXiv:2211.15300},
  year   = {2023}
}
R2 v1 2026-06-28T07:14:51.112Z