diff --git a/platform/broadcom/rules.dep b/platform/broadcom/rules.dep index 8e0ffc637dd..2c1731c21bc 100644 --- a/platform/broadcom/rules.dep +++ b/platform/broadcom/rules.dep @@ -39,4 +39,5 @@ include $(PLATFORM_PATH)/docker-syncd-brcm-dnx-rpc.dep ifeq ($(INCLUDE_GBSYNCD), y) include $(PLATFORM_PATH)/../components/docker-gbsyncd-credo.dep include $(PLATFORM_PATH)/../components/docker-gbsyncd-broncos.dep +include $(PLATFORM_PATH)/../components/docker-gbsyncd-milleniob.dep endif diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 26fb2076a91..7689dc8ecf0 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -39,6 +39,7 @@ include $(PLATFORM_PATH)/docker-syncd-brcm-dnx-rpc.mk ifeq ($(INCLUDE_GBSYNCD), y) include $(PLATFORM_PATH)/../components/docker-gbsyncd-credo.mk include $(PLATFORM_PATH)/../components/docker-gbsyncd-broncos.mk +include $(PLATFORM_PATH)/../components/docker-gbsyncd-milleniob.mk endif BCMCMD = bcmcmd diff --git a/platform/components/docker-gbsyncd-milleniob.dep b/platform/components/docker-gbsyncd-milleniob.dep new file mode 100644 index 00000000000..7935a854eb9 --- /dev/null +++ b/platform/components/docker-gbsyncd-milleniob.dep @@ -0,0 +1,12 @@ +DPATH := $($(DOCKER_GBSYNCD_MILLENIOB)_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) +DEP_FILES += platform/components/docker-gbsyncd-milleniob.mk +DEP_FILES += platform/components/docker-gbsyncd-milleniob.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(DPATH)) + +$(DOCKER_GBSYNCD_MILLENIOB)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_GBSYNCD_MILLENIOB)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_GBSYNCD_MILLENIOB)_DEP_FILES := $(DEP_FILES) + +$(eval $(call add_dbg_docker,$(DOCKER_GBSYNCD_MILLENIOB),$(DOCKER_GBSYNCD_MILLENIOB_DBG))) diff --git a/platform/components/docker-gbsyncd-milleniob.mk b/platform/components/docker-gbsyncd-milleniob.mk new file mode 100644 index 00000000000..45c3fa921be --- /dev/null +++ b/platform/components/docker-gbsyncd-milleniob.mk @@ -0,0 +1,40 @@ +LIBSAI_MILLENIOB_VERSION = 3.14.0 +LIBSAI_MILLENIOB = libsaimilleniob_$(LIBSAI_MILLENIOB_VERSION)_amd64.deb + +# Fill the PAI URL here +$(LIBSAI_MILLENIOB)_URL = + +ifneq ($($(LIBSAI_MILLENIOB)_URL),) +SONIC_ONLINE_DEBS += $(LIBSAI_MILLENIOB) + +DOCKER_GBSYNCD_MILLENIOB_STEM = docker-gbsyncd-milleniob +DOCKER_GBSYNCD_MILLENIOB = $(DOCKER_GBSYNCD_MILLENIOB_STEM).gz +DOCKER_GBSYNCD_MILLENIOB_DBG = $(DOCKER_GBSYNCD_MILLENIOB_STEM)-$(DBG_IMAGE_MARK).gz + +$(DOCKER_GBSYNCD_MILLENIOB)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) + +$(DOCKER_GBSYNCD_MILLENIOB)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BOOKWORM) + +$(DOCKER_GBSYNCD_MILLENIOB)_DBG_DEPENDS += $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_DEPENDS) + +$(DOCKER_GBSYNCD_MILLENIOB)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_IMAGE_PACKAGES) + +SONIC_DOCKER_IMAGES += $(DOCKER_GBSYNCD_MILLENIOB) +SONIC_BOOKWORM_DOCKERS += $(DOCKER_GBSYNCD_MILLENIOB) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_GBSYNCD_MILLENIOB) + +SONIC_DOCKER_DBG_IMAGES += $(DOCKER_GBSYNCD_MILLENIOB_DBG) +SONIC_BOOKWORM_DBG_DOCKERS += $(DOCKER_GBSYNCD_MILLENIOB_DBG) +SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_GBSYNCD_MILLENIOB_DBG) + +$(DOCKER_GBSYNCD_MILLENIOB)_CONTAINER_NAME = gbsyncd +$(DOCKER_GBSYNCD_MILLENIOB)_RUN_OPT += --privileged -t +$(DOCKER_GBSYNCD_MILLENIOB)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_GBSYNCD_MILLENIOB)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +$(DOCKER_GBSYNCD_MILLENIOB)_RUN_OPT += -v /host/warmboot:/var/warmboot + +$(DOCKER_GBSYNCD_MILLENIOB)_VERSION = 1.0.0 +$(DOCKER_GBSYNCD_MILLENIOB)_PACKAGE_NAME = gbsyncd-milleniob +$(DOCKER_GBSYNCD_MILLENIOB)_PATH = $(PLATFORM_PATH)/../components/docker-gbsyncd-milleniob +$(DOCKER_GBSYNCD_MILLENIOB)_DEPENDS += $(SYNCD) $(LIBSAI_MILLENIOB) +endif diff --git a/platform/components/docker-gbsyncd-milleniob/Dockerfile.j2 b/platform/components/docker-gbsyncd-milleniob/Dockerfile.j2 new file mode 100644 index 00000000000..faab86ae4c8 --- /dev/null +++ b/platform/components/docker-gbsyncd-milleniob/Dockerfile.j2 @@ -0,0 +1,42 @@ +FROM docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} + +ARG docker_container_name + +## 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_milleniob_debs.split(' ') -%} +{% if 'libsaibcm' not in deb -%} +debs/{{ deb }}{{' '}} +{%- endif %} +{%- endfor -%} +debs/ + +RUN dpkg -i \ +{% for deb in docker_gbsyncd_milleniob_debs.split(' ') -%} +{% if 'libsaibcm' not in deb -%} +debs/{{ deb }}{{' '}} +{%- endif %} +{%- endfor %} + +COPY ["docker-init.sh", "/usr/bin/"] +COPY ["start.sh", "/usr/bin/"] +COPY ["bcmsh", "/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"] +COPY ["files/dsserve", "/usr/bin/"] +RUN chmod +x /usr/bin/dsserve + +## 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"] diff --git a/platform/components/docker-gbsyncd-milleniob/bcmsh b/platform/components/docker-gbsyncd-milleniob/bcmsh new file mode 100755 index 00000000000..bad7a105195 --- /dev/null +++ b/platform/components/docker-gbsyncd-milleniob/bcmsh @@ -0,0 +1,40 @@ +#!/bin/bash +usage="$(basename "$0") [-h] [-q] [-t timeout] -- interactive shell for bcm service + +where: + -h show this help text + -t inactivity timeout in seconds (default 300 seconds, 0 for no timeout) + -q quite, no banner (default: verbose)" + +banner="Press Enter to show prompt. +Press Ctrl+C to exit. +NOTICE: Only one bcmsh or bcmcmd can connect to the shell at same time. +" + +# Default verbose +quiet=false +timeout=300 + +while getopts 'hqt:' option; do + case "$option" in + h) echo "$usage" + exit + ;; + q) quiet=true + ;; + t) timeout=$OPTARG + ;; + \?) printf "illegal option: -%s\n" "$OPTARG" >&2 + echo "$usage" >&2 + exit 1 + ;; + esac +done +shift $((OPTIND - 1)) + +if [ "$quiet" = false ]; then + echo "$banner" +fi + +/usr/bin/socat -T$timeout readline UNIX-CONNECT:/var/run/sswsyncd/sswgbsyncd.socket + diff --git a/platform/components/docker-gbsyncd-milleniob/critical_processes.j2 b/platform/components/docker-gbsyncd-milleniob/critical_processes.j2 new file mode 100644 index 00000000000..d1163a9c304 --- /dev/null +++ b/platform/components/docker-gbsyncd-milleniob/critical_processes.j2 @@ -0,0 +1,2 @@ +program:dsserve +program:syncd diff --git a/platform/components/docker-gbsyncd-milleniob/docker-init.sh b/platform/components/docker-gbsyncd-milleniob/docker-init.sh new file mode 100755 index 00000000000..93a1b931dfa --- /dev/null +++ b/platform/components/docker-gbsyncd-milleniob/docker-init.sh @@ -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 diff --git a/platform/components/docker-gbsyncd-milleniob/start.sh b/platform/components/docker-gbsyncd-milleniob/start.sh new file mode 100755 index 00000000000..ac7de02dcdc --- /dev/null +++ b/platform/components/docker-gbsyncd-milleniob/start.sh @@ -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 diff --git a/platform/components/docker-gbsyncd-milleniob/supervisord.conf.j2 b/platform/components/docker-gbsyncd-milleniob/supervisord.conf.j2 new file mode 100644 index 00000000000..ec83eaf1a92 --- /dev/null +++ b/platform/components/docker-gbsyncd-milleniob/supervisord.conf.j2 @@ -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=MILLENIO_DEVICE_PATH=/usr/lib,MILLENIOB_DEVICE_PATH=/usr/lib +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 +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog +dependent_startup=true +dependent_startup_wait_for=start:exited