You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
Version 1
Current »
In P4Lang P4 for dummies [ #001 ], you learned that behavioural language offers you access to dataplane programming.
Requirement- Basic Linux/Unix knowledge
- Service provider networking knowledge
| |
Overview
In order to be able to start P4 programming, we will concretely start setting up a P4 development environment using Open Source P4Lang P4 community software.
Article objective
This article exposes how to install:
- P4Lang PI
- P4Lang BMv2
- P4Lang p4c
Diagram:
[ #002 ] - Cookbook
Install your favorite operating system
In our example we will use the same debian stable image (buster) installed as a VirtualBox VM
and we add a bridge network interface to or laptop RJ45 connection.
Install P4lang environment on Debian 10
deb https://download.opensuse.org/repositories/home:/frederic-loui:/p4lang:/p4c:/master/Debian_10/ ./
wget https://download.opensuse.org/repositories/home:/frederic-loui:/p4lang:/p4c:/master/Debian_10/Release.key
sudo apt-key add ./Release.key
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install p4c
Or install P4lang environment on Ubuntu 18.04
sudo add-apt-repository ppa:frederic-loui/p4lang-3rd-party
sudo apt-get update
sudo add-apt-repository ppa:frederic-loui/p4lang-master-bionic-nightly
sudo apt-get update
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install p4c bmv2 plang-pi
Or install P4lang environment on Ubuntu 20.04
sudo add-apt-repository ppa:frederic-loui/p4lang-3rd-party-focal
sudo apt-get update
sudo add-apt-repository ppa:frederic-loui/p4lang-master-focal-nightly
sudo apt-get update
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install p4c bmv2 plang-pi
Verification
RARE P4 code compilation
dpkg -l | grep p4lang
ii bmv2 20200615~d447b6a~release~nightly-0+57.1 amd64 p4lang behavioral-model
ii p4c 20200628~7c03f854~release~nightly-0 amd64 p4c p4lang project compiler
ii p4lang-pi 20200601~822a0d1~release~nightly-0+39.1 amd64 Implementation framework of a P4Runtime server
dpkg -l | grep p4lang
ii bmv2 1.13.0-202006160902-d447b6a~ubuntu18.04.1 amd64 p4lang behavioral-model
ii p4c 1.1.0-rc1-202006191103-3917a1c~ubuntu18.04.1 amd64 p4c p4lang project compiler
ii p4lang-3rd-party 1.1~bionic-1 all This package installs 3rd party software needed by p4lang software
ii p4lang-pi 0.8-202006020517-822a0d1~ubuntu18.04.1 amd64 Implementation framework of a P4Runtime server
cd ~/
git clone https://github.com/frederic-loui/RARE.git
cd ~/RARE/02-PE-labs/p4src
make build
mkdir -p ../build ../run/log
p4c --std p4-16 --target bmv2 --arch v1model \
-I ./ -o ../build --p4runtime-files ../build/router.txt router.p4
ls -l ./build/
total 572
-rw-r--r-- 1 root root 448313 Jul 22 10:15 router.json
-rw-r--r-- 1 root root 100912 Jul 22 10:15 router.p4i
-rw-r--r-- 1 root root 32764 Jul 22 10:15 router.txt
Conclusion
In this article you learned how to set up a P4 environment development
- Debian 10
- Ubuntu 18.04
- Ubuntu 20.04
And tested the installation by compiling RARE P4 code.