Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Software-Defined Networking
  3. ptf

ptf

NOASSERTIONPythonv0.12.1

A Python-based dataplane test framework for network switches, built on unittest and supporting packet injection/verification.

GitHubGitHub
173 stars117 forks0 contributors

What is ptf?

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.

Target Audience

Network engineers and developers working on P4-programmable switches, software-defined networking (SDN) dataplanes, or custom network hardware who need to automate dataplane testing.

Value Proposition

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.

Overview

Packet Test Framework

Use Cases

Best For

  • Testing P4-programmable switch dataplanes
  • Validating packet forwarding logic in SDN environments
  • Automating functional testing of network hardware
  • Performing regression tests on switch firmware
  • Developing custom test suites for proprietary networking equipment
  • Parallelizing network test execution across multiple hosts

Not Ideal For

  • Teams testing control-plane protocols like BGP or OSPF that require integrated protocol state validation
  • Environments where root/sudo access is prohibited or tightly controlled, such as locked-down production systems
  • Projects needing out-of-the-box test suites for commercial, non-P4 switches without custom Python development

Pros & Cons

Pros

Pluggable Packet Modules

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.

Multi-Device Network Testing

Extends beyond single-switch testing to support networks of interconnected devices, enabling complex topology validation with device-aware send and verify functions.

Flexible Platform Options

Supports eth, remote, and nn platforms, allowing testing from local Ethernet interfaces to remote hosts via NNG sockets, as detailed in the configuration section.

Parallel Execution Support

Includes test sharding via --num-shards and --shard-id options to run tests across multiple PTF processes, improving scalability for large test suites.

Cons

Mandatory Root Privileges

Requires sudo to run all tests, which can limit deployment in secure, containerized, or cloud environments and adds operational complexity.

Steep Configuration Learning Curve

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.

Limited Alternative Packet Module

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.

Frequently Asked Questions

Quick Stats

Stars173
Forks117
Contributors0
Open Issues15
Last commit6 days ago
CreatedSince 2015

Tags

#packet-injection#network-automation#test-framework#scapy#network-switch

Built With

S
Scapy
P
Python
B
Black
t
tcpdump
N
NNG

Included in

Software-Defined Networking1.6k
Auto-fetched 7 hours ago

Related Projects

ZeroTierZeroTier

A Smart Ethernet Switch for Earth

Stars16,948
Forks1,962
Last commit1 day ago
f-stackf-stack

F-Stack is an user space network development kit with high performance based on DPDK, FreeBSD TCP/IP stack and coroutine API.

Stars4,248
Forks957
Last commit8 hours ago
gobgpgobgp

BGP implemented in the Go Programming Language

Stars4,089
Forks802
Last commit3 days ago
snabbswitchsnabbswitch

Snabb: Simple and fast packet networking

Stars3,035
Forks298
Last commit1 year ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub