p4-dev@lists.p4.org

list for questions/discussion of p4 programs and tools

View all threads

Announcing P4-TrafficTool for generating/parsing traffic with custom packet formats

RJ
Raj Joshi
Fri, Jan 8, 2021 5:18 AM

P4-TrafficTool: https://github.com/NUS-SNL/p4-traffictool

Traffic generation/parsing tools such as MoonGen or Wireshark can support
custom protocol headers when provided with an appropriate "plugin code".
p4-traffictool processes user-provided P4 program to automatically generate
the required "plugin code" for P4-specified custom packet formats.
Currently, p4-traffictool can generate plugin code for Wireshark (Tshark)
https://wiki.wireshark.org/Lua/Dissectors, Scapy https://scapy.net/,
MoonGen https://github.com/emmericp/MoonGen/, and PcapPlusPlus
https://pcapplusplus.github.io/.

With p4-traffictool, a P4 developer need not know the internals of MoonGen or
Wireshark if s/he simply wants to generate line-rate traffic or analyze a
network trace consisting of P4-specified custom packet format(s). In our
experience, p4-traffictool has helped with faster iterations as packet
formats evolve over the course of a project requiring frequent changes to
the tool-specific "plugin code".

Currently, p4-traffictool expects the input P4 source code to be written
for the bmv2 simple_switch target. For P4 source code written for other
targets, you need to extract your headers and parser definitions and modify
them to fit in an empty v1model template (provided
https://github.com/NUS-SNL/p4-traffictool/blob/master/templates/template.p4
).

Credits: While an early version of the tool was presented as a poster at
ACM SOSR 2019 https://doi.org/10.1145/3314148.3318047, credits are due to
our very talented interns who did all the heavy lifting in building the
tool:

Your feedback and contributions via Github issues/pull requests are highly
appreciated.

Warmest regards,

Raj

(on behalf of all contributors)

*P4-TrafficTool:* https://github.com/NUS-SNL/p4-traffictool Traffic generation/parsing tools such as MoonGen or Wireshark can support custom protocol headers when provided with an appropriate "plugin code". p4-traffictool processes user-provided P4 program to automatically generate the required "plugin code" for P4-specified custom packet formats. Currently, p4-traffictool can generate plugin code for Wireshark (Tshark) <https://wiki.wireshark.org/Lua/Dissectors>, Scapy <https://scapy.net/>, MoonGen <https://github.com/emmericp/MoonGen/>, and PcapPlusPlus <https://pcapplusplus.github.io/>. With p4-traffictool, a P4 developer need not know the internals of MoonGen or Wireshark if s/he simply wants to generate line-rate traffic or analyze a network trace consisting of P4-specified custom packet format(s). In our experience, p4-traffictool has helped with faster iterations as packet formats evolve over the course of a project requiring frequent changes to the tool-specific "plugin code". Currently, p4-traffictool expects the input P4 source code to be written for the bmv2 simple_switch target. For P4 source code written for other targets, you need to extract your headers and parser definitions and modify them to fit in an empty v1model template (provided <https://github.com/NUS-SNL/p4-traffictool/blob/master/templates/template.p4> ). Credits: While an early version of the tool was presented as a poster at ACM SOSR 2019 <https://doi.org/10.1145/3314148.3318047>, credits are due to our very talented interns who did all the heavy lifting in building the tool: - Deepanshu Jindal <https://djin31.github.io/> (IIT Delhi / Tower Research Capital) - Nona Rajabi <http://ee.sharif.edu/~nona.rajabi> (Sharif University of Technology) - Rahul Bothra <https://pro-panda.github.io/> (BITS Pilani / Microsoft Research India) Your feedback and contributions via Github issues/pull requests are highly appreciated. Warmest regards, Raj (on behalf of all contributors)
H
hemant@mnkcg.com
Fri, Jan 8, 2021 3:32 PM

Raj,

Thanks for sharing – good work.

With Cisco Trex, all it needs is a pcap file and the tool can generate traffic. Trex is open-sourced and integrated with DPDK.

https://trex-tgn.cisco.com/

I and others use PTF (https://github.com/p4lang/ptf) which uses Scapy and Scapy can generate a pcap file.

Hemant

From: P4-dev p4-dev-bounces@lists.p4.org On Behalf Of Raj Joshi
Sent: Friday, January 08, 2021 12:18 AM
To: p4-dev p4-dev@lists.p4.org
Subject: [P4-dev] Announcing P4-TrafficTool for generating/parsing traffic with custom packet formats

P4-TrafficTool: https://github.com/NUS-SNL/p4-traffictool

Traffic generation/parsing tools such as MoonGen or Wireshark can support custom protocol headers when provided with an appropriate "plugin code". p4-traffictool processes user-provided P4 program to automatically generate the required "plugin code" for P4-specified custom packet formats. Currently, p4-traffictool can generate plugin code for  https://wiki.wireshark.org/Lua/Dissectors Wireshark (Tshark),  https://scapy.net/ Scapy,  https://github.com/emmericp/MoonGen/ MoonGen, and  https://pcapplusplus.github.io/ PcapPlusPlus.

With p4-traffictool, a P4 developer need not know the internals of MoonGen or Wireshark if s/he simply wants to generate line-rate traffic or analyze a network trace consisting of P4-specified custom packet format(s). In our experience, p4-traffictool has helped with faster iterations as packet formats evolve over the course of a project requiring frequent changes to the tool-specific "plugin code".

Currently, p4-traffictool expects the input P4 source code to be written for the bmv2 simple_switch target. For P4 source code written for other targets, you need to extract your headers and parser definitions and modify them to fit in an empty v1model template (provided https://github.com/NUS-SNL/p4-traffictool/blob/master/templates/template.p4 ).

Credits: While an early version of the tool was presented as a  https://doi.org/10.1145/3314148.3318047 poster at ACM SOSR 2019, credits are due to our very talented interns who did all the heavy lifting in building the tool:

Your feedback and contributions via Github issues/pull requests are highly appreciated.

Warmest regards,

Raj

(on behalf of all contributors)

Raj, Thanks for sharing – good work. With Cisco Trex, all it needs is a pcap file and the tool can generate traffic. Trex is open-sourced and integrated with DPDK. https://trex-tgn.cisco.com/ I and others use PTF (https://github.com/p4lang/ptf) which uses Scapy and Scapy can generate a pcap file. Hemant From: P4-dev <p4-dev-bounces@lists.p4.org> On Behalf Of Raj Joshi Sent: Friday, January 08, 2021 12:18 AM To: p4-dev <p4-dev@lists.p4.org> Subject: [P4-dev] Announcing P4-TrafficTool for generating/parsing traffic with custom packet formats P4-TrafficTool: https://github.com/NUS-SNL/p4-traffictool Traffic generation/parsing tools such as MoonGen or Wireshark can support custom protocol headers when provided with an appropriate "plugin code". p4-traffictool processes user-provided P4 program to automatically generate the required "plugin code" for P4-specified custom packet formats. Currently, p4-traffictool can generate plugin code for <https://wiki.wireshark.org/Lua/Dissectors> Wireshark (Tshark), <https://scapy.net/> Scapy, <https://github.com/emmericp/MoonGen/> MoonGen, and <https://pcapplusplus.github.io/> PcapPlusPlus. With p4-traffictool, a P4 developer need not know the internals of MoonGen or Wireshark if s/he simply wants to generate line-rate traffic or analyze a network trace consisting of P4-specified custom packet format(s). In our experience, p4-traffictool has helped with faster iterations as packet formats evolve over the course of a project requiring frequent changes to the tool-specific "plugin code". Currently, p4-traffictool expects the input P4 source code to be written for the bmv2 simple_switch target. For P4 source code written for other targets, you need to extract your headers and parser definitions and modify them to fit in an empty v1model template (provided <https://github.com/NUS-SNL/p4-traffictool/blob/master/templates/template.p4> ). Credits: While an early version of the tool was presented as a <https://doi.org/10.1145/3314148.3318047> poster at ACM SOSR 2019, credits are due to our very talented interns who did all the heavy lifting in building the tool: - <https://djin31.github.io/> Deepanshu Jindal (IIT Delhi / Tower Research Capital) - <http://ee.sharif.edu/~nona.rajabi> Nona Rajabi (Sharif University of Technology) - <https://pro-panda.github.io/> Rahul Bothra (BITS Pilani / Microsoft Research India) Your feedback and contributions via Github issues/pull requests are highly appreciated. Warmest regards, Raj (on behalf of all contributors)
RJ
Raj Joshi
Sun, Jan 10, 2021 7:39 AM

Hi Nate,

The tool is still work-in-progress, as we work on using just the frontend
of p4lang/p4c to support P4 code written for any target. Will surely
consider writing a blog post once we get there :)


Hi Hemant,

Thanks for the pointer to Trex. Combined with PTF, certainly serves the
purpose of common traffic generation needs :)

-- Raj

On Fri, Jan 8, 2021, 11:32 PM hemant@mnkcg.com wrote:

Raj,

Thanks for sharing – good work.

With Cisco Trex, all it needs is a pcap file and the tool can generate
traffic. Trex is open-sourced and integrated with DPDK.

https://trex-tgn.cisco.com/

I and others use PTF (https://github.com/p4lang/ptf) which uses Scapy and
Scapy can generate a pcap file.

Hemant

From: P4-dev p4-dev-bounces@lists.p4.org *On Behalf Of *Raj Joshi
Sent: Friday, January 08, 2021 12:18 AM
To: p4-dev p4-dev@lists.p4.org
Subject: [P4-dev] Announcing P4-TrafficTool for generating/parsing
traffic with custom packet formats

P4-TrafficTool: https://github.com/NUS-SNL/p4-traffictool

Traffic generation/parsing tools such as MoonGen or Wireshark can support
custom protocol headers when provided with an appropriate "plugin
code". p4-traffictool processes user-provided P4 program to automatically
generate the required "plugin code" for P4-specified custom packet formats.
Currently, p4-traffictool can generate plugin code for Wireshark (Tshark)
https://wiki.wireshark.org/Lua/Dissectors, Scapy https://scapy.net/,
MoonGen https://github.com/emmericp/MoonGen/, and PcapPlusPlus
https://pcapplusplus.github.io/.

With p4-traffictool, a P4 developer need not know the internals
of MoonGen or Wireshark if s/he simply wants to generate line-rate traffic
or analyze a network trace consisting of P4-specified custom packet
format(s). In our experience, p4-traffictool has helped with faster
iterations as packet formats evolve over the course of a project requiring
frequent changes to the tool-specific "plugin code".

Currently, p4-traffictool expects the input P4 source code to be written
for the bmv2 simple_switch target. For P4 source code written for other
targets, you need to extract your headers and parser definitions and modify
them to fit in an empty v1model template (provided
https://github.com/NUS-SNL/p4-traffictool/blob/master/templates/template.p4
).

Credits: While an early version of the tool was presented as a poster
at ACM SOSR 2019 https://doi.org/10.1145/3314148.3318047, credits are
due to our very talented interns who did all the heavy lifting in building
the tool:

Your feedback and contributions via Github issues/pull requests are highly
appreciated.

Warmest regards,

Raj

(on behalf of all contributors)

Raj Joshi

Typed using thumbs, please excuse brevity.

Hi Nate, The tool is still work-in-progress, as we work on using just the frontend of p4lang/p4c to support P4 code written for any target. Will surely consider writing a blog post once we get there :) --- Hi Hemant, Thanks for the pointer to Trex. Combined with PTF, certainly serves the purpose of common traffic generation needs :) -- Raj On Fri, Jan 8, 2021, 11:32 PM <hemant@mnkcg.com> wrote: > Raj, > > > > Thanks for sharing – good work. > > > > With Cisco Trex, all it needs is a pcap file and the tool can generate > traffic. Trex is open-sourced and integrated with DPDK. > > > > https://trex-tgn.cisco.com/ > > > > I and others use PTF (https://github.com/p4lang/ptf) which uses Scapy and > Scapy can generate a pcap file. > > > > Hemant > > > > *From:* P4-dev <p4-dev-bounces@lists.p4.org> *On Behalf Of *Raj Joshi > *Sent:* Friday, January 08, 2021 12:18 AM > *To:* p4-dev <p4-dev@lists.p4.org> > *Subject:* [P4-dev] Announcing P4-TrafficTool for generating/parsing > traffic with custom packet formats > > > > *P4-TrafficTool:* https://github.com/NUS-SNL/p4-traffictool > > > > Traffic generation/parsing tools such as MoonGen or Wireshark can support > custom protocol headers when provided with an appropriate "plugin > code". p4-traffictool processes user-provided P4 program to automatically > generate the required "plugin code" for P4-specified custom packet formats. > Currently, p4-traffictool can generate plugin code for Wireshark (Tshark) > <https://wiki.wireshark.org/Lua/Dissectors>, Scapy <https://scapy.net/>, > MoonGen <https://github.com/emmericp/MoonGen/>, and PcapPlusPlus > <https://pcapplusplus.github.io/>. > > > > With p4-traffictool, a P4 developer need not know the internals > of MoonGen or Wireshark if s/he simply wants to generate line-rate traffic > or analyze a network trace consisting of P4-specified custom packet > format(s). In our experience, p4-traffictool has helped with faster > iterations as packet formats evolve over the course of a project requiring > frequent changes to the tool-specific "plugin code". > > > > Currently, p4-traffictool expects the input P4 source code to be written > for the bmv2 simple_switch target. For P4 source code written for other > targets, you need to extract your headers and parser definitions and modify > them to fit in an empty v1model template (provided > <https://github.com/NUS-SNL/p4-traffictool/blob/master/templates/template.p4> > ). > > > > *Credits:* While an early version of the tool was presented as a poster > at ACM SOSR 2019 <https://doi.org/10.1145/3314148.3318047>, credits are > due to our very talented interns who did all the heavy lifting in building > the tool: > > - Deepanshu Jindal <https://djin31.github.io/> (IIT Delhi / Tower > Research Capital) > > - Nona Rajabi <http://ee.sharif.edu/~nona.rajabi> (Sharif University of > Technology) > > - Rahul Bothra <https://pro-panda.github.io/> (BITS Pilani / Microsoft > Research India) > > > > Your feedback and contributions via Github issues/pull requests are highly > appreciated. > > > > Warmest regards, > > Raj > > (on behalf of all contributors) > Raj Joshi Typed using thumbs, please excuse brevity.
H
hemant@mnkcg.com
Sun, Jan 10, 2021 4:31 PM

Raj,

I have only used trex as an open-source traffic tool.  Trex also support stateful traffic generation which is useful to test stateful P4 features.

Hemant

From: Raj Joshi rajjoshi@comp.nus.edu.sg
Sent: Sunday, January 10, 2021 2:39 AM
To: hemant@mnkcg.com; Nate Foster jnfoster@cs.cornell.edu
Cc: p4-dev p4-dev@lists.p4.org
Subject: Re: [P4-dev] Announcing P4-TrafficTool for generating/parsing traffic with custom packet formats

Hi Nate,

The tool is still work-in-progress, as we work on using just the frontend of p4lang/p4c to support P4 code written for any target. Will surely consider writing a blog post once we get there :)


Hi Hemant,

Thanks for the pointer to Trex. Combined with PTF, certainly serves the purpose of common traffic generation needs :)

-- Raj

On Fri, Jan 8, 2021, 11:32 PM <hemant@mnkcg.com mailto:hemant@mnkcg.com > wrote:

Raj,

Thanks for sharing – good work.

With Cisco Trex, all it needs is a pcap file and the tool can generate traffic. Trex is open-sourced and integrated with DPDK.

https://trex-tgn.cisco.com/

I and others use PTF (https://github.com/p4lang/ptf) which uses Scapy and Scapy can generate a pcap file.

Hemant

From: P4-dev <p4-dev-bounces@lists.p4.org mailto:p4-dev-bounces@lists.p4.org > On Behalf Of Raj Joshi
Sent: Friday, January 08, 2021 12:18 AM
To: p4-dev <p4-dev@lists.p4.org mailto:p4-dev@lists.p4.org >
Subject: [P4-dev] Announcing P4-TrafficTool for generating/parsing traffic with custom packet formats

P4-TrafficTool: https://github.com/NUS-SNL/p4-traffictool

Traffic generation/parsing tools such as MoonGen or Wireshark can support custom protocol headers when provided with an appropriate "plugin code". p4-traffictool processes user-provided P4 program to automatically generate the required "plugin code" for P4-specified custom packet formats. Currently, p4-traffictool can generate plugin code for  https://wiki.wireshark.org/Lua/Dissectors Wireshark (Tshark),  https://scapy.net/ Scapy,  https://github.com/emmericp/MoonGen/ MoonGen, and  https://pcapplusplus.github.io/ PcapPlusPlus.

With p4-traffictool, a P4 developer need not know the internals of MoonGen or Wireshark if s/he simply wants to generate line-rate traffic or analyze a network trace consisting of P4-specified custom packet format(s). In our experience, p4-traffictool has helped with faster iterations as packet formats evolve over the course of a project requiring frequent changes to the tool-specific "plugin code".

Currently, p4-traffictool expects the input P4 source code to be written for the bmv2 simple_switch target. For P4 source code written for other targets, you need to extract your headers and parser definitions and modify them to fit in an empty v1model template (provided https://github.com/NUS-SNL/p4-traffictool/blob/master/templates/template.p4 ).

Credits: While an early version of the tool was presented as a  https://doi.org/10.1145/3314148.3318047 poster at ACM SOSR 2019, credits are due to our very talented interns who did all the heavy lifting in building the tool:

Your feedback and contributions via Github issues/pull requests are highly appreciated.

Warmest regards,

Raj

(on behalf of all contributors)

Raj Joshi

Typed using thumbs, please excuse brevity.

Raj, I have only used trex as an open-source traffic tool. Trex also support stateful traffic generation which is useful to test stateful P4 features. Hemant From: Raj Joshi <rajjoshi@comp.nus.edu.sg> Sent: Sunday, January 10, 2021 2:39 AM To: hemant@mnkcg.com; Nate Foster <jnfoster@cs.cornell.edu> Cc: p4-dev <p4-dev@lists.p4.org> Subject: Re: [P4-dev] Announcing P4-TrafficTool for generating/parsing traffic with custom packet formats Hi Nate, The tool is still work-in-progress, as we work on using just the frontend of p4lang/p4c to support P4 code written for any target. Will surely consider writing a blog post once we get there :) --- Hi Hemant, Thanks for the pointer to Trex. Combined with PTF, certainly serves the purpose of common traffic generation needs :) -- Raj On Fri, Jan 8, 2021, 11:32 PM <hemant@mnkcg.com <mailto:hemant@mnkcg.com> > wrote: Raj, Thanks for sharing – good work. With Cisco Trex, all it needs is a pcap file and the tool can generate traffic. Trex is open-sourced and integrated with DPDK. https://trex-tgn.cisco.com/ I and others use PTF (https://github.com/p4lang/ptf) which uses Scapy and Scapy can generate a pcap file. Hemant From: P4-dev <p4-dev-bounces@lists.p4.org <mailto:p4-dev-bounces@lists.p4.org> > On Behalf Of Raj Joshi Sent: Friday, January 08, 2021 12:18 AM To: p4-dev <p4-dev@lists.p4.org <mailto:p4-dev@lists.p4.org> > Subject: [P4-dev] Announcing P4-TrafficTool for generating/parsing traffic with custom packet formats P4-TrafficTool: https://github.com/NUS-SNL/p4-traffictool Traffic generation/parsing tools such as MoonGen or Wireshark can support custom protocol headers when provided with an appropriate "plugin code". p4-traffictool processes user-provided P4 program to automatically generate the required "plugin code" for P4-specified custom packet formats. Currently, p4-traffictool can generate plugin code for <https://wiki.wireshark.org/Lua/Dissectors> Wireshark (Tshark), <https://scapy.net/> Scapy, <https://github.com/emmericp/MoonGen/> MoonGen, and <https://pcapplusplus.github.io/> PcapPlusPlus. With p4-traffictool, a P4 developer need not know the internals of MoonGen or Wireshark if s/he simply wants to generate line-rate traffic or analyze a network trace consisting of P4-specified custom packet format(s). In our experience, p4-traffictool has helped with faster iterations as packet formats evolve over the course of a project requiring frequent changes to the tool-specific "plugin code". Currently, p4-traffictool expects the input P4 source code to be written for the bmv2 simple_switch target. For P4 source code written for other targets, you need to extract your headers and parser definitions and modify them to fit in an empty v1model template (provided <https://github.com/NUS-SNL/p4-traffictool/blob/master/templates/template.p4> ). Credits: While an early version of the tool was presented as a <https://doi.org/10.1145/3314148.3318047> poster at ACM SOSR 2019, credits are due to our very talented interns who did all the heavy lifting in building the tool: - <https://djin31.github.io/> Deepanshu Jindal (IIT Delhi / Tower Research Capital) - <http://ee.sharif.edu/~nona.rajabi> Nona Rajabi (Sharif University of Technology) - <https://pro-panda.github.io/> Rahul Bothra (BITS Pilani / Microsoft Research India) Your feedback and contributions via Github issues/pull requests are highly appreciated. Warmest regards, Raj (on behalf of all contributors) Raj Joshi Typed using thumbs, please excuse brevity.