Skip to content

SONiC P4 Software Switch

Lihua Yuan edited this page Mar 2, 2017 · 27 revisions

#What is SONiC-P4 Software Switch

SONiC-P4 is a software switch that runs on the P4-emulated software switch ASIC developed by Barefoot. It uses the SAI.P4 to program the P4-emulated switch ASIC to emulate the data plane behavior. Other than that, it runs the real SONiC network stack. The current SONiC-P4 is released as a docker image. You can run it anywhere that docker runs -- inside a bare-metal Linux/Windows machine, inside your favorite virtual machine, or inside your favorite cloud environment. However, because of this choice, we build the various SONiC modules in a single docker image, instead of having them as their own docker image. We find this a very useful tool for developing and testing upper layer features.

#How to use SONiC-P4 Software Switch

  1. You can find the newest SONiC-P4 software switch image by going to our build server, download the "docker-sonic-p4.gz"

  2. In the following, we explain the usage of SONiC-P4 software switch with a very simple testbed.

Topology: host1 (Ubuntu, 192.168.1.2/24) <--> test1 (sonic) <--> test2 (sonic) <--> host2 (Ubuntu, 192.168.2.2/24)

Test1 and test2 are two SONiC-P4 switches in two different BGP AS, peering with each other. Test1 announces 192.168.1.0/24, test2 announces 192.168.2.0/24

The scripts assume you are on a common Ubuntu server. Go to the uncompressed folder, first run ./install_docker_ovs.sh, if you don’t have docker or open-vswitch installed.

Then run ./start.sh to setup everything. After ~30 seconds bootup time, you can run ./test.sh, and see host1 can ping host2

To clean everything, run ./stop.sh

You can download the necessary files [here](files\SONiC-P4\SONiC-P4.Test.tar.gz) 
Clone this wiki locally