[p4]: Updated p4 bm (#1228)

* merged new p4 platform from 1.0.3

* reverted SAI-P4-BM to SAI1.0

* changed port_config.ini from alias to name. changed tenjin makefile to https

* updated SAI-P4-BM commit

* [platform/p4]: Updated P4 docker to be up to date with vs.

* Merged swss, swss-common and sai-redis with master, now supports new ConfigDB.
* Changed startup script to work with supervisor for managing processes.

Signed-off-by: Yonatan Piasetzky yonatanp@mellanox.com

* Updated SAI-BM submodule to sai v1.0.4 tag. now supports hostif vlan tag for port netdev

* Updated SAI-P4-BM submodule.
This commit is contained in:
YonatanPitz 2017-12-12 10:38:36 +02:00 committed by lguohan
parent 69d6ad56c6
commit e0af519da2
11 changed files with 358 additions and 82 deletions

@ -1 +1 @@
Subproject commit c25b5aecabbb09270dc805459434ee396792ccb3
Subproject commit c763924affd416df9c4d3e40d4f8ac1cb2be5fff

View File

@ -2,7 +2,17 @@
DOCKER_SONIC_P4 = docker-sonic-p4.gz
$(DOCKER_SONIC_P4)_PATH = $(PLATFORM_PATH)/docker-sonic-p4
$(DOCKER_SONIC_P4)_DEPENDS += $(SWSS) $(SYNCD) $(P4_SWITCH) $(REDIS_SERVER) $(REDIS_TOOLS) $(LIBTEAMDCT) $(LIBTEAM_UTILS)
$(DOCKER_SONIC_P4)_DEPENDS += $(SWSS) \
$(SYNCD) \
$(P4_SWITCH) \
$(REDIS_SERVER) \
$(REDIS_TOOLS) \
$(PYTHON_SWSSCOMMON) \
$(LIBTEAMDCT) \
$(LIBTEAM_UTILS) \
$(SONIC_DEVICE_DATA) \
$(SONIC_UTILS) \
$(IPROUTE2)
# ifeq ($(ROUTING_STACK), quagga)
$(DOCKER_SONIC_P4)_DEPENDS += $(QUAGGA)
@ -12,5 +22,8 @@ $(DOCKER_SONIC_P4)_DEPENDS += $(QUAGGA)
# $(DOCKER_SONIC_P4)_DEPENDS += $(GOBGP)
# endif
$(DOCKER_SONIC_P4)_LOAD_DOCKERS += $(DOCKER_BASE)
$(DOCKER_SONIC_P4)_FILES += $(CONFIGDB_LOAD_SCRIPT) \
$(ARP_UPDATE_SCRIPT)
$(DOCKER_SONIC_P4)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE)
SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_P4)

View File

@ -1,11 +1,47 @@
FROM docker-base
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 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
RUN apt-get install -y net-tools \
arping \
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 \
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
COPY \
{% for deb in docker_sonic_p4_debs.split(' ') -%}
@ -18,20 +54,26 @@ RUN dpkg -i \
debs/{{ deb }}{{' '}}
{%- endfor %}
ADD port_config.ini /port_config.ini
ADD startup.sh /scripts/startup.sh
ADD run_bm.sh /scripts/run_bm.sh
ADD rsyslog.conf /etc/rsyslog.conf
## 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/; \
RUN sed -ri 's/^(save .*$)/# \1/g; \
s/^daemonize yes$/daemonize no/; \
s/^logfile .*$/logfile ""/; \
s/^# syslog-enabled no$/syslog-enabled no/; \
s/^# unixsocket/unixsocket/ \
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
ENTRYPOINT /bin/bash
ADD port_config.ini /port_config.ini
ADD rsyslog.conf /etc/rsyslog.conf
COPY ["start.sh", "orchagent.sh", "config_bm.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["files/configdb-load.sh", "/usr/bin/"]
COPY ["files/arp_update", "/usr/bin"]
RUN echo "docker-sonic-p4" > /etc/hostname
RUN touch /etc/quagga/zebra.conf
ENTRYPOINT ["/bin/bash"]

View File

@ -0,0 +1,4 @@
simple_switch_CLI --pre SimplePreLAG < /usr/share/p4-sai-bm/bridge_default_config.txt
simple_switch_CLI < /usr/share/p4-sai-bm/bridge_default_config_mirror.txt
simple_switch_CLI --pre SimplePreLAG --thrift-port 9091 < /usr/share/p4-sai-bm/router_default_config.txt
simple_switch_CLI --thrift-port 9091 < /usr/share/p4-sai-bm/router_default_config_mirror.txt

View File

@ -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}

View File

@ -30,9 +30,9 @@ $ModLoad imuxsock # provides support for local system logging
#### GLOBAL DIRECTIVES ####
###########################
#Set remote syslog server
*.* @172.17.0.1:514
#*.* @172.17.0.1:514
#Set local syslog
#*.* /var/log/messages
*.* /var/log/messages
#
# Use traditional timestamp format.

View File

@ -1,23 +0,0 @@
#!/bin/sh
# handler()
# {
# kill -s INT $ROUTER_PID
# kill -s INT $BRIDGE_PID
# }
set -m
ip netns exec sw_net simple_switch -i 0@router_port1 -i 250@router_cpu_port --thrift-port 9091 --log-file /tmp/router_log --log-flush --notifications-addr ipc:///tmp/bmv2-router-notifications.ipc /usr/share/p4-sai-bm/sai_router.json &
export ROUTER_PID=$!
ip netns exec sw_net simple_switch -i 0@sw_port0 -i 1@sw_port1 -i 2@sw_port2 -i 3@sw_port3 -i 4@sw_port4 -i 5@sw_port5 -i 6@sw_port6 -i 7@sw_port7 -i 7@sw_port7 -i 8@sw_port8 -i 9@sw_port9 -i 10@sw_port10 -i 11@sw_port11 -i 12@sw_port12 -i 13@sw_port13 -i 14@sw_port14 -i 15@sw_port15 -i 16@sw_port16 -i 17@sw_port17 -i 18@sw_port18 -i 19@sw_port19 -i 20@sw_port20 -i 21@sw_port21 -i 22@sw_port22 -i 23@sw_port23 -i 24@sw_port24 -i 25@sw_port25 -i 26@sw_port26 -i 27@sw_port27 -i 28@sw_port28 -i 29@sw_port29 -i 30@sw_port30 -i 31@sw_port31 -i 250@cpu_port -i 251@router_port0 --log-file /tmp/bridge_log --log-flush /usr/share/p4-sai-bm/sai_bridge.json &
export BRIDGE_PID=$!
sleep 10
simple_switch_CLI --pre SimplePreLAG < /usr/share/p4-sai-bm/bridge_default_config.txt
simple_switch_CLI < /usr/share/p4-sai-bm/bridge_default_config_mirror.txt
simple_switch_CLI --pre SimplePreLAG --thrift-port 9091 < /usr/share/p4-sai-bm/router_default_config.txt
simple_switch_CLI --thrift-port 9091 < /usr/share/p4-sai-bm/router_default_config_mirror.txt
# echo "router and bridge are running send SIGINT to close"
# trap handler INT
# sleep inf
# sudo kill -s SIGINT 3319

View File

@ -0,0 +1,30 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1
mQENBFQ1bTIBCAC7oGfkv/ck0XsLuG8cdcSB2ISqxFAcB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C5ZZ61yhts5HtQDFK+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

@ -0,0 +1,97 @@
#!/bin/bash -e
# generate configuration
[ -d /etc/sonic ] || mkdir -p /etc/sonic
if ! ip link show eth0 &> /dev/null; then
ip link add eth0 type dummy
fi
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/
# 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
echo "Start rsyslogd"
supervisorctl start rsyslogd
mkdir -p /var/run/redis
echo "Start redis"
supervisorctl start redis-server
echo "Veth Setup"
veth_setup.sh > /tmp/veth_setup.log
echo "Start BM"
rm -rf bm_logs/bridge_log.*
rm -rf bm_logs/router_log.*
rm -rf log.txt
mkdir -p bm_logs
supervisorctl start bm_bridge
supervisorctl start bm_router
sleep 10
echo "BM Default config"
config_bm.sh > /tmp/config_bm.log
/usr/bin/configdb-load.sh
echo "Start syncd"
supervisorctl start syncd
echo "Start orchagent"
supervisorctl start orchagent
echo "Start portsyncd"
supervisorctl start portsyncd
echo "Start intfsyncd"
supervisorctl start intfsyncd
echo "Start neighsyncd"
supervisorctl start neighsyncd
echo "Start teamsyncd"
supervisorctl start teamsyncd
echo "Start fpmsyncd"
supervisorctl start fpmsyncd
echo "Start intfmgrd"
supervisorctl start intfmgrd
echo "Start vlanmgrd"
supervisorctl start vlanmgrd
echo "Start zebra"
supervisorctl start zebra
echo "Start bgpd"
supervisorctl start bgpd
if [ -f /etc/swss/config.d/default_config.json ]; then
swssconfig /etc/swss/config.d/default_config.json
fi
# Start arp_update when VLAN exists
VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'`
if [ "$VLAN" != "" ]; then
echo "Start arp_update"
supervisorctl start arp_update
fi

View File

@ -1,43 +0,0 @@
#!/bin/bash
echo "Set onie_platform to x86_64-barefoot_p4-r0"
export onie_platform=x86_64-barefoot_p4-r0
echo "Start rsyslog"
rm -f /var/run/rsyslogd.pid
service rsyslog start
echo "Start redis server"
service redis-server start &
sleep 3
redis-cli flushall
echo "Veth setup"
veth_setup.sh > /tmp/veth_setup.log 2>&1
echo "Start BMV2"
/scripts/run_bm.sh > /tmp/run_bm.log 2>&1 &
sleep 15
redis-cli -n 1 set LOGLEVEL DEBUG
echo "Start Syncd"
syncd -N > /tmp/syncd.log 2>&1 &
sleep 10
echo "Start Orchagent"
orchagent $* > /tmp/orchagent.log 2>&1 &
sleep 10
echo "Start Portsyncd"
portsyncd -p /port_config.ini > /tmp/portsyncd.log 2>&1 &
echo "Start Intfsync"
intfsyncd > /tmp/intfsyncd.log 2>&1 &
echo "Start Neighsyncd"
neighsyncd > /tmp/neighsyncd.log 2>&1 &
echo "Start Fpmsyncd"
fpmsyncd > /tmp/fpmsyncd.log 2>&1 &

View File

@ -0,0 +1,141 @@
[supervisord]
logfile_maxbytes=1MB
logfile_backups=2
nodaemon=false
[program:start.sh]
command=/usr/bin/start.sh
priority=1
autostart=true
autorestart=false
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[program:rsyslogd]
command=/usr/sbin/rsyslogd -n
priority=2
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:bm_router]
command=ip netns exec sw_net simple_switch -i 0@router_port1 -i 250@router_cpu_port --thrift-port 9091 --log-file bm_logs/router_log --log-flush --notifications-addr ipc:///tmp/bmv2-router-notifications.ipc /usr/share/p4-sai-bm/sai_router.json
priority=3
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:bm_bridge]
command=ip netns exec sw_net simple_switch -i 0@sw_port0 -i 1@sw_port1 -i 2@sw_port2 -i 3@sw_port3 -i 4@sw_port4 -i 5@sw_port5 -i 6@sw_port6 -i 7@sw_port7 -i 7@sw_port7 -i 8@sw_port8 -i 9@sw_port9 -i 10@sw_port10 -i 11@sw_port11 -i 12@sw_port12 -i 13@sw_port13 -i 14@sw_port14 -i 15@sw_port15 -i 16@sw_port16 -i 17@sw_port17 -i 18@sw_port18 -i 19@sw_port19 -i 20@sw_port20 -i 21@sw_port21 -i 22@sw_port22 -i 23@sw_port23 -i 24@sw_port24 -i 25@sw_port25 -i 26@sw_port26 -i 27@sw_port27 -i 28@sw_port28 -i 29@sw_port29 -i 30@sw_port30 -i 31@sw_port31 -i 250@cpu_port -i 251@router_port0 --log-file bm_logs/bridge_log --log-flush /usr/share/p4-sai-bm/sai_bridge.json &
priority=3
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:redis-server]
command=/usr/bin/redis-server /etc/redis/redis.conf
priority=4
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:syncd]
command=/usr/bin/syncd -uN
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 /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
[program:teamsyncd]
command=/usr/bin/teamsyncd
priority=9
autostart=false
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=12
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:bgpd]
command=/usr/lib/quagga/bgpd -A 127.0.0.1 -F
priority=13
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:fpmsyncd]
command=/usr/bin/fpmsyncd
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