Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cherry-pick][SAIServer]Upgrade SAI server init script (#13175) #13226

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion platform/broadcom/docker-saiserver-brcm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
DOCKER_SAISERVER_BRCM = docker-saiserver$(SAITHRIFT_VER)-brcm.gz
$(DOCKER_SAISERVER_BRCM)_PATH = $(PLATFORM_PATH)/docker-saiserver-brcm
$(DOCKER_SAISERVER_BRCM)_DEPENDS += $(SAISERVER)
$(DOCKER_SAISERVER_BRCM)_FILES += $(DSSERVE) $(BCMCMD)

# Use syncd_init_common.sh to init hardware platform
SYNCD_INIT_COMMON_SCRIPT = syncd_init_common.sh
$(SYNCD_INIT_COMMON_SCRIPT)_PATH = $(SRC_PATH)/sonic-sairedis/syncd/scripts
SONIC_COPY_FILES += $(SYNCD_INIT_COMMON_SCRIPT)

$(DOCKER_SAISERVER_BRCM)_FILES += $(DSSERVE) $(BCMCMD) $(SYNCD_INIT_COMMON_SCRIPT)
$(DOCKER_SAISERVER_BRCM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER)
SONIC_DOCKER_IMAGES += $(DOCKER_SAISERVER_BRCM)
SONIC_BUSTER_DOCKERS += $(DOCKER_SAISERVER_BRCM)
Expand Down
3 changes: 3 additions & 0 deletions platform/broadcom/docker-saiserver-brcm/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ debs/
RUN apt-get install -yf kmod

COPY ["files/dsserve", "files/bcmcmd", "start.sh", "bcmsh", "/usr/bin/"]
COPY ["saiserver_start.sh", "/usr/bin/"]
COPY ["files/syncd_init_common.sh", "/usr/bin/"]
RUN chmod +x /usr/bin/dsserve /usr/bin/bcmcmd
RUN chmod +x /usr/bin/saiserver_start.sh /usr/bin/syncd_init_common.sh

COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]

Expand Down
32 changes: 32 additions & 0 deletions platform/broadcom/docker-saiserver-brcm/saiserver_start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Copy from src/sonic-sairedis/syncd/scripts/syncd_start.sh
# Re-use the structure for syncd setup
# Use it to start saiserver
# Script to start syncd using supervisord
#

# Source the file that holds common code for systemd and supervisord
. /usr/bin/syncd_init_common.sh

get_saiserver_param()
{
IFS=' ' read -r -a array <<< "$CMD_ARGS"
for index in "${!array[@]}"
do
#echo "$index ${array[index]}"
if [[ "${array[index]}" == *"-p"* ]]; then
SAI_PROFILE="${array[index+1]}"
fi
if [[ "${array[index]}" == *"-m"* ]]; then
PORT_CONFIG="${array[index+1]}"
fi
done
}

ENABLE_SAITHRIFT=1
config_syncd
get_saiserver_param

echo exec /usr/sbin/saiserver -p ${SAI_PROFILE} -f ${PORT_CONFIG}
exec /usr/sbin/saiserver -p ${SAI_PROFILE} -f ${PORT_CONFIG}
#exec ${CMD} ${CMD_ARGS}
11 changes: 0 additions & 11 deletions platform/broadcom/docker-saiserver-brcm/start.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
#!/usr/bin/env bash
HWSKU_DIR=/usr/share/sonic/hwsku

start_bcm()
{
[ -e /dev/linux-bcm-knet ] || mknod /dev/linux-bcm-knet c 122 0
[ -e /dev/linux-user-bde ] || mknod /dev/linux-user-bde c 126 0
[ -e /dev/linux-kernel-bde ] || mknod /dev/linux-kernel-bde c 127 0
}

generate_profile()
{
# There are two ways to specify the contents of the SAI_INIT_CONFIG_FILE and they are mutually exclusive
Expand Down Expand Up @@ -35,10 +28,6 @@ generate_profile()
}

rm -f /var/run/rsyslogd.pid

supervisorctl start rsyslogd

generate_profile
start_bcm

supervisorctl start saiserver
2 changes: 1 addition & 1 deletion platform/broadcom/docker-saiserver-brcm/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ stdout_logfile=syslog
stderr_logfile=syslog

[program:saiserver]
command=/usr/sbin/saiserver -p /etc/sai.d/sai.profile -f /usr/share/sonic/hwsku/port_config.ini
command=/usr/bin/saiserver_start.sh
priority=3
autostart=false
autorestart=false
Expand Down