Giter Site home page Giter Site logo

mrgaoxx / tutorials Goto Github PK

View Code? Open in Web Editor NEW

This project forked from p4lang/tutorials

0.0 1.0 0.0 47.16 MB

P4 language tutorials

License: Apache License 2.0

Shell 6.89% Python 41.25% P4 42.73% Emacs Lisp 4.22% Makefile 0.55% TeX 1.84% Vim Script 2.51%

tutorials's Introduction

P4 Tutorial

If you are reading this while not attending a live P4 tutorial class, see below for links to information about recently given live classes.

Introduction

Welcome to the P4 Tutorial! We've prepared a set of exercises to help you get started with P4 programming, organized into several modules:

  1. Introduction and Language Basics
  1. P4Runtime and the Control Plane
  1. Monitoring and Debugging
  1. Advanced Behavior
  1. Stateful Packet Processing

Presentation

The slides are available online and in the P4_tutorial.pdf in the tutorial directory.

A P4 Cheat Sheet is also available online which contains various examples that you can refer to.

P4 Documentation

The documentation for P4_16 and P4Runtime is available here

All excercises in this repository use the v1model architecture, the documentation for which is available at:

  1. The BMv2 Simple Switch target document accessible here talks mainly about the v1model architecture.
  2. The include file v1model.p4 has extensive comments and can be accessed here.

Obtaining required software

If you are starting this tutorial at one of the proctored tutorial events, then we've already provided you with a virtual machine that has all of the required software installed. Ask an instructor for a USB stick with the VM image.

Otherwise, to complete the exercises, you will need to either build a virtual machine or install several dependencies.

To build the virtual machine:

  • Install Vagrant and VirtualBox
  • Clone the repository
  • Before proceeding, ensure that your system has at least 25 Gbytes of free disk space, otherwise the installation can fail in unpredictable ways.
  • cd vm-ubuntu-20.04
  • vagrant up - This step typically takes over 1 hour to complete, and requires a reliable Internet connection throughout.
  • When the machine reboots, you should have a graphical desktop machine with the required software pre-installed. There are two user accounts on the VM, vagrant (password vagrant) and p4 (password p4). The account p4 is the one you are expected to use.

Note: Before running the vagrant up command, make sure you have enabled virtualization in your environment; otherwise you may get a "VT-x is disabled in the BIOS for both all CPU modes" error. Check this for enabling it in virtualbox and/or BIOS for different system configurations.

You will need the script to execute to completion before you can see the p4 login on your virtual machine's GUI. In some cases, the vagrant up command brings up only the default vagrant login with the password vagrant. Dependencies may or may not have been installed for you to proceed with running P4 programs. Please refer the existing issues to help fix your problem or create a new one if your specific problem isn't addressed there.

To install dependencies by hand, please reference the vm-ubuntu-20.04 installation scripts. They contain the dependencies, versions, and installation procedure. You should be able to run them directly on an Ubuntu 16.04 machine:

  • sudo ./root-bootstrap.sh
  • sudo ./user-bootstrap.sh

Older tutorials

Multiple live tutorial classes have been given using the example code in this repository for hands-on exercises. For example, there is one each April or May at the P4 workshop at Stanford University in California, and there have been several at networking conferences such as ACM SIGCOMM.

Please create an issue for this tutorials repository if you know a public link for classroom video recordings and/or pre-built VM images that currently do not have such a link.

ACM SIGCOMM August 2019 Tutorial on Programming the Network Data Plane

https://p4.org/events/2019-08-23-p4-tutorial/

The page linked above has a link to download a pre-built VM image used for this class, as well as instructions to build one yourself from a particular branch of this repository.

P4 Developer Day, April 2019

https://p4.org/events/2019-04-30-p4-developer-day/

Both a beginner and advanced class were taught at this event. The page linked above contains instructions to download and install a pre-built Linux VM that was used during the classes.

P4 Developer Day, November 2017

  • YouTube videos
    • This link plays the first welcome video of a series of 6 videos of tutorials given at this event.

tutorials's People

Contributors

antoninbas avatar jafingerhut avatar jnfoster avatar sibanez12 avatar bocon13 avatar robertsoule avatar robertsoule-barefoot avatar ccascone avatar minmit avatar seanschoi avatar prvnkumar avatar theojepsen avatar robh2 avatar alex1230608 avatar khooi8913 avatar tudang avatar robertmacdavid avatar liujed avatar pranagupt avatar nonylene avatar nikkytub avatar changgang-zheng avatar yardenshoham avatar rst0git avatar riftadi avatar matt-telstra avatar jklr avatar irevoire avatar harshgondaliya avatar hanw avatar

Watchers

James Cloos 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.