---
# System prepended metadata

title: Untitled

---

**Instalação do compilador P4 / bmv2 / Stratum / Docker
OS:** Linux Xubuntu & Ubuntu (18.04LTS)

**Hardware:** 
Processor: Intel (R) Celeron (R) CPU N3050 @ 1.60GHz
Architecture: amd64 - Memory: 4GB - HD SSD: 30GB

**Objetivo:**
Preparar um ambiente de desenvolvimento para programação de NIC (Ethernet / Wi-Fi)
<br>
**Repositórios:**
sudo add-apt-repository ppa:frederic-loui/p4lang-3rd-party
sudo add-apt-repository ppa:frederic-loui/p4lang-master-bionic-nightly
<br>
**Atualização do sistema & Instalação de pacotes**
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install p4c bmv2 p4lang-3rd-party scapy -y
<br>
**Verificando instalação:**
dpkg -l | grep p4lang
<br>
**Retorno do comando:**
root@t430:~# dpkg -l | grep p4lang
ii  bmv2                                       1.13.0-202012050317-4b9a2ec~ubuntu18.04.1        amd64        p4lang behavioral-model
ii  p4c                                        1.1.0-rc1-202104060403-ca4915d41~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-202102050217-c65fe2e~ubuntu18.04.1           amd64        Implementation framework of a P4Runtime server
<br>
**Instalação do Stratum no container Docker**

**Atualização do sistema e pacotes**
sudo apt upgrade && apt upgrade -y && apt autoremove -y
<br>
**Instalação do Docker e verificação do serviço**
sudo apt install docker.io -y && systemctl status docker
<br>
**Retorno do comando: systemctl status docker**
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2021-05-02 18:26:01 -03; 39min ago
     Docs: https://docs.docker.com
 Main PID: 1396 (dockerd)
    Tasks: 10
   CGroup: /system.slice/docker.service
           └─1396 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

mai 02 18:26:00 feec dockerd[1396]: time="2021-05-02T18:26:00.384152512-03:00" level=warning msg="Your kernel does not support CPU realtime sc
mai 02 18:26:00 feec dockerd[1396]: time="2021-05-02T18:26:00.384193400-03:00" level=warning msg="Your kernel does not support cgroup blkio we
mai 02 18:26:00 feec dockerd[1396]: time="2021-05-02T18:26:00.384232300-03:00" level=warning msg="Your kernel does not support cgroup blkio we
mai 02 18:26:00 feec dockerd[1396]: time="2021-05-02T18:26:00.385020800-03:00" level=info msg="Loading containers: start."
mai 02 18:26:01 feec dockerd[1396]: time="2021-05-02T18:26:01.318256437-03:00" level=info msg="Default bridge (docker0) is assigned with an IP
mai 02 18:26:01 feec dockerd[1396]: time="2021-05-02T18:26:01.692582075-03:00" level=info msg="Loading containers: done."
mai 02 18:26:01 feec dockerd[1396]: time="2021-05-02T18:26:01.771059087-03:00" level=info msg="Docker daemon" commit="20.10.2-0ubuntu1~18.04.2
mai 02 18:26:01 feec dockerd[1396]: time="2021-05-02T18:26:01.776305550-03:00" level=info msg="Daemon has completed initialization"
mai 02 18:26:01 feec systemd[1]: Started Docker Application Container Engine.
mai 02 18:26:01 feec dockerd[1396]: time="2021-05-02T18:26:01.909884700-03:00" level=info msg="API listen on /var/run/docker.sock"
<br>
**Instalação do Stratum**
cd /home && docker pull stratumproject/stratum-bcm:sdklt
git clone https://github.com/stratum/stratum.git
<br>
#--Procedimento para corrigir erros de permissão
sudo usermod -aG docker ${USER}
su - ${USER}
<br>
**Procedimento de instalação do Stratum**
cd /home/stratum/
./setup_dev_env.sh
bazel build //stratum/hal/bin/bcm/standalone:stratum_bcm_sdklt_deb 
<br>
**Verificação da imagens e processo do Docker com o Stratum**
docker images && docker ps -a
<br>
**Retorno dos comandos: docker images && docker ps -a**
REPOSITORY                   TAG       IMAGE ID       CREATED        SIZE
stratum-dev                  latest    bbff94b6b445   43 hours ago   2.19GB
stratumproject/build         build     1692722f8265   45 hours ago   2.18GB
stratumproject/stratum-bcm   sdklt     efac4591d8a6   45 hours ago   148MB
CONTAINER ID   IMAGE          COMMAND              CREATED        STATUS                    PORTS     NAMES
d1296f40d543   efac4591d8a6   "start-stratum.sh"   44 hours ago   Exited (1) 44 hours ago             charming_swanson
#
**Fontes:**
https://wiki.geant.org/pages/viewpage.action?pageId=148087125
https://github.com/stratum/stratum/blob/main/stratum/hal/bin/bcm/standalone/README.md
https://p4.org/p4/getting-started-with-p4.html
https://www.youtube.com/watch?v=XfZvKLNXC9M
#
**Autores:**

Alan Teixeira da Silva
E-mail: a265560@dac.unicamp.br

Fernando Henrique Santorsula
E-mail: f208918@dac.unicamp.br

**FEEC/UNICAMP - Campinas/SP/BR**
https://www.fee.unicamp.br/



















