From 2f566ca2ecaf76e716929c2cedcd510490d0ab20 Mon Sep 17 00:00:00 2001 From: Keshav Gupta Date: Tue, 12 Mar 2024 05:07:04 -0700 Subject: [PATCH] Innovium syncd bookworm migration Signed-off-by: Keshav Gupta --- platform/innovium/docker-syncd-invm-rpc.mk | 4 +-- .../docker-syncd-invm-rpc/Dockerfile.j2 | 18 ++++++---- platform/innovium/docker-syncd-invm.mk | 5 +-- .../innovium/docker-syncd-invm/Dockerfile.j2 | 3 +- platform/innovium/libsaithrift-dev.mk | 23 ++++++++++--- platform/innovium/rules.mk | 7 +++- platform/template/docker-syncd-bookworm.mk | 33 +++++++++++++++++++ sonic-slave-bookworm/Dockerfile.j2 | 6 ++++ 8 files changed, 79 insertions(+), 20 deletions(-) create mode 100644 platform/template/docker-syncd-bookworm.mk diff --git a/platform/innovium/docker-syncd-invm-rpc.mk b/platform/innovium/docker-syncd-invm-rpc.mk index 9bb60ad42d..fcf1075879 100755 --- a/platform/innovium/docker-syncd-invm-rpc.mk +++ b/platform/innovium/docker-syncd-invm-rpc.mk @@ -2,11 +2,11 @@ DOCKER_SYNCD_INVM_RPC = docker-syncd-invm-rpc.gz $(DOCKER_SYNCD_INVM_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-invm-rpc -$(DOCKER_SYNCD_INVM_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) $(INVM_LIBSAI) $(PTF) $(INVM_SHELL) +$(DOCKER_SYNCD_INVM_RPC)_DEPENDS += $(SYNCD_RPC) $(INVM_LIBSAI) $(INVM_SHELL) +$(DOCKER_SYNCD_INVM_RPC)_PYTHON_WHEELS += $(PTF_PY3) $(DOCKER_SYNCD_INVM_RPC)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) $(DOCKER_SYNCD_INVM_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_INVM_RPC) -SONIC_BUSTER_DOCKERS += $(DOCKER_SYNCD_INVM_RPC) ifeq ($(ENABLE_SYNCD_RPC),y) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_INVM_RPC) endif diff --git a/platform/innovium/docker-syncd-invm-rpc/Dockerfile.j2 b/platform/innovium/docker-syncd-invm-rpc/Dockerfile.j2 index 7ddccc3ab2..bf1aa4b5c3 100755 --- a/platform/innovium/docker-syncd-invm-rpc/Dockerfile.j2 +++ b/platform/innovium/docker-syncd-invm-rpc/Dockerfile.j2 @@ -15,19 +15,23 @@ RUN apt-get purge -y syncd RUN apt-get update \ && apt-get -y install \ net-tools \ - python-pip \ - python-setuptools \ + python3-pip \ + python3-setuptools \ build-essential \ libssl-dev \ libffi-dev \ - python-dev \ + python3-dev \ libjansson4 \ libyaml-dev \ wget \ cmake \ libqt5core5a \ libqt5network5 \ - libboost-atomic1.71.0 + libboost-atomic1.74.0 \ + libthrift-0.17.0 \ + libthrift-dev \ + thrift-compiler \ + python3-thrift RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \ {% for deb in docker_syncd_invm_rpc_debs.split(' ') -%} @@ -44,9 +48,9 @@ RUN wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ && cd .. \ && rm -fr nanomsg-1.0.0 \ && rm -f 1.0.0.tar.gz \ - && pip install numpy \ - && pip install scipy \ - && pip install setuptools \ + && pip3 install numpy \ + && pip3 install scipy \ + && pip3 install setuptools \ && mkdir -p /opt \ && cd /opt \ && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py \ diff --git a/platform/innovium/docker-syncd-invm.mk b/platform/innovium/docker-syncd-invm.mk index 0f748e3e89..572680721f 100755 --- a/platform/innovium/docker-syncd-invm.mk +++ b/platform/innovium/docker-syncd-invm.mk @@ -1,7 +1,7 @@ # docker image for innovium syncd DOCKER_SYNCD_PLATFORM_CODE = invm -include $(PLATFORM_PATH)/../template/docker-syncd-base.mk +include $(PLATFORM_PATH)/../template/docker-syncd-bookworm.mk $(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD) $(PYTHON_SDK_API) $(INVM_LIBSAI) $(INVM_SHELL) @@ -10,9 +10,6 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ $(LIBSAIMETADATA_DBG) \ $(LIBSAIREDIS_DBG) -SONIC_BUSTER_DOCKERS += $(DOCKER_SYNCD_BASE) -SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) - $(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 $(DOCKER_SYNCD_BASE)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_BASE)_MACHINE = innovium diff --git a/platform/innovium/docker-syncd-invm/Dockerfile.j2 b/platform/innovium/docker-syncd-invm/Dockerfile.j2 index 449f0d3467..a402776e73 100755 --- a/platform/innovium/docker-syncd-invm/Dockerfile.j2 +++ b/platform/innovium/docker-syncd-invm/Dockerfile.j2 @@ -1,4 +1,5 @@ -FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} +{% from "dockers/dockerfile-macros.j2" import install_debian_packages %} +FROM docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name diff --git a/platform/innovium/libsaithrift-dev.mk b/platform/innovium/libsaithrift-dev.mk index 5357705bac..ebc573e50e 100755 --- a/platform/innovium/libsaithrift-dev.mk +++ b/platform/innovium/libsaithrift-dev.mk @@ -1,7 +1,20 @@ # libsaithrift-dev package +SAI_VER = 0.9.4 -LIBSAITHRIFT_DEV_INVM = libsaithrift-dev_0.9.4_$(CONFIGURED_ARCH).deb -$(LIBSAITHRIFT_DEV_INVM)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI -$(LIBSAITHRIFT_DEV_INVM)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(INVM_LIBSAI) $(INVM_HSAI) -$(LIBSAITHRIFT_DEV_INVM)_RDEPENDS += $(LIBTHRIFT) $(INVM_HSAI) -SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_INVM) +LIBSAITHRIFT_DEV = libsaithrift$(SAITHRIFT_VER)-dev_$(SAI_VER)_$(CONFIGURED_ARCH).deb +$(LIBSAITHRIFT_DEV)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI +ifeq ($(SAITHRIFT_V2),y) +$(LIBSAITHRIFT_DEV)_DEPENDS += $(INVM_LIBSAI) $(INVM_HSAI) $(LIBSAIMETADATA) $(LIBSAIMETADATA_DEV) +$(LIBSAITHRIFT_DEV)_RDEPENDS += $(INVM_HSAI) $(LIBSAIMETADATA) +$(LIBSAITHRIFT_DEV)_BUILD_ENV = SAITHRIFTV2=true SAITHRIFT_VER=v2 +else +$(LIBSAITHRIFT_DEV)_DEPENDS += $(INVM_LIBSAI) $(INVM_HSAI) +$(LIBSAITHRIFT_DEV)_RDEPENDS += $(INVM_HSAI) +endif +$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBSAIMETADATA) $(LIBSAIMETADATA_DEV) +$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBSAIMETADATA) $(INVM_LIBSAI) $(INVM_SHELL) + +PYTHON_SAITHRIFT = python-saithrift$(SAITHRIFT_VER)_$(SAI_VER)_$(CONFIGURED_ARCH).deb +$(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(PYTHON_SAITHRIFT))) + +SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV) diff --git a/platform/innovium/rules.mk b/platform/innovium/rules.mk index 03efa70b0d..8bf9d304b1 100755 --- a/platform/innovium/rules.mk +++ b/platform/innovium/rules.mk @@ -16,8 +16,13 @@ SONIC_ALL += $(SONIC_INVM_ONE_IMAGE) \ $(DOCKER_SYNCD_INVM_RPC) # Inject invm sai into syncd -$(SYNCD)_DEPENDS += $(INVM_HSAI) $(INVM_LIBSAI) $(LIBSAITHRIFT_DEV_INVM) $(INVM_SHELL) +$(SYNCD)_DEPENDS += $(INVM_HSAI) $(INVM_LIBSAI) $(INVM_SHELL) $(SYNCD)_UNINSTALLS += $(INVM_HSAI) +ifeq ($(ENABLE_SYNCD_RPC),y) +$(SYNCD)_DEPENDS := $(filter-out $(LIBTHRIFT_DEV),$($(SYNCD)_DEPENDS)) +$(SYNCD)_DEPENDS += $(LIBSAITHRIFT_DEV) +endif + # Runtime dependency on invm sai is set only for syncd $(SYNCD)_RDEPENDS += $(INVM_HSAI) diff --git a/platform/template/docker-syncd-bookworm.mk b/platform/template/docker-syncd-bookworm.mk new file mode 100644 index 0000000000..2a9e828455 --- /dev/null +++ b/platform/template/docker-syncd-bookworm.mk @@ -0,0 +1,33 @@ +# docker image for syncd + + +DOCKER_SYNCD_BASE_STEM = docker-syncd-$(DOCKER_SYNCD_PLATFORM_CODE) +DOCKER_SYNCD_BASE = $(DOCKER_SYNCD_BASE_STEM).gz +DOCKER_SYNCD_BASE_DBG = $(DOCKER_SYNCD_BASE_STEM)-$(DBG_IMAGE_MARK).gz + +$(DOCKER_SYNCD_BASE)_PATH = $(PLATFORM_PATH)/docker-syncd-$(DOCKER_SYNCD_PLATFORM_CODE) + +$(DOCKER_SYNCD_BASE)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) + +$(DOCKER_SYNCD_BASE)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BOOKWORM) +$(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_DEPENDS) +$(DOCKER_SYNCD_BASE)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_IMAGE_PACKAGES) + +SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_BASE) +ifneq ($(ENABLE_SYNCD_RPC),y) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_BASE) +endif + +SONIC_DOCKER_DBG_IMAGES += $(DOCKER_SYNCD_BASE_DBG) +ifneq ($(ENABLE_SYNCD_RPC),y) +SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_SYNCD_BASE_DBG) +endif + +$(DOCKER_SYNCD_BASE)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_BASE)_RUN_OPT += --privileged -t +$(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_SYNCD_BASE)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro + +SONIC_BOOKWORM_DOCKERS += $(DOCKER_SYNCD_BASE) +SONIC_BOOKWORM_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) + diff --git a/sonic-slave-bookworm/Dockerfile.j2 b/sonic-slave-bookworm/Dockerfile.j2 index 4af1b401cc..6aa50c311b 100644 --- a/sonic-slave-bookworm/Dockerfile.j2 +++ b/sonic-slave-bookworm/Dockerfile.j2 @@ -561,6 +561,12 @@ RUN update-alternatives --set iptables /usr/sbin/iptables-legacy # Install m2crypto package, needed by SWI tools RUN apt-get install python3-m2crypto +# Install libthrift package needed by saithrift +RUN apt-get install libthrift-0.17 \ + libthrift-dev \ + thrift-compiler\ + python3-thrift + # Install swi tools RUN pip3 install git+https://github.com/aristanetworks/swi-tools.git@bead66bf261770237f7dd21ace3774ba04a017e9