Giter Club home page Giter Club logo

p4-traffictool's People

Contributors

dependabot[bot] avatar djin31 avatar nishantbudhdev avatar non4-rjb avatar nonarjb avatar rajkiranjoshi avatar rhl-bthr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

p4-traffictool's Issues

Better and smarter top-level bash script

  • Support using both long options and short options. The sequence of options should be pretty flexible.
  • It should automatically detect the P4 language version (P4_14 vs P4_16). See Barefoot Academy's p4_build.sh script for ideas on this.
  • Interactive Mode: The top-level script should run the interactive mode by default and ask all missing options showing their default values. If certain options are specified by the user, it should not ask again for them, but only ask for remaining options. If the top-level script invocation specifies all options (especially the targets), then interactive mode should not be triggered.

Incorrect code generation for a specific parser graph

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:

  1. perc.p4: source P4 program
  2. perc_parser.pdf: parser graph for the P4 program
  3. perc_sample.pcap: sample pcap file contain PERC packets

perc_issue.zip

Dockerization

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.

Master and develop not in sync

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

Extensive testing for tool's correctness

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.

Code Generation for Scapy

For the generated Scapy code, replace tabs with spaces. Scapy isn't happy when you copy-paste that code into Scapy's commandline terminal.

Tool doesn't handle default transitions in the parser

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:

  1. Default transition via a transition select block: In this case the error is TypeError: 'NoneType' object has no attribute '__getitem__'

  2. 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:

  1. perc-tcp-options.p4: by default it is a working P4 file. Follow comments around "BUGGY Line #โ 1" and "BUGGY Line #โ 2" to reproduce the two error respectively. Reproduce only one error at a time.
  2. graphs/ParseGraph-works.pdf: a working parser graph
  3. graphs/ParseGraph-bug_line1.pdf: parser graph corresponding to the first error.
  4. graphs/ParseGraph-bug_line2.pdf: parser graph corresponding to the second error.

perc-tcp-options.zip

Correcting the use of the compiler

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.

  • Try and use only the p4c frontend by default. No backends need to be invoked.
  • If the above works correctly, then with proper addition of an include path, the p4c frontend should be able to handle code written for any architecture (NetFPGA, Tofino). See how microP4 does it. In fact, Barefoot's proprietary compiler uses the open-source p4c compiler frontend. This should take away a lot of pain in using the tool for programs written for Barefoot Tofino and avoid workarounds like --only-headers.

Better error reporting

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.

./install.sh does not really install

./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.

Website Improvements

  • Design Rehaul: The current website isn't that great looking. Look at pcapplusplus.github.io OR erpc.io for a better inspiration.
  • On both Github main page and website, the link to the poster's extended abstract should appear upfront. Can appeal modestly to cite our poster if they have benefited from the tool's use. Maybe like this?
  • Current Readme.md shows some table at the top in 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/.

p4-traffictool cannot generate scapy code

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.
image

Seems like this is an IOError in GenTrafficScapy.py, so I add traceback func in that part of code and get this
image

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?

if [[ "$SCAPY" = true ]];then
temp="$OUTPUT/scapy"
echo "Running Scapy backend script"
mkdir -p $temp
python $DIR/src/GenTrafficScapy.py $JSONSOURCE $temp $DEBUG_MODE $START_WITH_ETH

DESTINATION = sys.argv[2]
if (DESTINATION[-1] != '/'):
DESTINATION += '/'

make_template(data, DESTINATION+local_name+".py")

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.