A Python-based dataplane test framework for network switches, built on unittest and supporting packet injection/verification.
PTF (Packet Test Framework) is a Python-based dataplane test framework built on unittest, designed for testing network switch forwarding behavior. It enables developers to inject, capture, and verify packets to validate switch functionality independently of control-plane protocols like OpenFlow. The framework supports flexible packet manipulation, ternary matching, and multi-device testing scenarios.
Network engineers and developers working on P4-programmable switches, software-defined networking (SDN) dataplanes, or custom network hardware who need to automate dataplane testing.
PTF offers a protocol-agnostic, extensible testing framework with features like pluggable packet modules and multi-device support, derived from OFTest but focused purely on dataplane validation. Its integration with Python unittest and support for parallel execution make it a versatile choice for scalable network testing.
Packet Test Framework
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Offers choice between Scapy for comprehensive features and bf_pktpy for Apache 2.0 licensing, catering to different legal and functional needs as outlined in the README's tradeoff discussion.
Extends beyond single-switch testing to support networks of interconnected devices, enabling complex topology validation with device-aware send and verify functions.
Supports eth, remote, and nn platforms, allowing testing from local Ethernet interfaces to remote hosts via NNG sockets, as detailed in the configuration section.
Includes test sharding via --num-shards and --shard-id options to run tests across multiple PTF processes, improving scalability for large test suites.
Requires sudo to run all tests, which can limit deployment in secure, containerized, or cloud environments and adds operational complexity.
Setting up interfaces, platforms, and packet modules involves manual Python scripting and deep network topology understanding, as seen in the veth and platform mapping examples.
The included bf_pktpy module implements only a subset of Scapy's functionality, constraining advanced packet crafting unless you accept Scapy's copyleft GPL license.