nus-snl / p4-traffictool Goto Github PK
View Code? Open in Web Editor NEWp4-traffictool helps in packet generation, parsing and dissection for popular backends
License: MIT License
p4-traffictool helps in packet generation, parsing and dissection for popular backends
License: MIT License
The tool runs into errors for PcapPlusPlus and Scapy backends when the defined parser in P4 program contains a default transition to the next parser state. The type of error varies depending on how the default transition is:
Default transition via a transition select block: In this case the error is TypeError: 'NoneType' object has no attribute '__getitem__'
Default transition which is directly specified like transition parse_next_state
: In this case the error is KeyError: u'bos'
. Here the p4c compiler would merge the parser states and the said transition actually doesn't exist. This is a right thing to do from P4 perspective, but it confuses the tool.
Attached zip contains:
master
and develop
have diverged in their git histories, with conflicts on merge attempts.
Since they seem to differ in docs/
at master, and more code in develop
, would it be better to migrate docs/
to develop and make develop
the new master
./install.sh
adds an alias to p4-traffictool.sh
within the (downloaded) source code.
Ideally, it should copy the source code and p4-traffictool.sh
to /bin
, similar to what a .deb
package would do.
p4_build.sh
script for ideas on this.Currently what we are doing in the top-level bash script p4-traffictool.sh
is very weird - we are invoking the backend p4c-bm2-ss
first and if it fails then we are invoking the frontend p4c
. Ideally speaking we do NOT need to invoke any backend for our purpose. We only need the header and parser definitions as per standard P4_16.
--only-headers
.When p4c compilation fails, do display the errors. For a small syntax error like missing a semi-colon, the user is left clueless as to what went wrong.
Now there are PPA packages for p4c and behavioral model available for Ubuntu. So for Ubuntu users, we can simplify this task of having to build and install all the dependencies. See the mailing list post here.
The biggest impediment in formally announcing the tool is the lack of confidence in its correctness. The tool has not been tested extensively for all the backends that it supports with a variety of P4 programs. We can find more public domain P4 programs here for testing.
Possibly also need to craft custom P4 programs to test handling of corner cases.
When the top-level bash script is invoked with a non-existent P4 file path, the file is not checked for existence and the p4c compiler is invoked leading to failing of the p4c compiler.
Index 1 of an edge in the graph is of type List
. See common.py#L111, but is replaced with a string in some cases in GenTrafficScapy.py#L357
Incidentally, this does not generate a bug, since the cases in which it is replaced with a string - it is interpreted as a string later on, and as a List otherwise.
Not a good practice. Is this worth fixing @rajkiranjoshi ?
For the generated Scapy code, replace tabs with spaces. Scapy isn't happy when you copy-paste that code into Scapy's commandline terminal.
Here are some pointers that need to be looked into and corresponding information added to SimilarTools.md:
master
, but the same is not visible in develop
. So I am sure we can get rid of the same while having all the website related stuff properly organized under docs/
.Dockerfile is already written. Two main tasks:
Integrate properly with Dockerhub with automated builds
Currently the tool appears on Dockerhub at this url. On Docker hub, the organization is sysnetlab
while the machine user is sysnetlabadmin
(linked to [email protected]). Also, the Github account used by Dockerhub is nussnl-docker
(linked to [email protected]).
Figure out a way to invoke the tool from a simple single line Docker command along with the input file and options (if any). Passing arguments while instantiating a Docker container and doing volume mounting+copying is the challenge.
Our team try to introduce p4-traffictool into our p4 traffic test unit. However, when we try to use p4-traffictool to generate scapy code base on our p4 code, the tool says it cannot generate scapy.
Seems like this is an IOError in GenTrafficScapy.py, so I add traceback func in that part of code and get this
Looks like it try to open a temp file, but turns out some wrong happened, I think it is caused by DESTINATION variable received wrong value?
p4-traffictool/p4-traffictool.sh
Lines 214 to 218 in b0c0ce2
p4-traffictool/src/GenTrafficScapy.py
Lines 16 to 18 in b0c0ce2
p4-traffictool/src/GenTrafficScapy.py
Line 588 in b0c0ce2
The generated Wireshark plugin code is incorrect for the perc1 header. Also, possible issues with generated Scapy code for the guess_payload_class()
function of the perc1 header. The expected next hop is based on the ACK field and later on the BOS field. This is sort of a multi-field transition but not expressed so by the P4 programmer. Common programmer expectation is to base the transitions between the PERC header based only on the BOS field. The ACK field check is only for other dataplane processing purposes.
Result: Wireshark doesn't parse the packet beyond perc1 header.
Attachments in zip:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.