Skip to content

Commit f4f202d

Browse files
Support to add gbsyncd for Agera2 (#24432)
Why I did it Adding the gbsyncd container for Agera2 external gearbox devices How I did it Added the build file for building gbsyncd-agera2 Added the relevant Dockerfiles and startup script for gbsyncd The debian containing libsai.so has a placeholder string currently Signed-off-by: arpit-nexthop <[email protected]>
1 parent b2139f5 commit f4f202d

File tree

10 files changed

+266
-0
lines changed

10 files changed

+266
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
gdb==13.1-3
2+
gdbserver==13.1-3
3+
libbabeltrace1==1.5.11-1+b2
4+
libboost-regex1.74.0==1.74.0+ds1-21
5+
libc-dev-bin==2.36-9+deb12u10
6+
libc6-dev==2.36-9+deb12u10
7+
libcbor0.8==0.8.0-2+b1
8+
libcurl3-gnutls==7.88.1-10+deb12u12
9+
libdebuginfod-common==0.188-2.1
10+
libdebuginfod1==0.188-2.1
11+
libdw1==0.188-2.1
12+
libedit2==3.1-20221030-2
13+
libfido2-1==1.12.0-2+b1
14+
libglib2.0-0==2.74.6-2+deb12u6
15+
libgpm2==1.20.7-10+b1
16+
libicu72==72.1-3
17+
libipt2==2.0.5-1
18+
libmpfr6==4.2.0-1
19+
libnsl-dev==1.3.0-2
20+
libprotobuf-dev==3.21.12-3
21+
libprotobuf-lite32==3.21.12-3
22+
libprotobuf32==3.21.12-3
23+
libsaiagera2==3.14.0-1
24+
libsaimetadata==1.0.0
25+
libsairedis==1.0.0
26+
libsource-highlight-common==3.1.9-4.2
27+
libsource-highlight4v5==3.1.9-4.2+b3
28+
libssl-dev==3.0.16-1~deb12u1
29+
libssl3==3.0.16-1~deb12u1
30+
libswsscommon-dbgsym==1.0.0
31+
libtirpc-dev==1.3.3+ds-1
32+
libunwind8==1.6.2-3
33+
linux-libc-dev==6.1.140-1
34+
openssh-client==1:9.2p1-2+deb12u6
35+
openssl==3.0.16-1~deb12u1
36+
rpcsvc-proto==1.4.3-1
37+
sensible-utils==0.0.17+nmu1
38+
sshpass==1.09-1+b1
39+
strace==6.1-0.1
40+
syncd==1.0.0
41+
ucf==3.0043+nmu1+deb12u1
42+
vim==2:9.0.1378-2+deb12u2
43+
vim-runtime==2:9.0.1378-2+deb12u2
44+
zlib1g-dev==1:1.2.13.dfsg-1

platform/broadcom/rules.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ include $(PLATFORM_PATH)/docker-syncd-brcm-dnx-rpc.mk
4141
ifeq ($(INCLUDE_GBSYNCD), y)
4242
include $(PLATFORM_PATH)/../components/docker-gbsyncd-credo.mk
4343
include $(PLATFORM_PATH)/../components/docker-gbsyncd-broncos.mk
44+
include $(PLATFORM_PATH)/../components/docker-gbsyncd-agera2.mk
4445
include $(PLATFORM_PATH)/../components/docker-gbsyncd-milleniob.mk
4546
endif
4647

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
DPATH := $($(DOCKER_GBSYNCD_AGERA2)_PATH)
2+
DEP_FILES := $(SONIC_COMMON_FILES_LIST)
3+
DEP_FILES += platform/components/docker-gbsyncd-agera2.mk
4+
DEP_FILES += platform/components/docker-gbsyncd-agera2.dep
5+
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
6+
DEP_FILES += $(shell git ls-files $(DPATH))
7+
8+
$(DOCKER_GBSYNCD_AGERA2)_CACHE_MODE := GIT_CONTENT_SHA
9+
$(DOCKER_GBSYNCD_AGERA2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
10+
$(DOCKER_GBSYNCD_AGERA2)_DEP_FILES := $(DEP_FILES)
11+
12+
$(eval $(call add_dbg_docker,$(DOCKER_GBSYNCD_AGERA2),$(DOCKER_GBSYNCD_AGERA2_DBG)))
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Agera2 PAI Library Package - URL-based download similar to broncos
2+
LIBSAI_AGERA2_VERSION = 3.14.0-1
3+
LIBSAI_AGERA2_BRANCH_NAME = REL_3.14
4+
5+
LIBSAI_AGERA2_URL_PREFIX = "https://packages.trafficmanager.net/public/sai/bcmpai/$(LIBSAI_AGERA2_BRANCH_NAME)/$(LIBSAI_AGERA2_VERSION)"
6+
7+
# Runtime package`
8+
LIBSAI_AGERA2 = libsaiagera2_$(LIBSAI_AGERA2_VERSION)_amd64.deb
9+
$(LIBSAI_AGERA2)_URL = "$(LIBSAI_AGERA2_URL_PREFIX)/$(LIBSAI_AGERA2)"
10+
11+
ifneq ($($(LIBSAI_AGERA2)_URL),)
12+
13+
DOCKER_GBSYNCD_AGERA2_STEM = docker-gbsyncd-agera2
14+
DOCKER_GBSYNCD_AGERA2 = $(DOCKER_GBSYNCD_AGERA2_STEM).gz
15+
DOCKER_GBSYNCD_AGERA2_DBG = $(DOCKER_GBSYNCD_AGERA2_STEM)-$(DBG_IMAGE_MARK).gz
16+
17+
$(DOCKER_GBSYNCD_AGERA2)_FILES += $(DSSERVE)
18+
19+
$(DOCKER_GBSYNCD_AGERA2)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BOOKWORM)
20+
21+
$(DOCKER_GBSYNCD_AGERA2)_DBG_DEPENDS += $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_DEPENDS)
22+
23+
$(DOCKER_GBSYNCD_AGERA2)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_IMAGE_PACKAGES)
24+
25+
SONIC_DOCKER_IMAGES += $(DOCKER_GBSYNCD_AGERA2)
26+
SONIC_BOOKWORM_DOCKERS += $(DOCKER_GBSYNCD_AGERA2)
27+
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_GBSYNCD_AGERA2)
28+
29+
SONIC_DOCKER_DBG_IMAGES += $(DOCKER_GBSYNCD_AGERA2_DBG)
30+
SONIC_BOOKWORM_DBG_DOCKERS += $(DOCKER_GBSYNCD_AGERA2_DBG)
31+
SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_GBSYNCD_AGERA2_DBG)
32+
33+
$(DOCKER_GBSYNCD_AGERA2)_CONTAINER_NAME = gbsyncd
34+
$(DOCKER_GBSYNCD_AGERA2)_RUN_OPT += --privileged -t
35+
$(DOCKER_GBSYNCD_AGERA2)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf
36+
$(DOCKER_GBSYNCD_AGERA2)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
37+
$(DOCKER_GBSYNCD_AGERA2)_RUN_OPT += -v /host/warmboot:/var/warmboot
38+
39+
# Add runtime package to online debs
40+
SONIC_ONLINE_DEBS += $(LIBSAI_AGERA2)
41+
42+
$(DOCKER_GBSYNCD_AGERA2)_VERSION = 1.0.0
43+
$(DOCKER_GBSYNCD_AGERA2)_PACKAGE_NAME = gbsyncd-agera2
44+
$(DOCKER_GBSYNCD_AGERA2)_PATH = $(PLATFORM_PATH)/../components/docker-gbsyncd-agera2
45+
$(DOCKER_GBSYNCD_AGERA2)_DEPENDS += $(SYNCD) $(LIBSAI_AGERA2)
46+
47+
endif
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
FROM docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}
2+
3+
ARG docker_container_name
4+
5+
## Make apt-get non-interactive
6+
ENV DEBIAN_FRONTEND=noninteractive
7+
8+
RUN apt-get update
9+
10+
RUN apt-get install -f -y iproute2 libcap2-bin libprotobuf-dev
11+
12+
COPY \
13+
{% for deb in docker_gbsyncd_agera2_debs.split(' ') -%}
14+
{% if 'libsaibcm' not in deb -%}
15+
debs/{{ deb }}{{' '}}
16+
{%- endif %}
17+
{%- endfor -%}
18+
debs/
19+
20+
RUN dpkg -i \
21+
{% for deb in docker_gbsyncd_agera2_debs.split(' ') -%}
22+
{% if 'libsaibcm' not in deb -%}
23+
debs/{{ deb }}{{' '}}
24+
{%- endif %}
25+
{%- endfor %}
26+
27+
COPY ["docker-init.sh", "/usr/bin/"]
28+
COPY ["start.sh", "/usr/bin/"]
29+
COPY ["agera2sh", "/usr/bin/"]
30+
31+
RUN mkdir -p /etc/supervisor/conf.d/
32+
COPY ["critical_processes", "/etc/supervisor"]
33+
COPY ["supervisord.conf", "/etc/supervisor/conf.d"]
34+
35+
COPY ["files/dsserve", "/usr/bin/"]
36+
RUN chmod +x /usr/bin/dsserve
37+
38+
## Clean up
39+
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
40+
RUN rm -rf /debs
41+
42+
ENTRYPOINT ["/usr/bin/docker-init.sh"]
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
usage="$(basename "$0") [-h] [-q] [-t timeout] -- interactive shell for agera2 service
3+
4+
where:
5+
-h show this help text
6+
-t inactivity timeout in seconds (default 300 seconds, 0 for no timeout)
7+
-q quite, no banner (default: verbose)"
8+
9+
banner="Press Enter to show prompt.
10+
Press Ctrl+C to exit.
11+
NOTICE: Only one agera2sh or agera2cmd can connect to the shell at same time.
12+
"
13+
14+
# Default verbose
15+
quiet=false
16+
timeout=300
17+
18+
while getopts 'hqt:' option; do
19+
case "$option" in
20+
h) echo "$usage"
21+
exit
22+
;;
23+
q) quiet=true
24+
;;
25+
t) timeout=$OPTARG
26+
;;
27+
\?) printf "illegal option: -%s\n" "$OPTARG" >&2
28+
echo "$usage" >&2
29+
exit 1
30+
;;
31+
esac
32+
done
33+
shift $((OPTIND - 1))
34+
35+
if [ "$quiet" = false ]; then
36+
echo "$banner"
37+
fi
38+
39+
/usr/bin/socat -T$timeout readline UNIX-CONNECT:/var/run/sswsyncd/sswgbsyncd.socket
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
program:dsserve
2+
program:syncd
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#! /bin/sh
2+
3+
GB_CONFIG=/usr/share/sonic/hwsku/gearbox_config.json
4+
5+
if [ ! -f $GB_CONFIG ]; then
6+
exit 0
7+
fi
8+
9+
exec /usr/local/bin/supervisord
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
HWSKU_DIR=/usr/share/sonic/hwsku
4+
5+
mkdir -p /etc/sai.d/
6+
7+
# Create/Copy the psai.profile to /etc/sai.d/psai.profile
8+
if [ -f $HWSKU_DIR/psai.profile.j2 ]; then
9+
sonic-cfggen -d -t $HWSKU_DIR/psai.profile.j2 > /etc/sai.d/psai.profile
10+
else
11+
if [ -f $HWSKU_DIR/psai.profile ]; then
12+
cp $HWSKU_DIR/psai.profile /etc/sai.d/psai.profile
13+
fi
14+
fi
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
[supervisord]
2+
logfile_maxbytes=1MB
3+
logfile_backups=2
4+
nodaemon=true
5+
6+
[eventlistener:dependent-startup]
7+
command=python3 -m supervisord_dependent_startup
8+
autostart=true
9+
autorestart=unexpected
10+
startretries=0
11+
exitcodes=0,3
12+
events=PROCESS_STATE
13+
14+
[eventlistener:supervisor-proc-exit-listener]
15+
command=/usr/local/bin/supervisor-proc-exit-listener --container-name gbsyncd
16+
events=PROCESS_STATE_EXITED,PROCESS_STATE_RUNNING
17+
autostart=true
18+
autorestart=unexpected
19+
buffer_size=1024
20+
21+
[program:rsyslogd]
22+
command=/usr/sbin/rsyslogd -n -iNONE
23+
priority=1
24+
autostart=false
25+
autorestart=unexpected
26+
stdout_logfile=NONE
27+
stdout_syslog=true
28+
stderr_logfile=NONE
29+
stderr_syslog=true
30+
dependent_startup=true
31+
32+
[program:start]
33+
command=/usr/bin/start.sh
34+
priority=2
35+
autostart=false
36+
autorestart=false
37+
startsecs=0
38+
stdout_logfile=NONE
39+
stdout_syslog=true
40+
stderr_logfile=NONE
41+
stderr_syslog=true
42+
dependent_startup=true
43+
dependent_startup_wait_for=rsyslogd:running
44+
45+
[program:syncd]
46+
environment=AGERA2_DEVICE_PATH=/usr/lib
47+
command=/usr/bin/dsserve -f /var/run/sswsyncd/sswgbsyncd.socket /usr/bin/syncd --diag -s -p /etc/sai.d/psai.profile -x /usr/share/sonic/hwsku/context_config.json -g 1
48+
priority=3
49+
autostart=false
50+
autorestart=false
51+
stdout_logfile=NONE
52+
stdout_syslog=true
53+
stderr_logfile=NONE
54+
stderr_syslog=true
55+
dependent_startup=true
56+
dependent_startup_wait_for=start:exited

0 commit comments

Comments
 (0)