Add gbsyncd container for broncos (#11154)

* Add docker-gbsyncd-broncos support
* Address review comments
* Add socket to gbsyncd
* Upgrade gbsyncd-broncos to bullseye
This commit is contained in:
andywongarista 2022-07-17 19:57:27 -07:00 committed by GitHub
parent 8282d427e4
commit 88d0ce5ce8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 190 additions and 4 deletions

View File

@ -36,7 +36,7 @@ function updateSyslogConf()
TARGET_IP=$(docker network inspect bridge --format={{ "'{{(index .IPAM.Config 0).Gateway}}'" }}) TARGET_IP=$(docker network inspect bridge --format={{ "'{{(index .IPAM.Config 0).Gateway}}'" }})
CONTAINER_NAME="$DOCKERNAME" CONTAINER_NAME="$DOCKERNAME"
TMP_FILE="/tmp/rsyslog.$CONTAINER_NAME.conf" TMP_FILE="/tmp/rsyslog.$CONTAINER_NAME.conf"
{%- if docker_container_name == "database" %} {%- if docker_container_name == "database" %}
python -c "import jinja2, os; paths=['/usr/share/sonic/templates']; loader = jinja2.FileSystemLoader(paths); env = jinja2.Environment(loader=loader, trim_blocks=True); template_file='/usr/share/sonic/templates/rsyslog-container.conf.j2'; template = env.get_template(os.path.basename(template_file)); data=template.render({\"target_ip\":\"$TARGET_IP\",\"container_name\":\"$CONTAINER_NAME\"}); print(data)" > $TMP_FILE python -c "import jinja2, os; paths=['/usr/share/sonic/templates']; loader = jinja2.FileSystemLoader(paths); env = jinja2.Environment(loader=loader, trim_blocks=True); template_file='/usr/share/sonic/templates/rsyslog-container.conf.j2'; template = env.get_template(os.path.basename(template_file)); data=template.render({\"target_ip\":\"$TARGET_IP\",\"container_name\":\"$CONTAINER_NAME\"}); print(data)" > $TMP_FILE
{%- else %} {%- else %}
sonic-cfggen -t /usr/share/sonic/templates/rsyslog-container.conf.j2 -a "{\"target_ip\": \"$TARGET_IP\", \"container_name\": \"$CONTAINER_NAME\" }" > $TMP_FILE sonic-cfggen -t /usr/share/sonic/templates/rsyslog-container.conf.j2 -a "{\"target_ip\": \"$TARGET_IP\", \"container_name\": \"$CONTAINER_NAME\" }" > $TMP_FILE
@ -105,7 +105,7 @@ function preStartAction()
if [[ $(/bin/systemctl status watchdog-control.service | grep -c running) -gt 0 ]]; then if [[ $(/bin/systemctl status watchdog-control.service | grep -c running) -gt 0 ]]; then
echo "Stopping watchdog-control.service before starting PDE" echo "Stopping watchdog-control.service before starting PDE"
systemctl stop watchdog-control.service systemctl stop watchdog-control.service
fi fi
{%- elif docker_container_name == "snmp" %} {%- elif docker_container_name == "snmp" %}
$SONIC_DB_CLI STATE_DB HSET 'DEVICE_METADATA|localhost' chassis_serial_number $(decode-syseeprom -s) $SONIC_DB_CLI STATE_DB HSET 'DEVICE_METADATA|localhost' chassis_serial_number $(decode-syseeprom -s)
{%- else %} {%- else %}
@ -127,7 +127,7 @@ function waitForAllInstanceDatabaseConfigJsonFilesReady()
cnt=0 cnt=0
SONIC_DB_GLOBAL_JSON="/var/run/redis/sonic-db/database_global.json" SONIC_DB_GLOBAL_JSON="/var/run/redis/sonic-db/database_global.json"
if [ -f "$SONIC_DB_GLOBAL_JSON" ]; then if [ -f "$SONIC_DB_GLOBAL_JSON" ]; then
# Create a separate python script to get a list of location of all instance database_config.json file # Create a separate python script to get a list of location of all instance database_config.json file
redis_database_cfg_list=`/usr/bin/python -c "import sys; import os; import json; f=open(sys.argv[1]); \ redis_database_cfg_list=`/usr/bin/python -c "import sys; import os; import json; f=open(sys.argv[1]); \
global_db_dir = os.path.dirname(sys.argv[1]); data=json.load(f); \ global_db_dir = os.path.dirname(sys.argv[1]); data=json.load(f); \
print(\" \".join([os.path.normpath(global_db_dir+'/'+elem['include']) \ print(\" \".join([os.path.normpath(global_db_dir+'/'+elem['include']) \
@ -297,6 +297,20 @@ start() {
source $PLATFORM_ENV_CONF source $PLATFORM_ENV_CONF
fi fi
{%- if docker_container_name == "gbsyncd" %}
GBSYNCD_CONF=/usr/share/sonic/device/$PLATFORM/gbsyncd.ini
GBSYNCD_PLATFORM=gbsyncd-vs
if [ -f "$GBSYNCD_CONF" ]; then
while IFS="=" read -r key value; do
case "$key" in
platform)
GBSYNCD_PLATFORM="$value"
;;
esac
done < "$GBSYNCD_CONF"
fi
{%- endif %}
{%- if docker_container_name == "database" %} {%- if docker_container_name == "database" %}
# Don't mount HWSKU in {{docker_container_name}} container. # Don't mount HWSKU in {{docker_container_name}} container.
HWSKU="" HWSKU=""
@ -522,7 +536,10 @@ start() {
--env "NAMESPACE_PREFIX"="$NAMESPACE_PREFIX" \ --env "NAMESPACE_PREFIX"="$NAMESPACE_PREFIX" \
--env "NAMESPACE_COUNT"=$NUM_ASIC \ --env "NAMESPACE_COUNT"=$NUM_ASIC \
--name=$DOCKERNAME \ --name=$DOCKERNAME \
{%- if docker_image_name is defined %} {%- if docker_container_name == "gbsyncd" %}
-v /var/run/docker-syncd$DEV:/var/run/sswsyncd \
"docker-$GBSYNCD_PLATFORM":latest \
{%- elif docker_image_name is defined %}
{{docker_image_name}}:latest \ {{docker_image_name}}:latest \
{%- else %} {%- else %}
{{docker_image_id}} \ {{docker_image_id}} \

View File

@ -30,3 +30,6 @@ include $(PLATFORM_PATH)/libsaithrift-dev.dep
include $(PLATFORM_PATH)/docker-syncd-brcm-dnx.dep include $(PLATFORM_PATH)/docker-syncd-brcm-dnx.dep
include $(PLATFORM_PATH)/docker-syncd-brcm-dnx-rpc.dep include $(PLATFORM_PATH)/docker-syncd-brcm-dnx-rpc.dep
include $(PLATFORM_PATH)/../components/docker-gbsyncd-credo.dep include $(PLATFORM_PATH)/../components/docker-gbsyncd-credo.dep
ifeq ($(INCLUDE_GBSYNCD_BRONCOS), y)
include $(PLATFORM_PATH)/../components/docker-gbsyncd-broncos.dep
endif

View File

@ -29,6 +29,9 @@ include $(PLATFORM_PATH)/libsaithrift-dev.mk
include $(PLATFORM_PATH)/docker-syncd-brcm-dnx.mk include $(PLATFORM_PATH)/docker-syncd-brcm-dnx.mk
include $(PLATFORM_PATH)/docker-syncd-brcm-dnx-rpc.mk include $(PLATFORM_PATH)/docker-syncd-brcm-dnx-rpc.mk
include $(PLATFORM_PATH)/../components/docker-gbsyncd-credo.mk include $(PLATFORM_PATH)/../components/docker-gbsyncd-credo.mk
ifeq ($(INCLUDE_GBSYNCD_BRONCOS), y)
include $(PLATFORM_PATH)/../components/docker-gbsyncd-broncos.mk
endif
BCMCMD = bcmcmd BCMCMD = bcmcmd
$(BCMCMD)_URL = "https://sonicstorage.blob.core.windows.net/packages/20190307/bcmcmd?sv=2015-04-05&sr=b&sig=sUdbU7oVbh5exbXXHVL5TDFBTWDDBASHeJ8Cp0B0TIc%3D&se=2038-05-06T22%3A34%3A19Z&sp=r" $(BCMCMD)_URL = "https://sonicstorage.blob.core.windows.net/packages/20190307/bcmcmd?sv=2015-04-05&sr=b&sig=sUdbU7oVbh5exbXXHVL5TDFBTWDDBASHeJ8Cp0B0TIc%3D&se=2038-05-06T22%3A34%3A19Z&sp=r"

View File

@ -0,0 +1,12 @@
DPATH := $($(DOCKER_GBSYNCD_BRONCOS)_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST)
DEP_FILES += platform/components/docker-gbsyncd-broncos.mk
DEP_FILES += platform/components/docker-gbsyncd-broncos.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
DEP_FILES += $(shell git ls-files $(DPATH))
$(DOCKER_GBSYNCD_BRONCOS)_CACHE_MODE := GIT_CONTENT_SHA
$(DOCKER_GBSYNCD_BRONCOS)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
$(DOCKER_GBSYNCD_BRONCOS)_DEP_FILES := $(DEP_FILES)
$(eval $(call add_dbg_docker,$(DOCKER_GBSYNCD_BRONCOS),$(DOCKER_GBSYNCD_BRONCOS_DBG)))

View File

@ -0,0 +1,37 @@
LIBSAI_BRONCOS = libsaibroncos_0.0.1_amd64.deb
$(LIBSAI_BRONCOS)_URL =
ifneq ($($(LIBSAI_BRONCOS)_URL),)
DOCKER_GBSYNCD_BRONCOS_STEM = docker-gbsyncd-broncos
DOCKER_GBSYNCD_BRONCOS = $(DOCKER_GBSYNCD_BRONCOS_STEM).gz
DOCKER_GBSYNCD_BRONCOS_DBG = $(DOCKER_GBSYNCD_BRONCOS_STEM)-$(DBG_IMAGE_MARK).gz
$(DOCKER_GBSYNCD_BRONCOS)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)
$(DOCKER_GBSYNCD_BRONCOS)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE)
$(DOCKER_GBSYNCD_BRONCOS)_DBG_DEPENDS += $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS)
$(DOCKER_GBSYNCD_BRONCOS)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES)
SONIC_DOCKER_IMAGES += $(DOCKER_GBSYNCD_BRONCOS)
SONIC_BULLSEYE_DOCKERS += $(DOCKER_GBSYNCD_BRONCOS)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_GBSYNCD_BRONCOS)
SONIC_DOCKER_DBG_IMAGES += $(DOCKER_GBSYNCD_BRONCOS_DBG)
SONIC_BULLSEYE_DBG_DOCKERS += $(DOCKER_GBSYNCD_BRONCOS_DBG)
SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_GBSYNCD_BRONCOS_DBG)
$(DOCKER_GBSYNCD_BRONCOS)_CONTAINER_NAME = gbsyncd
$(DOCKER_GBSYNCD_BRONCOS)_RUN_OPT += --privileged -t
$(DOCKER_GBSYNCD_BRONCOS)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf
$(DOCKER_GBSYNCD_BRONCOS)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
SONIC_ONLINE_DEBS += $(LIBSAI_BRONCOS)
$(DOCKER_GBSYNCD_BRONCOS)_VERSION = 1.0.0
$(DOCKER_GBSYNCD_BRONCOS)_PACKAGE_NAME = gbsyncd-broncos
$(DOCKER_GBSYNCD_BRONCOS)_PATH = $(PLATFORM_PATH)/../components/docker-gbsyncd-broncos
$(DOCKER_GBSYNCD_BRONCOS)_DEPENDS += $(SYNCD) $(LIBSAI_BRONCOS)
endif

View File

@ -0,0 +1,40 @@
FROM docker-config-engine-bullseye
ARG docker_container_name
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf
## Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -f -y iproute2 libcap2-bin libprotobuf-dev
COPY \
{% for deb in docker_gbsyncd_broncos_debs.split(' ') -%}
{% if 'libsaibcm' not in deb -%}
debs/{{ deb }}{{' '}}
{%- endif %}
{%- endfor -%}
debs/
RUN dpkg -i \
{% for deb in docker_gbsyncd_broncos_debs.split(' ') -%}
{% if 'libsaibcm' not in deb -%}
debs/{{ deb }}{{' '}}
{%- endif %}
{%- endfor %}
COPY ["docker-init.sh", "/usr/bin/"]
COPY ["start.sh", "/usr/bin/"]
COPY ["critical_processes.j2", "/usr/share/sonic/templates"]
COPY ["supervisord.conf.j2", "/usr/share/sonic/templates"]
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs
ENTRYPOINT ["/usr/bin/docker-init.sh"]

View File

@ -0,0 +1 @@
program:syncd

View File

@ -0,0 +1,16 @@
#! /bin/sh
GB_CONFIG=/usr/share/sonic/hwsku/gearbox_config.json
if [ ! -f $GB_CONFIG ]; then
exit 0
fi
CFGGEN_ARG="-j $GB_CONFIG"
mkdir -p /etc/supervisor/conf.d/
sonic-cfggen $CFGGEN_ARG -t /usr/share/sonic/templates/supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf
sonic-cfggen $CFGGEN_ARG -t /usr/share/sonic/templates/critical_processes.j2 > /etc/supervisor/critical_processes
exec /usr/local/bin/supervisord

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
HWSKU_DIR=/usr/share/sonic/hwsku
mkdir -p /etc/sai.d/
# Create/Copy the psai.profile to /etc/sai.d/psai.profile
if [ -f $HWSKU_DIR/psai.profile.j2 ]; then
sonic-cfggen -d -t $HWSKU_DIR/psai.profile.j2 > /etc/sai.d/psai.profile
else
if [ -f $HWSKU_DIR/psai.profile ]; then
cp $HWSKU_DIR/psai.profile /etc/sai.d/psai.profile
fi
fi

View File

@ -0,0 +1,43 @@
[supervisord]
logfile_maxbytes=1MB
logfile_backups=2
nodaemon=true
[eventlistener:dependent-startup]
command=python3 -m supervisord_dependent_startup
autostart=true
autorestart=unexpected
startretries=0
exitcodes=0,3
events=PROCESS_STATE
[program:rsyslogd]
command=/usr/sbin/rsyslogd -n -iNONE
priority=1
autostart=false
autorestart=unexpected
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
[program:start]
command=/usr/bin/start.sh
priority=2
autostart=false
autorestart=false
startsecs=0
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=rsyslogd:running
[program:syncd]
environment=BRONCOS_DEVICE_PATH=/usr/lib
command=/usr/bin/syncd -s -p /etc/sai.d/psai.profile -x /usr/share/sonic/hwsku/context_config.json -g 1
priority=3
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=start:exited