Code

The following software is available to the open source community to write and test P4 programs.

    • 1. Example P4 programs including a data-center switch definition.
    • 2. A P4 compiler to turn P4 programs into an executable software switch.
    • 3. An Environment to run the P4 software switch standalone or in Mininet.

The compiler generates a run-time API to make the switch easy to control. It also generates a Table Dependency Graph to guide the back end target-specific compiler. For example, you could use the P4 compiler as the front end for a different target switch (hardware or software), or you could create new debugging and verification tools for the ecosystem.

We hope this code inspires you and encourages you to contribute improvements and new tools.

All of the code described above is available on GitHub at github.com/p4lang under Apache 2.0 license.
If you plan to play with the sample P4 programs, build and run them, start with the p4factory repository.
If you plan to write a compiler back end for new targets, look at the p4-hlir repository. Start with the HLIRSpec.pdf document in the top level directory.
p4c-behavioral and p4c-graphs are examples of back ends for two different targets, a soft switch model and a table graph respectively.

Participate

Stay tuned for information on submitting patches. In the mean time please join and participate in discussions on the P4 Developer mailing list. Details below.

Please join the p4-dev email list to discuss this code release. Subscribe.