[vs]: add vlan configuration support in virtual switch (#1200)

This commit is contained in:
lguohan 2017-11-30 14:59:25 -08:00 committed by GitHub
parent 73e4204521
commit b907e4e9f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 178 additions and 19 deletions

View File

@ -33,6 +33,6 @@ RUN sed -ri 's/^(save .*$)/# \1/g;
' /etc/redis/redis.conf
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["configdb-load.sh", "/usr/bin/"]
COPY ["files/configdb-load.sh", "/usr/bin/"]
ENTRYPOINT ["/usr/bin/supervisord"]

View File

@ -26,7 +26,8 @@ debs/{{ deb }}{{' '}}
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs
COPY ["arp_update", "start.sh", "orchagent.sh", "swssconfig.sh", "/usr/bin/"]
COPY ["files/arp_update", "/usr/bin"]
COPY ["start.sh", "orchagent.sh", "swssconfig.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
## Copy all Jinja2 template files into the templates folder

View File

@ -16,3 +16,4 @@ $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw
$(DOCKER_ORCHAGENT_BRCM)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel
$(DOCKER_ORCHAGENT_BRCM)_FILES += $(ARP_UPDATE_SCRIPT)

View File

@ -16,3 +16,4 @@ $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw
$(DOCKER_ORCHAGENT_CAVM)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel
$(DOCKER_ORCHAGENT_CAVM)_FILES += $(ARP_UPDATE_SCRIPT)

View File

@ -16,3 +16,4 @@ $(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw
$(DOCKER_ORCHAGENT_CENTEC)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel
$(DOCKER_ORCHAGENT_CENTEC)_FILES += $(ARP_UPDATE_SCRIPT)

View File

@ -15,3 +15,4 @@ $(DOCKER_ORCHAGENT_MRVL)_RUN_OPT += -v /host/machine.conf:/host/machine.conf
$(DOCKER_ORCHAGENT_MRVL)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
$(DOCKER_ORCHAGENT_MRVL)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel
$(DOCKER_ORCHAGENT_MRVL)_FILES += $(ARP_UPDATE_SCRIPT)

View File

@ -16,3 +16,4 @@ $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw
$(DOCKER_ORCHAGENT_MLNX)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel
$(DOCKER_ORCHAGENT_MLNX)_FILES += $(ARP_UPDATE_SCRIPT)

View File

@ -1,10 +1,10 @@
MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/564703412781016766b248b98266bd6f2c161431/sdk
MLNX_SDK_VERSION = 4.2.6011
MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2) $(SX_ACL_RM) $(SX_COMPLIB) \
MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_ACL_RM) $(SX_COMPLIB) \
$(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \
$(SXD_LIBS) $(TESTX)
MLNX_SDK_DEBS += $(APPLIBS_DEV) $(IPROUTE2_DEV) $(SX_ACL_RM_DEV) \
MLNX_SDK_DEBS += $(APPLIBS_DEV) $(IPROUTE2_MLNX_DEV) $(SX_ACL_RM_DEV) \
$(SX_COMPLIB_DEV) $(SX_COMPLIB_DEV_STATIC) $(SX_EXAMPLES_DEV) \
$(SX_GEN_UTILS_DEV) $(SX_SCEW_DEV) $(SX_SCEW_DEV_STATIC) \
$(SX_SDN_HAL_DEV) $(SX_SDN_HAL_DEV_STATIC) $(SXD_LIBS_DEV) \
@ -14,9 +14,9 @@ APPLIBS = applibs_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
$(APPLIBS)_DEPENDS += $(SX_COMPLIB) $(SX_GEN_UTILS) $(SXD_LIBS) $(LIBNL3) $(LIBNL_GENL3)
APPLIBS_DEV = applibs-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(APPLIBS),$(APPLIBS_DEV)))
IPROUTE2 = iproute2_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
IPROUTE2_DEV = iproute2-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(IPROUTE2),$(IPROUTE2_DEV)))
IPROUTE2_MLNX = iproute2_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
IPROUTE2_MLNX_DEV = iproute2-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(IPROUTE2_MLNX),$(IPROUTE2_MLNX_DEV)))
SX_COMPLIB = sx-complib_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
SX_COMPLIB_DEV = sx-complib-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(SX_COMPLIB),$(SX_COMPLIB_DEV)))

View File

@ -2,7 +2,16 @@
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) $(PYTHON_SWSSCOMMON) $(LIBTEAMDCT) $(LIBTEAM_UTILS) $(SONIC_DEVICE_DATA)
$(DOCKER_SONIC_VS)_DEPENDS += $(SWSS) \
$(SYNCD_VS) \
$(REDIS_SERVER) \
$(REDIS_TOOLS) \
$(PYTHON_SWSSCOMMON) \
$(LIBTEAMDCT) \
$(LIBTEAM_UTILS) \
$(SONIC_DEVICE_DATA) \
$(SONIC_UTILS) \
$(IPROUTE2)
ifeq ($(SONIC_ROUTING_STACK), quagga)
$(DOCKER_SONIC_VS)_DEPENDS += $(QUAGGA)
@ -12,5 +21,8 @@ else
$(DOCKER_SONIC_VS)_DEPENDS += $(GOBGP)
endif
$(DOCKER_SONIC_VS)_FILES += $(CONFIGDB_LOAD_SCRIPT) \
$(ARP_UPDATE_SCRIPT)
$(DOCKER_SONIC_VS)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE)
SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_VS)

View File

@ -3,9 +3,13 @@ FROM docker-config-engine
## Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive
COPY ["sonic-dev.gpg.key", "/etc/apt/"]
RUN apt-key add /etc/apt/sonic-dev.gpg.key
RUN echo "deb http://packages.microsoft.com/repos/sonic-dev/ jessie main" >> /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y net-tools \
arping \
ethtool \
tcpdump \
ifupdown \
@ -26,7 +30,15 @@ RUN apt-get install -y net-tools \
openssh-server \
libc-ares2 \
iproute \
libpython2.7
libpython2.7 \
grub2-common \
python-click-default-group \
python-click \
python-natsort \
python-tabulate \
bash-completion \
libelf1 \
libmnl0
RUN pip install setuptools
RUN pip install py2_ipaddress
@ -51,6 +63,7 @@ RUN sed -ri 's/^(save .*$)/# \1/g;
s/^logfile .*$/logfile ""/; \
s/^# syslog-enabled no$/syslog-enabled no/; \
s/^# unixsocket/unixsocket/; \
s/notify-keyspace-events ""/notify-keyspace-events AKE/; \
s/^client-output-buffer-limit pubsub [0-9]+mb [0-9]+mb [0-9]+/client-output-buffer-limit pubsub 0 0 0/ \
' /etc/redis/redis.conf
@ -58,7 +71,10 @@ 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/"]
COPY ["files/configdb-load.sh", "/usr/bin/"]
COPY ["files/arp_update", "/usr/bin"]
RUN echo "docker-sonic-vs" > /etc/hostname
RUN touch /etc/quagga/zebra.conf
ENTRYPOINT ["/usr/bin/supervisord"]

View File

@ -0,0 +1,30 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1
mQENBFQ1bTIBCAC7oGfkv/ck0XsLuG8cdcSB2ISqxFAcBvH9BitEtxmpW2uhykKk
xY4rVD/4Uys1s3PF1/64QfPR+hYcewueOwz0ZAcLyFXXk4McICXaPq3NrLiWYKKX
UZLnrPzcrGZoW/kHDDp4OmBiDmT1PGvZlpuimwkMCusUzIr7Cbbp2dIy8MERL5tA
LcgLu3KL6clJ+aTW2jgepI1D7sTepOeGd7eRSb5njKg2M7k/93v/7MipZxiVtyXH
B74YiK6jSbst5JpuYsLa/Dqryvx7Xq3n53oif892pv3euTduo1fYw8Hgh/OOYdeT
c9WCj03KA1jCSFURjdrug0kR8BPlfjqtRLXFABEBAAG0JE1TIE9wZW4gVGVjaCA8
aW50ZXJvcEBtaWNyb3NvZnQuY29tPokBOAQTAQIAIgUCVDVtMgIbAwYLCQgHAwIG
FQgCCQoLBBYCAwECHgECF4AACgkQsCxG30F6CJO1uAf/cmL68bM8YgF/61hkaY56
LqrppUTJH/w4fKq47Pf6KfgSLvxfNU6soi2KHYRjIvTRx3tV4vUM5n2plaQg2s8V
/Epg4FeIRTk75YwiHAzLhLnp5cdUaTvC4j4mwxoB6j9Ty+fXJwQ0MvpDhIZb9vM4
GXw/fEQHCT4f3gx4nReeqE+FB2wVHleX9+Lpodu98JyJTKJRBRHYLqy6S+/lyp2W
aBlsI1LOqBcx1uRK24U7duIpbYwIyrx0cafSruqR2GjVdu+imkhHyUn52VbzYhq1
af0rqYiZ1VOamVOG0By8+hVyNa1MLc1K2uWGs0o5fDe9F5/swbvLHVXI+M50Vs+m
J7kBDQRUNW0yAQgAu7DkTVj0ZQC4F7bFivAwrdby8gCakTXOl1kcK622hjRJ8nam
aZeW+eADfLRsTmdUmXgZu1YWS5Gn2ZVngC8SGPUBT071+oRETCz4uNB7IimB9QfP
++orI6o2vmnVVsq5wWCbEdNU+TCVv1zjrYev5lwckkKpjHt6o8MNoX2DFuQymSyR
eZKaqhdKmcji4Ke7OIYqwgPjch3wxzE1b5gNOR/iwxWyjjOffZPLr/VhIfIJRs86
dSXrwjHtEh810SKDLghHM0VAdY34nyC5ZZ61yhts5HtQDFK+9mNpH1mkc4gDBlgG
266pVvknumK6lPNm/osF/cpjWmEw24ypcQIvOQARAQABiQEfBBgBAgAJBQJUNW0y
AhsMAAoJELAsRt9BegiTMBUH/0sZ6gZy7mCTSAYT+NSXLFtGC2zNUVL80SWvfgYm
k9XPVI22MrefZfQ6M01RylyxtWXjRM8UoN8SDKWPpXumzJf831f/7om5zwutaG7b
tjDPYqRKJSbAIFZu2mN+uLrNQ2SV6XK7FoV0dtcrEX9S7RICb6i19D+70+Oh/qgU
R04H1jqS29XBzqAlIzdBoA+sYAwbOIJsSL3YyNQcUv3B5+5yR/bo/L8pnUJt6iuL
nWW+mi7r8gWPHDSrcdYq1TmmlOM7CwZPgWRZzkQPSeZz52Tt7IP47eyGJ09U4PIf
FtMH1ElL2UgHoA/F9Q88e7LkztaTqE59uXWbIYyuSMJVvRU=
=sb3d
-----END PGP PUBLIC KEY BLOCK-----

View File

@ -1,4 +1,18 @@
#!/usr/bin/env bash
#!/bin/bash -e
# generate configuration
[ -d /etc/sonic ] || mkdir -p /etc/sonic
SYSTEM_MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}')
sonic-cfggen -a '{"DEVICE_METADATA":{"localhost": {"mac": "'$SYSTEM_MAC_ADDRESS'"}}}' --print-data > /etc/sonic/init_cfg.json
if [ -f /etc/sonic/config_db.json ]; then
sonic-cfggen -j /etc/sonic/config_db.json -j /etc/sonic/init_cfg.json --print-data > /tmp/config_db.json
mv /tmp/config_db.json /etc/sonic/config_db.json
else
sonic-cfggen -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json
fi
mkdir -p /etc/swss/config.d/
@ -16,6 +30,8 @@ mkdir -p /var/run/redis
supervisorctl start redis-server
/usr/bin/configdb-load.sh
supervisorctl start syncd
supervisorctl start orchagent
@ -30,8 +46,14 @@ supervisorctl start teamsyncd
supervisorctl start fpmsyncd
supervisorctl start intfmgrd
supervisorctl start vlanmgrd
supervisorctl start zebra
# Start arp_update when VLAN exists
# VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'`
# if [ "$VLAN" != "" ]; then
# supervisorctl start arp_update
# fi
VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'`
if [ "$VLAN" != "" ]; then
supervisorctl start arp_update
fi

View File

@ -75,9 +75,25 @@ autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:vlanmgrd]
command=/usr/bin/vlanmgrd
priority=10
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:intfmgrd]
command=/usr/bin/intfmgrd
priority=11
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:zebra]
command=/usr/lib/quagga/zebra -A 127.0.0.1
priority=10
priority=12
autostart=false
autorestart=false
stdout_logfile=syslog
@ -85,7 +101,7 @@ stderr_logfile=syslog
[program:bgpd]
command=/usr/lib/quagga/bgpd -A 127.0.0.1 -F
priority=11
priority=13
autostart=false
autorestart=false
stdout_logfile=syslog
@ -93,8 +109,16 @@ stderr_logfile=syslog
[program:fpmsyncd]
command=/usr/bin/fpmsyncd
priority=12
priority=14
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:arp_update]
command=bash -c "/usr/bin/arp_update; sleep 300"
priority=15
autostart=false
autorestart=true
stdout_logfile=syslog
stderr_logfile=syslog

View File

@ -12,3 +12,4 @@ $(DOCKER_DATABASE)_RUN_OPT += --net=host --privileged -t
$(DOCKER_DATABASE)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
$(DOCKER_DATABASE)_BASE_IMAGE_FILES += redis-cli:/usr/bin/redis-cli
$(DOCKER_DATABASE)_FILES += $(CONFIGDB_LOAD_SCRIPT)

7
rules/iproute2.mk Normal file
View File

@ -0,0 +1,7 @@
# iproute2 package
IPROUTE2_VERSION = 4.9.0-1
IPROUTE2 = iproute2_$(IPROUTE2_VERSION)_amd64.deb
$(IPROUTE2)_SRC_PATH = $(SRC_PATH)/iproute2
SONIC_MAKE_DEBS += $(IPROUTE2)

11
rules/scripts.mk Normal file
View File

@ -0,0 +1,11 @@
ARP_UPDATE_SCRIPT = arp_update
$(ARP_UPDATE_SCRIPT)_PATH = files/scripts
CONFIGDB_LOAD_SCRIPT = configdb-load.sh
$(CONFIGDB_LOAD_SCRIPT)_PATH = files/scripts
SONIC_COPY_FILES += $(CONFIGDB_LOAD_SCRIPT) \
$(ARP_UPDATE_SCRIPT)

View File

@ -202,7 +202,17 @@ RUN apt-get update && apt-get install -y \
libgtest-dev \
cmake \
# For python-based swsscommon
swig3.0
swig3.0 \
# For iproute2
cm-super-minimal \
libatm1-dev \
libelf-dev \
libmnl-dev \
libselinux1-dev \
linuxdoc-tools \
lynx \
texlive-latex-extra \
texlive-latex-recommended
# For linux build
RUN apt-get -y build-dep linux

20
src/iproute2/Makefile Normal file
View File

@ -0,0 +1,20 @@
SHELL = /bin/bash
.ONESHELL:
.SHELLFLAGS += -e
IPROUTE2_VERSION = 4.9.0
IPROUTE2_VERSION_FULL = $(IPROUTE2_VERSION)-1
MAIN_TARGET = iproute2_$(IPROUTE2_VERSION_FULL)_amd64.deb
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
wget -O iproute2_$(IPROUTE2_VERSION).orig.tar.xz -N "https://sonicstorage.blob.core.windows.net/packages/iproute2_4.9.0.orig.tar.xz?sv=2015-04-05&sr=b&sig=9nvybd1xkXyRQbaG6Fy6wBazPA8IbZV0AO41GWXPEP8%3D&se=2154-10-23T11%3A59%3A00Z&sp=r"
wget -O iproute2_$(IPROUTE2_VERSION_FULL).dsc -N "https://sonicstorage.blob.core.windows.net/packages/iproute2_4.9.0-1.dsc?sv=2015-04-05&sr=b&sig=m6FcMH9dOh8ggipBgOsONiXvDxoi6bfUO%2BxvidsMNMQ%3D&se=2154-10-23T11%3A59%3A53Z&sp=r"
wget -O iproute2_$(IPROUTE2_VERSION_FULL).debian.tar.xz -N "https://sonicstorage.blob.core.windows.net/packages/iproute2_4.9.0-1.debian.tar.xz?sv=2015-04-05&sr=b&sig=U5NFuwG5C3vZXlUUNvoPMnKDtMKk66zbweA9rQYbEVY%3D&se=2154-10-23T12%3A00%3A15Z&sp=r"
dpkg-source -x iproute2_$(IPROUTE2_VERSION_FULL).dsc
pushd iproute2-$(IPROUTE2_VERSION)
dpkg-buildpackage -us -uc -b -j$(SONIC_CONFIG_MAKE_JOBS)
popd
mv $* $(DEST)/

@ -1 +1 @@
Subproject commit 3a9cf8f478474dd0bf23af283ba7779575faae6d
Subproject commit 57a98acb893c73063792bf6d7adf8bca71f8b9d6