Giter Site home page Giter Site logo

p4-tutorial's Introduction

P4 tutorial

This tutorial is based on a number of tools developed as part of the P4 foundation and the NGSDN tutorial repos.

The tutorial consists of two task:

  • Basic Forwarding with P4: this tutorial will allow you to exercise your P4 language knowledge and understand some key characteristics of the language.
  • P4 network calculator: This tutorial will get you to work with the control plane of the P4 language.

Before progressing to the details, you need first to install a couple of additional Python package for the GRPC control channel. Simply type make install on any of the tutorial folder.

Toolchain

The tooling for this tutorial will be based on Docker images maintained by the P4 foundation. We will will basically utilize two main docker containers. The p4c container contains all the compiler binaries, required to compile P4 programs. In this tutorial we will be using the open-soruce P4C compiler, maintained by the P4 foundation. The stratum_bmv2 conrtainer contains a modified version of the Mininet framework and add support for the P4 Behavioural Model v2 switch, a reference implementation of the P4 switch specifications.

In order to simplify the P4 development, we provide you with a Makefile that automates some several tasks. The action that you can execute are:

  • make p4-build: This action will compile the file p4src/main.p4 in the respective exercise window and generate the required switch pipeline files in the folder p4src/build, i.e., the p4src/build/bmv2.json (The specification file for the switch), and ithep4src/build/p4info.txt (Required to generate the p4 bindinds., and p4src/build/p4info.txt ()) files.
  • make proto-build: Generate the python bindings to run a GRPC client that can connect to the P4 switch. The binding are required to run the util/simple_controller.py, a Python executable that allows you to inject custom flows into a running P4 switch.
  • make start, make stop, make restart: You can use these Makefile actions to control the mininet network.
  • make mn-cli: This action will open a mininet terminal so that you can run mininet commands. In order to exit from the terminal, you should use the shortcut Ctrl+D. If you type exit, this will stop the whole Mininet instance and you will have to restart.
  • make mn-logs: This action will display the mininet log. This is only for debugging purposses.

Next steps ...

Now that you became familiar with the toolchain of this tutorial you can start working on the first exercise. Just open the exercise1/README.md to figure out what you have to.

p4-tutorial's People

Contributors

crotsos avatar

Watchers

 avatar Eleanor Davies 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.