Why I did it why In order to apply different config across different platform, and use the code with a unified format, reuse syncd init script to init saiserver. How I did it how Reuse syncd init script How to verify it Test Test in DUT s6000 and dx010 with sonic 202205
This commit is contained in:
parent
5cc233d1cf
commit
3ebdaefa8c
@ -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_BULLSEYE)
|
||||
SONIC_DOCKER_IMAGES += $(DOCKER_SAISERVER_BRCM)
|
||||
SONIC_BULLSEYE_DOCKERS += $(DOCKER_SAISERVER_BRCM)
|
||||
|
@ -25,7 +25,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/"]
|
||||
|
||||
|
32
platform/broadcom/docker-saiserver-brcm/saiserver_start.sh
Executable file
32
platform/broadcom/docker-saiserver-brcm/saiserver_start.sh
Executable file
@ -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}
|
@ -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
|
||||
@ -35,10 +28,6 @@ generate_profile()
|
||||
}
|
||||
|
||||
rm -f /var/run/rsyslogd.pid
|
||||
|
||||
supervisorctl start rsyslogd
|
||||
|
||||
generate_profile
|
||||
start_bcm
|
||||
|
||||
supervisorctl start saiserver
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user