Managing the LOW-CBF P4 switches

The P4 switches used by LOW-CBF require the installation of a proprietary Software Development Environment (SDE). This SDE is used to:

  • Compile the P4 code from LOW.CBF

  • Interact with the P4 switch from the LOW.CBF TANGO devices

Initialising P4 switches

Before initialising P4 switches, make sure they are running Ubuntu 22.04 LTS.

Download P4 Studio

Before you can start installing the SDE on the P4 switches, you first have to obtain a copy of it. A license should already be procured as a part of SST-790. Assuming you have the necessary account details, download the SDE at the P4 Studio download page.

The download should contain the following tarballs:

  • bf-sde-<version>.tgz

  • bf-reference-bsp-<version>.tgz

These files are required to install the SDE on the P4 switches. The ska-low-clp-infrastructure-machinery repository is configured to load them from the resources/p4-sde directory, so make sure to copy them there.

Warning

Under no circumstances should the SDE ever be published anywhere public.

To prevent accidents, all files in the resources/p4-sde directory are ignored by Git. Still, please make sure you do not accidentally commit them!

Run the Ansible playbook

To perform the installation of the SDE, run the following make command:

make p4-init

This will perform the following on each P4 switch in the Ansible inventory:

  • Install required packages

  • Copy the SDE tarballs if they do not exist yet

  • Extract and compile the SDE on the switch

  • Install the compiled kernel modules

  • Reboot the switch

  • Install the switchd service

  • Checkout and compile the LOW-CBF P4 code

  • Start the switchd service

Note

Compiling the SDE will take a long time at first: between 1 and 3 hours. Subsequent compilations are a bit faster, somehwere around 10 minutes.

To speed up subsequent runs of the Ansible playbook, the SDE is only compiled once, and skipped if the playbook detects an existing installation.

It is possible to force a recompile of the SDE by passing P4_SDE_RECOMPILE=true to the make command.

After the Ansible playbook finishes, you can verify whether everything is installed correctly by connecting to a shell on the P4 switch and checking whether the switchd service is running:

sudo systemctl status switchd.service

Updating the LOW-CBF P4 code

To update the LOW-CBF P4 code used on the P4 switches, change the low_cbf_p4_code_ref variable in the inventory to point to the version you want to update to. Then, run the Ansible playbook with the following make command:

$ make p4-update-low-cbf

Note

Make sure that the new version of the P4 code is compatible with the current SDE version. If this is not the case, change the low_cbf_p4_sde_version variable in the inventory to point to the correct SDE version. Then, update the SDE and the P4 code by following Initialising P4 switches.