Giter VIP home page Giter VIP logo

p4factory's Introduction

P4 Model Repository

This repository maintains a sample set of the P4 programs and allows building P4 for the P4 Behavioral Model.

Quickstart

To install all the Ubuntu 14.04 dependencies, run

./install.sh

Before running the simulator, you need to create veth interfaces that the simulator can connect to. To create them, you need to run:

sudo p4factory/tools/veth_setup.sh

To validate you installation and test the simulator on a simple P4 target, do the following:

cd p4factory/targets/basic_routing/  
make bm  
sudo ./behavioral_model  

To run a simple test, run this in a different terminal:

cd p4factory/targets/basic_routing/  
sudo python run_tests.py --test-dir of-tests/tests/  

Mininet Integration

We provide a Mininet integration for one of our existing targets: simple_router

To run it, do the following:

cd p4factory/targets/simple_router/  
make bm  
./run_demo.bash  

To install some table entries, run in a different terminal:

./run_add_demo_entries.bash  

You can then type commands in the Mininet CLI:

mininet> h1 ping h2

Building and Running a Target

Each targeted P4 program is set up in a directory under targets/. Inside the target directory is a Makefile with the instructions on how to build the behavioral model for that P4 program.

To build the target "project_name":

cd targets/project_name
make bm

This should result in an executable in the same directory called "behavioral_mode"

Creating a New Target

To add a new target, cd to targets/ and run:

p4factory/tools/newtarget.py project_name

where project_name is the name of the P4 program (without the .p4 extension). This will create a new directory in targets/ called project_name/, set it up to build the behavioral model, and create a template for the P4 program there named project_name.p4. Then, edit that file or copy your P4 program to that file and make in that directory.

P4 Dependency Graph Generator

The relationships between tables of more complex P4 program can be difficult to comprehend. The p4c-graphs utility parses through the the P4 program and generates a dependency graph using graphviz. The dependency graph can be generated with the following command:

p4c-graphs <p4 code>

The resulting files can be viewed using xdot or with a PNG viewer.

p4factory's People

Contributors

antoninbas avatar

Watchers

James Cloos avatar Guohan Lu avatar  avatar

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.