-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[virtualswitch]: build docker-sonic-vs docker based on SAI virtual sw…
…itch (#1065)
- Loading branch information
Showing
16 changed files
with
404 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
HOWTO Use Virtual Switch | ||
|
||
|
||
1. Create a docker with 32 front panel port | ||
|
||
``` | ||
docker run -id --name sw debian bash | ||
sudo ./create_vnet.sh sw | ||
``` | ||
|
||
2. Create sonic virtual switch docker | ||
|
||
``` | ||
docker run --privileged --network container:sw -d docker-sonic-vs | ||
``` | ||
|
||
3. Run test in virtual switch docker (TBD) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
|
||
SWNAME=$1 | ||
|
||
pid=$(docker inspect --format '{{.State.Pid}}' $SWNAME) | ||
|
||
echo Seting up servers | ||
|
||
SERVERS=31 | ||
|
||
for srv in `seq 0 $SERVERS`; do | ||
|
||
SRV="$SWNAME-srv$srv" | ||
|
||
NSS="ip netns exec $SRV" | ||
|
||
ip netns add $SRV | ||
|
||
$NSS ip addr add 127.0.0.1/8 dev lo | ||
$NSS ip addr add ::1/128 dev lo | ||
$NSS ip link set dev lo up | ||
|
||
# add virtual link between neighbor and the virtual switch docker | ||
|
||
IF="vEthernet$((srv*4))" | ||
|
||
ip link add ${SRV}eth0 type veth peer name $IF | ||
ip link set ${SRV}eth0 netns $SRV | ||
ip link set $IF netns ${pid} | ||
|
||
echo "Bring ${SRV}eth0 up" | ||
$NSS ip link set dev ${SRV}eth0 name eth0 | ||
$NSS ip link set dev eth0 up | ||
|
||
echo "Bring $IF up in the virtual switch docker" | ||
nsenter -t $pid -n ip link set dev $IF up | ||
|
||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# docker image for virtual switch based sonic docker image | ||
|
||
DOCKER_SONIC_VS = docker-sonic-vs.gz | ||
$(DOCKER_SONIC_VS)_PATH = $(PLATFORM_PATH)/docker-sonic-vs | ||
$(DOCKER_SONIC_VS)_DEPENDS += $(SWSS) $(SYNCD_VS) $(REDIS_SERVER) $(REDIS_TOOLS) $(LIBTEAMDCT) $(LIBTEAM_UTILS) $(SONIC_DEVICE_DATA) | ||
|
||
ifeq ($(SONIC_ROUTING_STACK), quagga) | ||
$(DOCKER_SONIC_VS)_DEPENDS += $(QUAGGA) | ||
else ifeq ($(SONIC_ROUTING_STACK), frr) | ||
$(DOCKER_SONIC_VS)_DEPENDS += $(FRR) | ||
else | ||
$(DOCKER_SONIC_VS)_DEPENDS += $(GOBGP) | ||
endif | ||
|
||
$(DOCKER_SONIC_VS)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) | ||
SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_VS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Default rules for rsyslog. | ||
# | ||
# For more information see rsyslog.conf(5) and /etc/rsyslog.conf | ||
|
||
# | ||
# First some standard log files. Log by facility. | ||
# | ||
auth,authpriv.* /var/log/auth.log | ||
*.*;auth,authpriv.none -/var/log/syslog | ||
#cron.* /var/log/cron.log | ||
#daemon.* -/var/log/daemon.log | ||
kern.* -/var/log/kern.log | ||
#lpr.* -/var/log/lpr.log | ||
mail.* -/var/log/mail.log | ||
#user.* -/var/log/user.log | ||
|
||
# | ||
# Logging for the mail system. Split it up so that | ||
# it is easy to write scripts to parse these files. | ||
# | ||
#mail.info -/var/log/mail.info | ||
#mail.warn -/var/log/mail.warn | ||
mail.err /var/log/mail.err | ||
|
||
# | ||
# Logging for INN news system. | ||
# | ||
news.crit /var/log/news/news.crit | ||
news.err /var/log/news/news.err | ||
news.notice -/var/log/news/news.notice | ||
|
||
# | ||
# Some "catch-all" log files. | ||
# | ||
#*.=debug;\ | ||
# auth,authpriv.none;\ | ||
# news.none;mail.none -/var/log/debug | ||
#*.=info;*.=notice;*.=warn;\ | ||
# auth,authpriv.none;\ | ||
# cron,daemon.none;\ | ||
# mail,news.none -/var/log/messages | ||
|
||
# | ||
# Emergencies are sent to everybody logged in. | ||
# | ||
*.emerg :omusrmsg:* | ||
|
||
# | ||
# I like to have messages displayed on the console, but only on a virtual | ||
# console I usually leave idle. | ||
# | ||
#daemon,mail.*;\ | ||
# news.=crit;news.=err;news.=notice;\ | ||
# *.=debug;*.=info;\ | ||
# *.=notice;*.=warn /dev/tty8 | ||
|
||
# The named pipe /dev/xconsole is for the `xconsole' utility. To use it, | ||
# you must invoke `xconsole' with the `-file' option: | ||
# | ||
# $ xconsole -file /dev/xconsole [...] | ||
# | ||
# NOTE: adjust the list below, or you'll go crazy if you have a reasonably | ||
# busy site.. | ||
# | ||
daemon.*;mail.*;\ | ||
news.err;\ | ||
*.=debug;*.=info;\ | ||
*.=notice;*.=warn |/dev/xconsole |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
FROM docker-config-engine | ||
|
||
## Make apt-get non-interactive | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update | ||
|
||
RUN apt-get install -y net-tools \ | ||
ethtool \ | ||
tcpdump \ | ||
ifupdown \ | ||
bridge-utils \ | ||
python-ply \ | ||
libqt5core5a \ | ||
libqt5network5 \ | ||
libboost-program-options1.55.0 \ | ||
libboost-system1.55.0 \ | ||
libboost-thread1.55.0 \ | ||
libgmp10 \ | ||
libjudydebian1 \ | ||
libnanomsg0 \ | ||
libdaemon0 \ | ||
libjansson4 \ | ||
libjemalloc1 \ | ||
openssh-client \ | ||
openssh-server \ | ||
libc-ares2 \ | ||
iproute | ||
|
||
COPY \ | ||
debs/libnl-route-3-200_3.2.27-1_amd64.deb debs/libnl-genl-3-200_3.2.27-1_amd64.deb debs/libnl-nf-3-200_3.2.27-1_amd64.deb debs/libhiredis0.13_0.13.3-2_amd64.deb debs/libnl-3-200_3.2.27-1_amd64.deb debs/libnl-cli-3-200_3.2.27-1_amd64.deb debs/libswsscommon_1.0.0_amd64.deb debs/libsairedis_1.0.0_amd64.deb debs/libsaimetadata_1.0.0_amd64.deb debs/libteam5_1.26-1_amd64.deb debs/libsaivs_1.0.0_amd64.deb debs/swss_1.0.0_amd64.deb debs/syncd-vs_1.0.0_amd64.deb debs/redis-server_3.2.4-1~bpo8+1_amd64.deb debs/redis-tools_3.2.4-1~bpo8+1_amd64.deb debs/libteamdctl0_1.26-1_amd64.deb debs/libteam-utils_1.26-1_amd64.deb debs/sonic-device-data_1.0-1_all.deb debs/quagga_0.99.24.1-2.1_amd64.deb debs/ | ||
|
||
RUN dpkg -i \ | ||
debs/libnl-route-3-200_3.2.27-1_amd64.deb debs/libnl-genl-3-200_3.2.27-1_amd64.deb debs/libnl-nf-3-200_3.2.27-1_amd64.deb debs/libhiredis0.13_0.13.3-2_amd64.deb debs/libnl-3-200_3.2.27-1_amd64.deb debs/libnl-cli-3-200_3.2.27-1_amd64.deb debs/libswsscommon_1.0.0_amd64.deb debs/libsairedis_1.0.0_amd64.deb debs/libsaimetadata_1.0.0_amd64.deb debs/libteam5_1.26-1_amd64.deb debs/libsaivs_1.0.0_amd64.deb debs/swss_1.0.0_amd64.deb debs/syncd-vs_1.0.0_amd64.deb debs/redis-server_3.2.4-1~bpo8+1_amd64.deb debs/redis-tools_3.2.4-1~bpo8+1_amd64.deb debs/libteamdctl0_1.26-1_amd64.deb debs/libteam-utils_1.26-1_amd64.deb debs/sonic-device-data_1.0-1_all.deb debs/quagga_0.99.24.1-2.1_amd64.deb | ||
|
||
## Clean up | ||
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y | ||
RUN rm -rf /debs | ||
|
||
RUN sed -ri 's/^daemonize yes$/daemonize no/; \ | ||
s/^logfile .*$/logfile ""/; \ | ||
s/^# syslog-enabled no$/syslog-enabled no/; \ | ||
s/^# unixsocket/unixsocket/ \ | ||
' /etc/redis/redis.conf | ||
|
||
COPY ["50-default.conf", "/etc/rsyslog.d/"] | ||
COPY ["start.sh", "orchagent.sh", "/usr/bin/"] | ||
COPY ["brcm.profile.ini", "/usr/share/sonic/device/vswitch/"] | ||
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] | ||
|
||
ENTRYPOINT ["/usr/bin/supervisord"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
FROM docker-config-engine | ||
|
||
## Make apt-get non-interactive | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update | ||
|
||
RUN apt-get install -y net-tools \ | ||
ethtool \ | ||
tcpdump \ | ||
ifupdown \ | ||
bridge-utils \ | ||
python-ply \ | ||
libqt5core5a \ | ||
libqt5network5 \ | ||
libboost-program-options1.55.0 \ | ||
libboost-system1.55.0 \ | ||
libboost-thread1.55.0 \ | ||
libgmp10 \ | ||
libjudydebian1 \ | ||
libnanomsg0 \ | ||
libdaemon0 \ | ||
libjansson4 \ | ||
libjemalloc1 \ | ||
openssh-client \ | ||
openssh-server \ | ||
libc-ares2 \ | ||
iproute | ||
|
||
COPY \ | ||
{% for deb in docker_sonic_vs_debs.split(' ') -%} | ||
debs/{{ deb }}{{' '}} | ||
{%- endfor -%} | ||
debs/ | ||
|
||
RUN dpkg -i \ | ||
{% for deb in docker_sonic_vs_debs.split(' ') -%} | ||
debs/{{ deb }}{{' '}} | ||
{%- endfor %} | ||
|
||
## Clean up | ||
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y | ||
RUN rm -rf /debs | ||
|
||
RUN sed -ri 's/^daemonize yes$/daemonize no/; \ | ||
s/^logfile .*$/logfile ""/; \ | ||
s/^# syslog-enabled no$/syslog-enabled no/; \ | ||
s/^# unixsocket/unixsocket/ \ | ||
' /etc/redis/redis.conf | ||
|
||
COPY ["50-default.conf", "/etc/rsyslog.d/"] | ||
COPY ["start.sh", "orchagent.sh", "/usr/bin/"] | ||
COPY ["brcm.profile.ini", "/usr/share/sonic/device/vswitch/"] | ||
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] | ||
|
||
ENTRYPOINT ["/usr/bin/supervisord"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
SAI_WARM_BOOT_READ_FILE=/var/cache/sai_warmboot.bin | ||
SAI_WARM_BOOT_WRITE_FILE=/var/cache/sai_warmboot.bin | ||
SAI_VS_SWITCH_TYPE=SAI_VS_SWITCH_TYPE_BCM56850 | ||
SAI_VS_HOSTIF_USE_TAP_DEVICE=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'` | ||
|
||
# Create a folder for SsWW record files | ||
mkdir -p /var/log/swss | ||
ORCHAGENT_ARGS="-d /var/log/swss " | ||
|
||
# Set orchagent pop batch size to 8192 | ||
ORCHAGENT_ARGS+="-b 8192 " | ||
|
||
# Set mac address | ||
ORCHAGENT_ARGS+="-m $MAC_ADDRESS" | ||
|
||
exec /usr/bin/orchagent ${ORCHAGENT_ARGS} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env bash | ||
|
||
mkdir -p /etc/swss/config.d/ | ||
|
||
# sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/ipinip.json.j2 > /etc/swss/config.d/ipinip.json | ||
# sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/mirror.json.j2 > /etc/swss/config.d/mirror.json | ||
# sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/ports.json.j2 > /etc/swss/config.d/ports.json | ||
|
||
# export platform=`sonic-cfggen -v platform` | ||
|
||
rm -f /var/run/rsyslogd.pid | ||
|
||
supervisorctl start rsyslogd | ||
|
||
mkdir -p /var/run/redis | ||
|
||
supervisorctl start redis-server | ||
|
||
supervisorctl start syncd | ||
|
||
supervisorctl start orchagent | ||
|
||
supervisorctl start portsyncd | ||
|
||
supervisorctl start intfsyncd | ||
|
||
supervisorctl start neighsyncd | ||
|
||
# Start arp_update when VLAN exists | ||
# VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` | ||
# if [ "$VLAN" != "" ]; then | ||
# supervisorctl start arp_update | ||
# fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
[supervisord] | ||
logfile_maxbytes=1MB | ||
logfile_backups=2 | ||
nodaemon=true | ||
|
||
[program:start.sh] | ||
command=/usr/bin/start.sh | ||
priority=1 | ||
autostart=true | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
|
||
[program:rsyslogd] | ||
command=/usr/sbin/rsyslogd -n | ||
priority=2 | ||
autostart=false | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
|
||
[program:redis-server] | ||
command=/usr/bin/redis-server /etc/redis/redis.conf | ||
priority=3 | ||
autostart=false | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
|
||
[program:syncd] | ||
command=/usr/bin/syncd -uN -p /usr/share/sonic/device/vswitch/brcm.profile.ini | ||
priority=4 | ||
autostart=false | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
|
||
[program:orchagent] | ||
command=/usr/bin/orchagent.sh | ||
priority=5 | ||
autostart=false | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
|
||
[program:portsyncd] | ||
command=/usr/bin/portsyncd -p /usr/share/sonic/device/x86_64-dell_s6000_s1220-r0/Force10-S6000/port_config.ini | ||
priority=6 | ||
autostart=false | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
|
||
[program:intfsyncd] | ||
command=/usr/bin/intfsyncd | ||
priority=7 | ||
autostart=false | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
|
||
[program:neighsyncd] | ||
command=/usr/bin/neighsyncd | ||
priority=8 | ||
autostart=false | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
include $(PLATFORM_PATH)/syncd-vs.mk | ||
include $(PLATFORM_PATH)/docker-sonic-vs.mk | ||
|
||
SONIC_ALL += $(DOCKER_SONIC_VS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
$(LIBSAIREDIS)_DPKG_TARGET = binary-syncd-vs | ||
|
||
# inject libsaivs and libsaivs_dev to swss build dependency | ||
$(SWSS)_DEPENDS += $(LIBSAIVS) $(LIBSAIVS_DEV) | ||
|
||
SYNCD_VS = syncd-vs_1.0.0_amd64.deb | ||
$(SYNCD_VS)_RDEPENDS += $(LIBSAIREDIS) $(LIBSAIMETADATA) $(LIBSAIVS) | ||
$(eval $(call add_derived_package,$(LIBSAIREDIS),$(SYNCD_VS))) | ||
|
||
SYNCD_VS_DBG = syncd-vs-dbg_1.0.0_amd64.deb | ||
$(SYNCD_VS_DBG)_DEPENDS += $(SYNCD_VS) | ||
$(SYNCD_VS_DBG)_RDEPENDS += $(SYNCD_VS) | ||
$(eval $(call add_derived_package,$(LIBSAIREDIS),$(SYNCD_VS_DBG))) |
Oops, something went wrong.