|
|
## Clone this repository into your machine
|
|
|
|
|
|
If you want to solve the exercises, run the examples or simply download the content get a local copy of this repository in your machine:
|
|
|
|
|
|
```bash
|
|
|
git clone https://github.com/nsg-ethz/p4-learning.git
|
|
|
```
|
|
|
|
|
|
We will periodically add new content to this repository (specially documentation and new examples), so make sure to check it regularly or `git pull` it from your machine.
|
|
|
|
|
|
|
|
|
## Required Software
|
|
|
|
|
|
In order to be able to compile P4 code, run it in a software switch (bmv2) and create virtual topologies with hosts, several dependencies and open source tools need to be installed first.
|
|
|
In order to be able to compile P4 code, run it in a software switch (provided by [BMv2](https://github.com/p4lang/behavioral-model)) and create virtual topologies with hosts, several dependencies and open source tools need to be installed first.
|
|
|
|
|
|
Since the installation process can be a bit tedious and cumbersome we provide you with a [Vagrant](https://www.vagrantup.com/intro/index.html) script that automatically builds a virtual machine with all required software already installed. You can find the VM setup instructions in the [P4 Virtual Machine Installation](vm/README.md) document.
|
|
|
|
|
|
> **Important**
|
|
|
> Some exercises or examples will only work (due to bug fixes) if you use the same version of `bmv2` and `p4c` that we provide. See the following [installation](./vm/bin/install-p4-tools.sh) script and use the same `commits`.
|
|
|
> Some exercises or examples will only work (due to bug fixes) if you use the same version of BMv2 and P4C that we provide. See the following [installation](https://github.com/nsg-ethz/p4-learning/blob/junota/vm/bin/install-p4-tools.sh) script and use the same `commits`.
|
|
|
|
|
|
### *P4-Utils*
|
|
|
|
|
|
To run the exercises and examples we use [*P4-Utils*](https://github.com/nsg-ethz/p4-utils), an extension to *Mininet* to support P4 devices. It was strongly inspired by the original [*p4app*](https://github.com/p4lang/p4app) from the [p4lang](https://github.com/p4lang) repository.
|
|
|
|
|
|
## Virtual Machine (VM)
|
|
|
|
|
|
If you build the VM from the vagrant script we provide or directly download the OVA package you will have *P4-Utils* already installed, however if you already have the required software and use your own machine/VM you can manally install it:
|
|
|
|
|
|
```bash
|
|
|
git clone https://github.com/nsg-ethz/p4-utils.git
|
|
|
cd p4-utils
|
... | ... | @@ -28,6 +33,7 @@ sudo ./install.sh |
|
|
```
|
|
|
|
|
|
To update you just simply run:
|
|
|
|
|
|
```bash
|
|
|
cd /home/p4/p4-tools/p4-utils
|
|
|
git pull
|
... | ... | |