0% 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.

Uploaded by

Brian Chang
Copyright
© © All Rights Reserved
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% 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.

Uploaded by

Brian Chang
Copyright
© © All Rights Reserved
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
You are on page 1/ 7

SONIC-P4 SOFTWARE SWITCH

BRIAN CHANG
YUKINARI HE
What is sonic-P4 software switch?
Sonic-p4 software switch

SONiC network Control Plane

P4-emulated software switch ASIC Data Plane


Programmed by SAI.P4
Topology

host1 (Ubuntu, 192.168.1.2/24) <--> switch2 (SONiC) <--> host2 (Ubuntu,


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


• SIMPLE_SWITCH --LOG-CONSOLE -I 1@ETH1 -I 2@ETH2 …

• THE MAPPING BETWEEN HOST INTERFACES AND SWITCH PORTS IS SPECIFIED IN


PORT_CONFIG.INI:
• # ALIAS LANES
ETHERNET0 1
ETHERNET1 2 ...
Important SONiC-P4 configuration
• BGPD.CONF CONFIGURES THE BGP SESSION ON THE SWITCH.
• ROUTER BGP 10001 BGP
ROUTER-ID 192.168.1.1
NETWORK 192.168.1.0 MASK 255.255.255.0
NEIGHBOR 10.0.0.1 REMOTE-AS 10002
NEIGHBOR 10.0.0.1 TIMERS 1 3
NEIGHBOR 10.0.0.1 SEND-COMMUNITY
NEIGHBOR 10.0.0.1 ALLOWAS-IN
MAXIMUM-PATHS 64
!
ACCESS-LIST ALL PERMIT ANY

You might also like