Skip to content

P4 Replay (P4R): Reproducing Packet Traces and Stateful Connections at Line-Rate on Your P4-based Switch

License

Notifications You must be signed in to change notification settings

intrig-unicamp/P4R

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

P4 Replay (P4R): Reproducing Packet Traces and Stateful Connections at Line-Rate on Your P4-based Switch

⚠️This repository is in a state of development

[Update 05/May]: The code will be published next week, we are resolving minor issues regarding the user interface.

About P4R:

P4 Replay (P4R) is as a high-end traffic generation tool able to reproduce real world traffic scnearios. P4R benefits from the Tofino traffic generation capabilities to replicate real-world traffic patterns while maintaining high performance and accuracy. The user/network tester can use P4R to reproduce pre-captured traces (i.e., PCAPs) and create stateful TCP connections at the Tofino line rate.

P4R Opetation Modes

P4R can be used in three configuration modes: client, server, or internal (See Figure Below). In client mode , P4R can reproduce PCAPs or establish TCP connections with a connected server; in server mode, P4R responds to TCP connections from connected clients; and in internal mode , P4R can send packet traces or TCP connections to test.

Client mode.

In this mode, P4R can instantiate clients to send traffic (i.e., packet traces) or establish stateful TCP connections with external servers.

Server mode.

In this mode, P4R will act as a stateful TCP server (e.g., iperf) and establish connections with multiple clients.

Internal mode.

In this mode, the traffic generated by P4R is internally routed to a user’s P4 code running in parallel in another pipeline. In this mode, the user’s P4 code is responsible for correctly processing and routing the generated traffic.

Requiriments

  • git
  • python3
  • Tofino Switch™, SDE version 9.12+.

Installation

$ git clone https://github.com/ntrig-unicamp/P4R/.git

Usage

After clone our repository, you should acess the P4R directory and modify the file main.py. In this file you can configure you traffic patterns, desired output ports, and all other necessary parameters to start the traffic generation. P4R will use your definitions to generate all configuration files and execution scripts, and after that you can start the traffic generation. Below we provide a description of available commands, parameters and how to use them.

NameTrafficGenerator = P4RGenerator()
  #instatiate the traffic generator with the name "NameTrafficGenerator"
NameTrafficGenerator.addGenerationPort(port)
  #port (generation port on Tofino)
NameTrafficGenerator.addOutputPort(port, channel, bw)
  #port (physical port)
  #channel (port ID(D_P))
  #bw (portBW)

Examples

Next we provide some simple examples how to use P4R.

Reproducing a PCAP file at 30 Gbps

myTG = P4RGenerator()                             #instatiate the traffic generator
myTG.addGenerationPort(68)                         #define the generation port
myTG.addOutputPort(5, 160, "100G")                 #physical port, port ID(D_P), portBW
myTG.generationMode("Client")
myTG.setPCAP("myPCAP_example.pcap")
myTG.setThroughput("30000")

About

P4 Replay (P4R): Reproducing Packet Traces and Stateful Connections at Line-Rate on Your P4-based Switch

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published