How to install and run Open P4 Studio on Edgecore Wedge100BF-32QS with Ubuntu 20.04?

[stordis-toc]

Requirements and preparation

  • Memory CPU, and Disk Space Recommendations

    The recommended minimum system sizing is:
     CPU: x86-64 Memory: 4G
     Free Disk Space: 60GB
     
  • Network Requirements

    The installation requires an active Internet connection with access to external sites to install dependencies for third-party packages, including a few common utilities such as Git and Python, and open source dependencies. The overall installation time thus depends both on the system performance, and the speed of the Internet connection.

    *Recommended minimum: 10 Mbps Internet connection
     
  • sudo Requirement

    Commands used in the build process may require sudo access to be executed. We recommend setting up sudo to not require a password. Otherwise the build will pause when a sudo password is needed.

The requirements and preparation for installation is the same as Install Open P4 Studio Software on Edgecore Wedge100BF-32QS.

Prepare your operating system for Open P4 Studio installation

Step 1: Check Current Netplan Configuration

sudo cat /etc/netplan/01-netcfg.yaml


Step 2: Fix Netplan Configuration

Edit the netplan file and ensure proper YAML syntax:

sudo nano /etc/netplan/01-netcfg.yaml

Configure with proper indentation (spaces, not tabs):

network:
 version: 2
 ethernets:
   enp2s0:
     dhcp4: true
   enx020000000002:
     dhcp4: no
     dhcp6: no
     addresses: ['fe80::2/64']
     accept-ra: no

Step 3: Configure BMC Interface Rules

Create new ones for the correct interface:

# Create rule for the correct interface
printf 'KERNEL=="enx020000000002", RUN+="/sbin/ip link set %%k txqueuelen 64"' | sudo tee /etc/udev/rules.d/HCT-enx020000000002-tx_queue_len.rules > /dev/null
# Reload udev rules
sudo udevadm control --reload-rules
sudo udevadm trigger

Step 4: Apply Netplan Configuration

sudo netplan apply

Step 5: Activate BMC Interface

# Bring up the interface
sudo ip link set enx020000000002 up
# Check interface status
ip addr show enx020000000002

Step 6: System Update

sudo apt-get update && sudo apt-get -y upgrade

Step 7: Install Required Packages

sudo apt-get install -y git gdb expect p7zip-full nmap netsniff-ng libvirt-clients language-pack-en

Step 8: Configure System Language

sudo locale-gen en_US.UTF-8
sudo update-locale LANG=en_US.UTF-8

Quick setup Open P4 Studio Software on Ubuntu 20.04.6

Step 1: Download BSP and Open-P4studio files.

In your home directory, e.g. ubuntu, place the downloaded BSP file then unzip it and download open-p4studio

scp bf-reference-bsp-9.13.4.tgz username@host_ip:/home/ubuntu
ls
bf-reference-bsp-9.13.4.tgz
sudo su
git clone https://github.com/p4lang/open-p4studio.git
tar -xf bf-reference-bsp-9.13.4.tgz
cd bf-reference-bsp-9.13.4/packages/
tar -xf bf-platforms-9.13.4.tgz
cp bf-platforms-9.13.4.tgz /home/ubuntu/
mv bf-platforms-9.13.4 /home/ubuntu/open-p4studio/pkgsrc/bf-platforms
cd /home/ubuntu/open-p4studio

Step 2: Run Installation Wizard

Launch the interactive installer:

./install.sh

Configuration selections:

 root@ubuntu:/home/ubuntu/open-p4studio# ./install.sh
 + realpath ./install.sh
 + readonly MY_PATH=/home/ubuntu/open-p4studio/install.sh
 + dirname /home/ubuntu/open-p4studio/install.sh
 + readonly MY_DIR=/home/ubuntu/open-p4studio
 + /home/ubuntu/open-p4studio/p4studio/p4studio interactive
 Checking system capabilities to build and install SDE:
  ✓ Free space >= 20GB: 1775.21GB
  ✓ Free space in /tmp >= 2.5GB: 1775.21GB
  ✓ OS is supported: Ubuntu 20.04
  ✓ Basic tools are installed: sudo ✓
   
 Default settings allow to run P4-16 examples for all tofino chip types on ASIC model.
 Do you want to install SDE using default settings (suitable for beginners)?: No
    Yes
  ➤ No
  
 Do you want to install missing third-party dependencies?: Yes
  ➤ Yes
     No
  
 Please select deployment target: Hardware
  ➤ Hardware
     ASIC Model
  
 Please select platform: montara/mavericks (tofino)
  ➤ montara/mavericks (tofino)
     newport (tofino2)
  
 Please provide the path to BSP: /home/ubuntu/bf-platforms-9.13.4.tgz
 Please provide path to kernel headers directory (or leave blank to autodetect):
 Please select components(p4 programs + corresponding control plane code) to build:
    ✓ P4 examples: P4-16
    ✓ P4 examples: P4-14
    ✓ switch-p4-16: x1_tofino
    ✗ switch-p4-16: x2_tofino
    ✗ switch-p4-16: x9_tofino
  ➤ ✗ bf-diags
  
 Do you want to configure advanced options?: Yes
  ➤ Yes
     No
  
 Advanced options configuration:
  ➤ ✗ tdi - Build with TDI support
     ✓ sai - Build switch-p4-16 SAI implementation
  
 Based on your selections the following SDE configuration profile was created:
  
 global-options:
   asic: true
 features:
   bf-platforms:
     bsp-path: /home/ubuntu/bf-platforms-9.13.4.tgz
   drivers:
     tdi: false
   p4-examples:
   - p4-16-programs
   - p4-14-programs
   switch:
     profile: x1_tofino
     sai: true
 architectures:
 - tofino
  
 Do you want to write it to a file for future use?: No
    Yes
  ➤ No
  
 Do you want to continue building SDE?: Yes
  ➤ Yes
     No

Step 3: Configure Environment Variables

Add P4 Studio environment variables to root's bashrc:

sudo su -
cat << 'EOF' >> /root/.bashrc

# P4 Studio Environment Variables
export SDE=/home/ubuntu/open-p4studio
export SDE_INSTALL=${SDE}/install
export BSP=${SDE}/bf-reference-bsp-9.13.4
export BSP_INSTALL=${SDE_INSTALL}
export PATH=${PATH}:${SDE_INSTALL}/bin:${HOME}/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${SDE_INSTALL}/lib

# Auto-load BF modules on login
$SDE_INSTALL/bin/bf_kdrv_mod_load $SDE_INSTALL 2>/dev/null || true

EOF
exit

Step 4: Run the Tofino Model

./run_switchd.sh -p switch

If everything goes well, you should see the following screen.

mceclip1.png

 

Congratulations!

You have successfully installed Open P4 Studio on Ubuntu 20.04.6. Your environment is now ready for P4 development and testing.

Happy programming! 

Useful links:

Open P4 Studio GitHub Repository

How to install NTP server in Ubuntu 24.04

How to Set Up RDP on Ubuntu 24.04 for Remote Access?

How to Set Up noVNC on Ubuntu 24.04 for Remote Access via Web Browser?

 

For more free resources, visit: https://stordis.com/free-resources/

 

 

Comments 0

Articles in this section