diff --git a/device/cisco/.gitkeep b/device/cisco/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/platform/checkout/cisco-smartswitch.ini b/platform/checkout/cisco-smartswitch.ini new file mode 100644 index 00000000000..3ffed1d1a47 --- /dev/null +++ b/platform/checkout/cisco-smartswitch.ini @@ -0,0 +1,7 @@ +# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 + +[module] +repo=git@github.com:Cisco-8000-sonic/platform-cisco-8000.git +ref=0.master.1.1 +path=platform/cisco/src diff --git a/platform/checkout/cisco.ini b/platform/checkout/cisco.ini new file mode 100644 index 00000000000..17642c70719 --- /dev/null +++ b/platform/checkout/cisco.ini @@ -0,0 +1,7 @@ +# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 + +[module] +repo=git@github.com:Cisco-8000-sonic/platform-cisco-8000.git +ref=0.cisco.master.1.0.0 +path=platform/cisco/src diff --git a/platform/cisco/.gitignore b/platform/cisco/.gitignore new file mode 100644 index 00000000000..712fe60a6e1 --- /dev/null +++ b/platform/cisco/.gitignore @@ -0,0 +1,2 @@ +src/ +platform_metadata diff --git a/platform/cisco/docker-gbsyncd-cisco.dep b/platform/cisco/docker-gbsyncd-cisco.dep new file mode 100644 index 00000000000..923c97821c1 --- /dev/null +++ b/platform/cisco/docker-gbsyncd-cisco.dep @@ -0,0 +1,15 @@ +# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 + +DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_PATH)/docker-gbsyncd-cisco.mk $(PLATFORM_PATH)/docker-gbsyncd-cisco.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(addprefix $(PLATFORM_PATH)/,$(shell cd $(PLATFORM_PATH) && git ls-files $(DOCKER_GBSYNCD_BASE_STEM))) + +$(DOCKER_GBSYNCD_BASE)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_GBSYNCD_BASE)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_GBSYNCD_BASE)_DEP_FILES := $(DEP_FILES) + +# The DBG version has the same dependencies +$(DOCKER_GBSYNCD_BASE_DBG)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_GBSYNCD_BASE_DBG)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_GBSYNCD_BASE_DBG)_DEP_FILES := $(DEP_FILES) diff --git a/platform/cisco/docker-gbsyncd-cisco.mk b/platform/cisco/docker-gbsyncd-cisco.mk new file mode 100644 index 00000000000..98e9966d670 --- /dev/null +++ b/platform/cisco/docker-gbsyncd-cisco.mk @@ -0,0 +1,42 @@ +# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 + +# docker image for Cisco gbsyncd + +DOCKER_GBSYNCD_PLATFORM_CODE = cisco + +include $(PLATFORM_PATH)/../template/docker-gbsyncd-bookworm.mk + +$(DOCKER_GBSYNCD_BASE)_PATH := $(PLATFORM_PATH)/docker-gbsyncd-$(DOCKER_GBSYNCD_PLATFORM_CODE) + +$(DOCKER_GBSYNCD_BASE)_VERSION = 1.0.0 +$(DOCKER_GBSYNCD_BASE)_PACKAGE_NAME = gbsyncd-$(DOCKER_GBSYNCD_PLATFORM_CODE) + +$(DOCKER_GBSYNCD_BASE)_DEPENDS += $(SYNCD) \ + $(CISCO_WB_BSP_PYLIB) \ + $(LIBSSL) \ + $(GB_SAI) \ + $(YAML) + +$(DOCKER_SYNCD)_DBG_DEPENDS += \ + $(SYNCD_DBG) \ + $(LIBSWSSCOMMON_DBG) \ + $(LIBSAIMETADATA_DBG) \ + $(LIBSAIREDIS_DBG) + +$(DOCKER_GBSYNCD_BASE)_RUN_OPT += \ + -v /var/cache/cisco:/var/cache/cisco \ + -v /opt/cisco:/opt/cisco:ro \ + -v /sys/kernel/debug:/sys/kernel/debug:ro \ + -v /usr/lib/cisco:/usr/lib/cisco \ + -v /opt/cisco/silicon-one:/opt/cisco/silicon-one \ + -e LD_LIBRARY_PATH=/usr/lib/:/opt/cisco/lib:/usr/lib/cisco \ + -v /dev/shm:/dev/shm \ + --env "OPTICS_DEBUG_PORT"=7500 + +$(DOCKER_GBSYNCD_BASE)_APT_PACKAGES += \ + i2c-tools \ + libcurl4-openssl-dev \ + libjansson4 \ + libpci3 \ + libyaml diff --git a/platform/cisco/docker-gbsyncd-cisco/Dockerfile.j2 b/platform/cisco/docker-gbsyncd-cisco/Dockerfile.j2 new file mode 100644 index 00000000000..f030fe5d099 --- /dev/null +++ b/platform/cisco/docker-gbsyncd-cisco/Dockerfile.j2 @@ -0,0 +1,36 @@ +# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 + +FROM docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update + +RUN apt-get install -y \ + iproute2 \ + libcap2-bin \ + gdb + +COPY \ +{% for deb in docker_gbsyncd_cisco_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -i \ +{% for deb in docker_gbsyncd_cisco_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} + + +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] +COPY ["critical_processes", "/etc/supervisor/"] +COPY ["start.sh", "/usr/bin/"] + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs + +ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/cisco/docker-gbsyncd-cisco/critical_processes b/platform/cisco/docker-gbsyncd-cisco/critical_processes new file mode 100644 index 00000000000..bdd6903c569 --- /dev/null +++ b/platform/cisco/docker-gbsyncd-cisco/critical_processes @@ -0,0 +1 @@ +program:syncd diff --git a/platform/cisco/docker-gbsyncd-cisco/start.sh b/platform/cisco/docker-gbsyncd-cisco/start.sh new file mode 100755 index 00000000000..b872cfbbf07 --- /dev/null +++ b/platform/cisco/docker-gbsyncd-cisco/start.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 + +HWSKU_DIR=/usr/share/sonic/hwsku + +mkdir -p /etc/sai.d/ + +# Create/Copy the pai.profile to /etc/sai.d/pai.profile +if [ -f $HWSKU_DIR/pai.profile.j2 ]; then + sonic-cfggen -d -t $HWSKU_DIR/pai.profile.j2 > /etc/sai.d/pai.profile +else + if [ -f $HWSKU_DIR/pai.profile ]; then + cp $HWSKU_DIR/pai.profile /etc/sai.d/pai.profile + fi +fi diff --git a/platform/cisco/docker-gbsyncd-cisco/supervisord.conf b/platform/cisco/docker-gbsyncd-cisco/supervisord.conf new file mode 100644 index 00000000000..d8281b15078 --- /dev/null +++ b/platform/cisco/docker-gbsyncd-cisco/supervisord.conf @@ -0,0 +1,53 @@ +# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 + +[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 +buffer_size=1024 + +[eventlistener:supervisor-proc-exit-listener] +command=/usr/local/bin/supervisor-proc-exit-listener --container-name gbsyncd +events=PROCESS_STATE_EXITED,PROCESS_STATE_RUNNING +autostart=true +autorestart=unexpected +buffer_size=1024 + +[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] +command=/usr/bin/syncd -s -p /etc/sai.d/pai.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 diff --git a/platform/cisco/docker-orchagent.mk b/platform/cisco/docker-orchagent.mk new file mode 100644 index 00000000000..775b6bebc40 --- /dev/null +++ b/platform/cisco/docker-orchagent.mk @@ -0,0 +1,10 @@ +# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 + +# docker image for orchagent + +# +# DOCKER_ORCHAGENT comes from rules/docker-orchagent.mk which is +# included before the platform rules.mk +# +$(DOCKER_ORCHAGENT)_RUN_OPT += -v /var/cache/cisco:/var/cache/cisco diff --git a/platform/cisco/docker-platform-monitor.dep b/platform/cisco/docker-platform-monitor.dep new file mode 100644 index 00000000000..d99d745a69e --- /dev/null +++ b/platform/cisco/docker-platform-monitor.dep @@ -0,0 +1,14 @@ +# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 + +PLATFORM_SRC_PATH ?= $(PLATFORM_PATH)/src + +DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_PATH)/docker-platform-monitor.mk $(PLATFORM_PATH)/docker-platform-monitor.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(addprefix $(PLATFORM_SRC_PATH)/,$(shell cd $(PLATFORM_SRC_PATH) && git ls-files $(CISCO_8000_PLATFORM_MODULE_REL_PATH))) +DEP_FILES += $(FILES_PATH)/$(CISCO_WB_BSP_PYLIB) + + +$(DOCKER_PLATFORM_MONITOR)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_PLATFORM_MONITOR)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_PLATFORM_MONITOR)_DEP_FILES := $(DEP_FILES) diff --git a/platform/cisco/docker-platform-monitor.mk b/platform/cisco/docker-platform-monitor.mk new file mode 100644 index 00000000000..59db768c7a8 --- /dev/null +++ b/platform/cisco/docker-platform-monitor.mk @@ -0,0 +1,35 @@ +# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 + +# +# DOCKER_PLATFORM_MONITOR comes from rules/docker-platform-monitor.mk which is +# included before the platform rules.mk +# +$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(CISCO_PACIFIC_WHEEL) + +# Additional platform specific libraries. +$(DOCKER_PLATFORM_MONITOR)_DEPENDS += \ + $(CISCO_WB_BSP_PYLIB) \ + $(LIBSSL) \ + $(YAML) \ + $(IPUTILS-PING) + +CISCO_BSP_PYTHON_MODULE_PATH := /opt/cisco/lib/python + +$(DOCKER_PLATFORM_MONITOR)_RUN_OPT += \ + -v /var/cache/cisco:/var/cache/cisco \ + -v /opt/cisco:/opt/cisco:ro \ + -v /usr/lib/cisco:/usr/lib/cisco \ + -v /opt/cisco/lib/.bundled-bookworm:/opt/cisco/lib/.bundled-bookworm:ro \ + -v $(CISCO_BSP_PYTHON_MODULE_PATH):$(CISCO_BSP_PYTHON_MODULE_PATH) \ + -v /opt/cisco/silicon-one:/opt/cisco/silicon-one \ + -e LD_LIBRARY_PATH=/opt/cisco/lib/.bundled-bookworm:/usr/lib:/usr/lib/cisco:/opt/cisco/lib \ + -e PYTHONPATH=$(CISCO_BSP_PYTHON_MODULE_PATH):$$PYTHONPATH \ + -v /dev/shm:/dev/shm \ + --env "OPTICS_DEBUG_PORT"=7500 + +$(DOCKER_PLATFORM_MONITOR)_APT_PACKAGES += \ + i2c-tools \ + libcurl4-openssl-dev \ + libjansson4 \ + libpci3 diff --git a/platform/cisco/docker-syncd-cisco-rpc.dep b/platform/cisco/docker-syncd-cisco-rpc.dep new file mode 100644 index 00000000000..fa5797b6b39 --- /dev/null +++ b/platform/cisco/docker-syncd-cisco-rpc.dep @@ -0,0 +1,11 @@ +# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 + +DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_PATH)/docker-syncd-cisco-rpc.mk $(PLATFORM_PATH)/docker-syncd-cisco-rpc.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +# N.B. we need to enter the platform directory first, since it's a git submodule +DEP_FILES += $(addprefix $(PLATFORM_PATH)/,$(shell cd $(PLATFORM_PATH) && git ls-files $(DOCKER_SYNCD_CISCO_RPC_STEM))) + +$(DOCKER_SYNCD_CISCO_RPC)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_SYNCD_CISCO_RPC)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_SYNCD_CISCO_RPC)_DEP_FILES := $(DEP_FILES) diff --git a/platform/cisco/docker-syncd-cisco-rpc.mk b/platform/cisco/docker-syncd-cisco-rpc.mk new file mode 100644 index 00000000000..54fe2e0f9f0 --- /dev/null +++ b/platform/cisco/docker-syncd-cisco-rpc.mk @@ -0,0 +1,42 @@ +# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 + +# docker image for syncd with rpc + +DOCKER_SYNCD_CISCO_RPC_STEM = docker-syncd-cisco-rpc +DOCKER_SYNCD_CISCO_RPC = $(DOCKER_SYNCD_CISCO_RPC_STEM).gz +$(DOCKER_SYNCD_CISCO_RPC)_PATH = $(PLATFORM_PATH)/$(DOCKER_SYNCD_CISCO_RPC_STEM) +$(DOCKER_SYNCD_CISCO_RPC)_DEPENDS += $(SYNCD_RPC) +$(DOCKER_SYNCD_CISCO_RPC)_PYTHON_WHEELS += $(PTF_PY3) +$(DOCKER_SYNCD_CISCO_RPC)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) +ifeq ($(INSTALL_DEBUG_TOOLS), y) +$(DOCKER_SYNCD_CISCO_RPC)_DEPENDS += $(SYNCD_RPC_DBG) \ + $(LIBSWSSCOMMON_DBG) \ + $(LIBSAIMETADATA_DBG) \ + $(LIBSAIREDIS_DBG) +endif + +$(DOCKER_SYNCD_CISCO_RPC)_PYTHON_DEBS += $(CISCO_SFPD) +$(DOCKER_SYNCD_CISCO_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_CISCO_RPC) +SONIC_BOOKWORM_DOCKERS += $(DOCKER_SYNCD_CISCO_RPC) +ifeq ($(ENABLE_SYNCD_RPC),y) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CISCO_RPC) +endif + +SONIC_BOOKWORM_DOCKERS += $(DOCKER_SYNCD_CISCO_RPC) + +$(DOCKER_SYNCD_CISCO_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_CISCO_RPC)_VERSION = 1.0.0+rpc +$(DOCKER_SYNCD_CISCO_RPC)_PACKAGE_NAME = syncd +$(DOCKER_SYNCD_CISCO_RPC)_RUN_OPT += --privileged -t +$(DOCKER_SYNCD_CISCO_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_SYNCD_CISCO_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +$(DOCKER_SYNCD_CISCO_RPC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd +$(DOCKER_SYNCD_CISCO_RPC)_RUN_OPT += -v /host/warmboot:/var/warmboot +$(DOCKER_SYNCD_CISCO_RPC)_RUN_OPT += -v /var/cache/cisco:/var/cache/cisco +$(DOCKER_SYNCD_CISCO_RPC)_RUN_OPT += -v /usr/lib/cisco:/usr/lib/cisco +$(DOCKER_SYNCD_CISCO_RPC)_RUN_OPT += -v /opt/cisco/silicon-one:/opt/cisco/silicon-one +$(DOCKER_SYNCD_CISCO_RPC)_RUN_OPT += -v /var/run/config_gen:/var/run/config_gen +$(DOCKER_SYNCD_CISCO_RPC)_RUN_OPT += -e LD_LIBRARY_PATH=/usr/lib/:/usr/lib/cisco/ +$(DOCKER_SYNCD_CISCO_RPC)_RUN_OPT += -v /usr/release_info:/usr/release_info diff --git a/platform/cisco/docker-syncd-cisco-rpc/Dockerfile.j2 b/platform/cisco/docker-syncd-cisco-rpc/Dockerfile.j2 new file mode 100644 index 00000000000..95cc17cba49 --- /dev/null +++ b/platform/cisco/docker-syncd-cisco-rpc/Dockerfile.j2 @@ -0,0 +1,86 @@ +# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 + +{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} +FROM docker-syncd-cisco-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get purge -y syncd + +## Pre-install the fundamental packages +RUN apt-get update \ + && apt-get -y install \ + net-tools \ + python3-pip \ + python3-dev \ + python-is-python3 \ + python3-scapy \ + build-essential \ + libssl-dev \ + libffi-dev \ + wget \ + cmake \ + libnanomsg5 \ + libnanomsg-dev \ + libthrift-0.17.0 + +RUN pip3 install --upgrade pip + + +{% if docker_syncd_cisco_rpc_debs.strip() -%} +# Copy locally-built Debian package dependencies +{{ copy_files("debs/", docker_syncd_cisco_rpc_debs.split(' '), "/debs/") }} +{% endif %} + +{% if docker_syncd_cisco_rpc_pydebs.strip() -%} +# Copy locally-built Debian package dependencies +{{ copy_files("python-debs/", docker_syncd_cisco_rpc_pydebs.split(' '), "/debs/") }} +{% endif %} + +{% if docker_syncd_cisco_rpc_debs.strip() -%} +# Install locally-built Debian packages and implicitly install their dependencies +{{ install_debian_packages(docker_syncd_cisco_rpc_debs.split(' ')) }} +{% endif %} + +{% if docker_syncd_cisco_rpc_pydebs.strip() -%} +# Install locally-built Debian packages and implicitly install their dependencies +{{ install_debian_packages(docker_syncd_cisco_rpc_pydebs.split(' ')) }} +{% endif %} + +{% if docker_syncd_cisco_rpc_whls.strip() -%} +# Copy locally-built Python wheel dependencies +{{ copy_files("python-wheels/", docker_syncd_cisco_rpc_whls.split(' '), "/python-wheels/") }} + +# Install locally-built Python wheel dependencies +{{ install_python_wheels(docker_syncd_cisco_rpc_whls.split(' ')) }} +{% endif %} + +RUN pip3 install cffi==1.16.0 \ + && pip3 install wheel \ + && pip3 install nnpy \ + && mkdir -p /opt \ + && cd /opt \ + && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py \ + && apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \ + && rm -rf /root/deps + +COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] + +## Clean up +RUN apt-get -y purge \ + cmake \ + libssl-dev \ + libffi-dev \ + python3-dev \ + python3-pip \ + libthrift-dev \ + build-essential + +RUN apt-get clean -y && \ + apt-get autoclean -y && \ + apt-get autoremove -y && \ + rm -rf /debs + +ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/cisco/docker-syncd-cisco-rpc/ptf_nn_agent.conf b/platform/cisco/docker-syncd-cisco-rpc/ptf_nn_agent.conf new file mode 100644 index 00000000000..4be09c04336 --- /dev/null +++ b/platform/cisco/docker-syncd-cisco-rpc/ptf_nn_agent.conf @@ -0,0 +1,13 @@ +# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 + +[program:ptf_nn_agent] +command=/usr/bin/python /opt/ptf_nn_agent.py --device-socket 1@tcp://0.0.0.0:10900 -i 1-3@Ethernet12 --set-iface-rcv-buffer=109430400 +process_name=ptf_nn_agent +stdout_logfile=/tmp/ptf_nn_agent.out.log +stderr_logfile=/tmp/ptf_nn_agent.err.log +redirect_stderr=false +autostart=true +autorestart=true +startsecs=1 +numprocs=1 diff --git a/platform/cisco/docker-syncd-cisco.dep b/platform/cisco/docker-syncd-cisco.dep new file mode 100644 index 00000000000..afb64d621fe --- /dev/null +++ b/platform/cisco/docker-syncd-cisco.dep @@ -0,0 +1,13 @@ +# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 + +DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_PATH)/docker-syncd-cisco.mk $(PLATFORM_PATH)/docker-syncd-cisco.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +# N.B. we need to enter the platform directory first, since it's a git submodule +DEP_FILES += $(addprefix $(PLATFORM_PATH)/,$(shell cd $(PLATFORM_PATH) && git ls-files $(DOCKER_SYNCD_BASE_STEM))) + +$(DOCKER_SYNCD_BASE)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_SYNCD_BASE)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_SYNCD_BASE)_DEP_FILES := $(DEP_FILES) + +$(eval $(call add_dbg_docker,$(DOCKER_SYNCD_BASE),$(DOCKER_SYNCD_BASE_DBG))) diff --git a/platform/cisco/docker-syncd-cisco.mk b/platform/cisco/docker-syncd-cisco.mk new file mode 100644 index 00000000000..1f363a90d3e --- /dev/null +++ b/platform/cisco/docker-syncd-cisco.mk @@ -0,0 +1,35 @@ +# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 + +# docker image for syncd + +DOCKER_SYNCD_PLATFORM_CODE = cisco +include $(PLATFORM_PATH)/../template/docker-syncd-bookworm.mk + +# docker-syncd-bookworm.mk sets $(DOCKER_SYNCD_BASE)_PATH with '=' (lazy); pin the +# Dockerfile directory under the SONiC platform tree with ':='. +$(DOCKER_SYNCD_BASE)_PATH := $(PLATFORM_PATH)/docker-syncd-$(DOCKER_SYNCD_PLATFORM_CODE) + +$(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 +$(DOCKER_SYNCD_BASE)_PACKAGE_NAME = syncd + +$(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD) +$(DOCKER_SYNCD_BASE)_DBG_DEPENDS += \ + $(SYNCD_DBG) \ + $(LIBSWSSCOMMON_DBG) \ + $(LIBSAIMETADATA_DBG) \ + $(LIBSAIREDIS_DBG) + +$(DOCKER_SYNCD_BASE)_FILES += $(RDB-CLI) + +$(DOCKER_SYNCD_BASE)_RUN_OPT += -v /sys:/sys:rw +$(DOCKER_SYNCD_BASE)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd +$(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot +$(DOCKER_SYNCD_BASE)_RUN_OPT += -v /var/cache/cisco:/var/cache/cisco +$(DOCKER_SYNCD_BASE)_RUN_OPT += -v /usr/lib/cisco:/usr/lib/cisco +$(DOCKER_SYNCD_BASE)_RUN_OPT += -v /opt/cisco/silicon-one:/opt/cisco/silicon-one +$(DOCKER_SYNCD_BASE)_RUN_OPT += -v /opt/cisco/data:/opt/cisco/data:ro +$(DOCKER_SYNCD_BASE)_RUN_OPT += -v /var/run/config_gen:/var/run/config_gen +$(DOCKER_SYNCD_BASE)_RUN_OPT += -e LD_LIBRARY_PATH=/usr/lib/:/usr/lib/cisco/ +$(DOCKER_SYNCD_BASE)_RUN_OPT += -v /usr/release_info:/usr/release_info +$(DOCKER_SYNCD_BASE)_RUN_OPT += -v /var/dump/:/var/dump/ diff --git a/platform/cisco/docker-syncd-cisco/Dockerfile.j2 b/platform/cisco/docker-syncd-cisco/Dockerfile.j2 new file mode 100755 index 00000000000..3874ca1c58e --- /dev/null +++ b/platform/cisco/docker-syncd-cisco/Dockerfile.j2 @@ -0,0 +1,66 @@ +# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 + +{% from "dockers/dockerfile-macros.j2" import install_debian_packages %} + +FROM docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update + +COPY \ + {% for deb in docker_syncd_cisco_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN apt-get -y install libgrpc++1.51 libabsl-dev + +# Install locally-built Debian packages and implicitly install their dependencies +{{ install_debian_packages(docker_syncd_cisco_debs.split(' ')) }} + +## TODO: add kmod into Depends +RUN apt-get install -yf kmod + +COPY ["critical_processes", "/etc/supervisor/"] + +COPY start.sh \ + files/rdb-cli \ + /usr/bin/ + +RUN chmod +x /usr/bin/rdb-cli + +COPY ["supervisord.conf", "dshell_client.conf", "/etc/supervisor/conf.d/"] + +RUN apt-get install -y \ + git-core \ + gdb \ + gcc \ + make \ + screen \ + sudo \ + net-tools \ + tcpdump \ + python3 \ + python3-pip \ + python3-yaml \ + scapy \ + python3-pytest \ + libgtk-3-dev \ + unzip \ + pkg-config \ + binutils \ + wget \ + python3-grpcio \ + python3-dev + +## For dshell_client gRPC +RUN pip3 install prettytable terminaltables decor + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs + +ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/cisco/docker-syncd-cisco/critical_processes b/platform/cisco/docker-syncd-cisco/critical_processes new file mode 100644 index 00000000000..bdd6903c569 --- /dev/null +++ b/platform/cisco/docker-syncd-cisco/critical_processes @@ -0,0 +1 @@ +program:syncd diff --git a/platform/cisco/docker-syncd-cisco/dshell_client.conf b/platform/cisco/docker-syncd-cisco/dshell_client.conf new file mode 100644 index 00000000000..44f86271a98 --- /dev/null +++ b/platform/cisco/docker-syncd-cisco/dshell_client.conf @@ -0,0 +1,23 @@ +# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 + +[program:dshell_client] +command=/opt/cisco/syncd/bin/dshell_client.py +priority=6 +autostart=true +autorestart=true +startsecs=0 +stdout_logfile=syslog +stderr_logfile=syslog + +[program:puntpkthandler] +environment=GOTRACEBACK="system" +command=/opt/cisco/syncd/bin/puntpkthandler +priority=6 +autostart=false +autorestart=true +startsecs=0 +stdout_logfile=syslog +stderr_logfile=syslog +dependent_startup=true +dependent_startup_wait_for=syncd:running diff --git a/platform/cisco/docker-syncd-cisco/start.sh b/platform/cisco/docker-syncd-cisco/start.sh new file mode 100755 index 00000000000..b11d1e756be --- /dev/null +++ b/platform/cisco/docker-syncd-cisco/start.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 + +PLATFORM_DIR=/usr/share/sonic/platform +HWSKU_DIR=/usr/share/sonic/hwsku + +SYNCD_SOCKET_FILE=/var/run/sswsyncd/sswsyncd.socket + +# Remove stale files if they exist +rm -f /var/run/rsyslogd.pid +rm -f ${SYNCD_SOCKET_FILE} + +supervisorctl start rsyslogd + +# Remove dshell_client.conf on platforms that do not support dshell_client +if [ -f /etc/init.d/sxdkernel ]; then + rm -f /etc/supervisor/conf.d/dshell_client.conf + supervisorctl reread + supervisorctl update + echo "dshell_client and puntpkthandler disabled for SX driver" +fi + +mkdir -p /etc/sai.d/ + +# Create/Copy the sai.profile to /etc/sai.d/sai.profile +if [ -f $HWSKU_DIR/sai.profile.j2 ]; then + sonic-cfggen -d -t $HWSKU_DIR/sai.profile.j2 > /etc/sai.d/sai.profile +else + if [ -f $HWSKU_DIR/sai.profile ]; then + cp $HWSKU_DIR/sai.profile /etc/sai.d/sai.profile + fi +fi + +if grep -q '^model name.: VXR$' /proc/cpuinfo; then + # if eth4 exists, wait until IPv4 address gets assigned + if ip link show eth4; then + for _ in {1..6}; do + if inet=$(ip addr show eth4 | grep 'inet '); then + break + fi + echo Waiting for eth4 to get configured + sleep 5 + done + if [ "$inet" == "" ]; then + echo "WARNING: eth4 did not get configured" + fi + fi + supervisorctl start vxr_simulator +fi + +ln -sf /opt/cisco/syncd/bin/dshell_client.py /usr/bin/dshell_client.py + +supervisorctl start syncd + +# Flag start of syncd process for logging infra +echo "1">/var/cache/cisco/syncd_started diff --git a/platform/cisco/docker-syncd-cisco/supervisord.conf b/platform/cisco/docker-syncd-cisco/supervisord.conf new file mode 100644 index 00000000000..37f0a0f7c7a --- /dev/null +++ b/platform/cisco/docker-syncd-cisco/supervisord.conf @@ -0,0 +1,61 @@ +# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 + +[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 +buffer_size=1024 + +[eventlistener:supervisor-proc-exit-listener] +command=/usr/local/bin/supervisor-proc-exit-listener --container-name syncd +events=PROCESS_STATE_EXITED,PROCESS_STATE_RUNNING +autostart=true +autorestart=unexpected +buffer_size=1024 + +[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:rsyslogd] +command=/usr/sbin/rsyslogd -n -iNONE +priority=1 +autostart=false +autorestart=unexpected +stdout_logfile=syslog +stderr_logfile=syslog +dependent_startup=true + +[program:vxr_simulator] +command=bash -c 'BASE_OUTPUT_DIR="/opt/cisco/silicon-one/" /opt/cisco/syncd/bin/sonic_nsim.py' +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:syncd] +command=/usr/bin/syncd_start.sh +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog +dependent_startup=true +dependent_startup_wait_for=start:exited diff --git a/platform/cisco/docker-syncd-rpc.dep b/platform/cisco/docker-syncd-rpc.dep new file mode 100644 index 00000000000..568843fb231 --- /dev/null +++ b/platform/cisco/docker-syncd-rpc.dep @@ -0,0 +1,10 @@ +# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 + +DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_PATH)/docker-syncd-rpc.mk $(PLATFORM_PATH)/docker-syncd-rpc.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(addprefix $(PLATFORM_PATH)/,$(shell cd $(PLATFORM_PATH) && git ls-files $(DOCKER_SYNCD_RPC_BASE))) + +$(DOCKER_SYNCD_RPC)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_SYNCD_RPC)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_SYNCD_RPC)_DEP_FILES := $(DEP_FILES) diff --git a/platform/cisco/docker-syncd.dep b/platform/cisco/docker-syncd.dep new file mode 100644 index 00000000000..c24d83e1231 --- /dev/null +++ b/platform/cisco/docker-syncd.dep @@ -0,0 +1,14 @@ +# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 + +DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_PATH)/docker-syncd.mk $(PLATFORM_PATH)/docker-syncd.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(addprefix $(PLATFORM_PATH)/,$(shell cd $(PLATFORM_PATH) && git ls-files $(DOCKER_SYNCD_BASE))) + +$(DOCKER_SYNCD)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_SYNCD)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_SYNCD)_DEP_FILES := $(DEP_FILES) + +$(DOCKER_SYNCD_DBG)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_SYNCD_DBG)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_SYNCD_DBG)_DEP_FILES := $(DEP_FILES) diff --git a/platform/cisco/rules.dep b/platform/cisco/rules.dep new file mode 100644 index 00000000000..11291d470c6 --- /dev/null +++ b/platform/cisco/rules.dep @@ -0,0 +1,17 @@ +# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 + +PLATFORM_SRC_PATH ?= $(PLATFORM_PATH)/src + +include $(PLATFORM_SRC_PATH)/python-wheels.dep +include $(PLATFORM_SRC_PATH)/platform-modules-cisco.dep +include $(PLATFORM_PATH)/docker-platform-monitor.dep +include $(PLATFORM_PATH)/docker-syncd.dep +include $(PLATFORM_PATH)/docker-syncd-cisco.dep +include $(PLATFORM_PATH)/docker-syncd-cisco-rpc.dep +include $(PLATFORM_PATH)/docker-gbsyncd-cisco.dep +include $(PLATFORM_PATH)/sonic-device-data.dep + +ifeq ($(ENABLE_SAI_THRIFT),y) +-include $(PLATFORM_SRC_PATH)/libsaithrift-dev.dep +endif diff --git a/platform/cisco/rules.mk b/platform/cisco/rules.mk new file mode 100644 index 00000000000..688ee342eba --- /dev/null +++ b/platform/cisco/rules.mk @@ -0,0 +1,13 @@ +# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 + +# platform-cisco repo sources under $(PLATFORM_SRC_PATH) +PLATFORM_SRC_PATH := $(PLATFORM_PATH)/src +export PLATFORM_SRC_PATH + +include $(PLATFORM_SRC_PATH)/rules.mk + +include $(PLATFORM_PATH)/docker-platform-monitor.mk +include $(PLATFORM_PATH)/docker-syncd-cisco.mk +include $(PLATFORM_PATH)/docker-syncd-cisco-rpc.mk +include $(PLATFORM_PATH)/docker-gbsyncd-cisco.mk diff --git a/platform/cisco/sonic-device-data.dep b/platform/cisco/sonic-device-data.dep new file mode 100644 index 00000000000..1f11c0055de --- /dev/null +++ b/platform/cisco/sonic-device-data.dep @@ -0,0 +1,10 @@ +# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 + +PLATFORM_SRC_PATH ?= $(PLATFORM_PATH)/src + +# We augment the DEP_FILES list to include cisco-8000 device files +# In publicly exposed platform repos, we wouldn't need this, as it's covered +# by rules/sonic-device-data.dep in sonic-buildimage + +$(SONIC_DEVICE_DATA)_DEP_FILES += $(shell find $(PLATFORM_SRC_PATH)/device/ -type f -print) diff --git a/platform/cisco/template.j2 b/platform/cisco/template.j2 new file mode 100644 index 00000000000..3495b653604 --- /dev/null +++ b/platform/cisco/template.j2 @@ -0,0 +1,18 @@ +{# Copyright (c) 2026 Cisco Systems, Inc. and/or its affiliates. #} +{# SPDX-License-Identifier: Apache-2.0 #} + +{% if module.path is defined %} +{% set path = module.path %} +{% else %} +{% set path = env('platform-cisco-8000') %} +{% endif %} +if [ ! -d {{ path }} ]; then git clone {{ module.repo }} {{ path }}; fi; +if [ -d {{ path }}/.git ]; then cd {{ path }} && + +{% if module.ref is defined %} +git checkout {{ module.ref }} && git submodule update --init --recursive; +{% else %} +git submodule update --init --recursive; +{% endif %} + +else echo "{{ path }}/.git not found"; exit 1; fi diff --git a/src/sonic-py-common/sonic_py_common/device_info.py b/src/sonic-py-common/sonic_py_common/device_info.py index fe846a79cc9..786983d48e7 100644 --- a/src/sonic-py-common/sonic_py_common/device_info.py +++ b/src/sonic-py-common/sonic_py_common/device_info.py @@ -911,7 +911,7 @@ def get_system_mac(namespace=None, hostname=None): hw_mac_entry_outputs.append((mac, err)) (mac, err) = run_command_pipe(iplink_cmd0, iplink_cmd1, iplink_cmd2) hw_mac_entry_outputs.append((mac, err)) - elif (version_info['asic_type'] == 'cisco-8000'): + elif (version_info['asic_type'] in ('cisco-8000', 'cisco')): # Try to get valid MAC from profile.ini first, else fetch it from syseeprom or eth0 if namespace is not None: profile_cmd0 = ['cat', HOST_DEVICE_PATH + '/' + platform + '/profile.ini']