Sonic-P4 is a software switch that uses P4 to emulate an ASIC data plane. It runs SONiC as the control plane and programs a P4-emulated switch using SAI.P4. The document describes setting up a topology with two Sonic switches connected to two hosts and configuring the switches through startup scripts, port mappings, and BGP settings.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
207 views7 pages
Sonic p4 Software Switch
Sonic-P4 is a software switch that uses P4 to emulate an ASIC data plane. It runs SONiC as the control plane and programs a P4-emulated switch using SAI.P4. The document describes setting up a topology with two Sonic switches connected to two hosts and configuring the switches through startup scripts, port mappings, and BGP settings.
switch1 (SONiC) 192.168.2.2/24) Start.sh-set up the topology sudo docker run --net=none --privileged --entrypoint /bin/bash --name switch1 -it -d -v $PWD/switch1:/sonic docker-sonic-p4:latest
--net=none prevent docker engine from adding its docker0 interface
--privileged enable each container to configure their own interfaces -v $PWD/switch1:/sonic mounts the configuration folder into the switch containers sudo ovs-vsctl add-br switch1_switch2 sudo ovs-docker add-port switch1_switch2 eth1 switch1 sudo ovs-docker add-port switch1_switch2 eth1 switch2 Start.sh-set up the topology sudo docker exec -d host1 ifconfig eth1 192.168.1.2/24 mtu 1400 sudo docker exec -d host1 ip route replace default via 192.168.1.1
configure the interface IP and default routes on the host1 and host2
sudo docker exec -d switch1 sh /sonic/scripts/startup.sh
sudo docker exec -d switch2 sh /sonic/scripts/startup.sh
invoke the startup script for switch1 and switch2
Important SONiC-P4 configuration • AT STARTUP.SH,PORT_CONFIG.INI AND BGPD.CONF
• STARTUP.SH : START ALL SONIC SERVICES AND A P4 SOFTWARE SWITCH