Giter Club home page Giter Club logo

p4-exercises's Introduction

P4 Assignment

This assignment will help you get familiar with some of the main concepts and constructs of the P4 programming language.

Obtaining required software

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

To build the virtual machine:

  • Install VirtualBox

    Apple Silicon Users: Follow this guide

  • Install Vagrant
  • Clone the repository
  • Before proceeding, ensure that your system has at least 12 Gbytes of free disk space, otherwise the installation can fail in unpredictable ways.
  • cd vm-ubuntu-20.04
  • vagrant up - The time for this step to complete depends upon your computer and Internet access speeds, but for example with a 2015 MacBook pro and 50 Mbps download speed, it took a little less than 20 minutes. It requires a reliable Internet connection throughout the entire process.
  • 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.
  • Clone this repository in $HOME.

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.

If you need to install dependencies by hand, please contact the instructor as soon as possible.

Warm-up: Forwarding

In the forwarding folder, you will find an example of implementing destination-based IPv4 forwarding on a network topology that we will use in this assignment. You do not need to add anything to the code in this folder. Simply run the instructions in its README file to get familiar with the topology and the different pieces of software that work together to emulate and program the network.

The Assignment: Filtering suspicious traffic

In the filter folder, you will see instructions on how to extend the forwarding functionality to detect and mark suspicious packets. To submit the assignment, email your filter.p4 and mycontroller.py files to the instructor.

P4 Documentation and Extra Resources

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.

There are also some slides from a P4 tutorial event and a P4 Cheat Sheet in the repository that you can feel free to refer to as your are completing the assignment.

p4-exercises's People

Contributors

seyhani avatar minmit 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.