From bca7cbe009b081a7adc3598a5185e64bd0d65e82 Mon Sep 17 00:00:00 2001 From: Vivek Date: Wed, 24 Apr 2024 22:47:37 -0700 Subject: [PATCH] [Mellanox] Upgrade syncd, syncd-rpc and saiserver to bookworm (#18651) - Why I did it Upgrade Mellanox (syncd/syncd-rpc/saiserver) containers to Bookworm - How to verify it Compile successfully and run sonic-mgmt tests Manual Verification and Regression tests Signed-off-by: Vivek Reddy Karri --- platform/mellanox/docker-saiserver-mlnx.mk | 4 +- .../docker-saiserver-mlnx/Dockerfile.j2 | 4 +- platform/mellanox/docker-syncd-mlnx-rpc.mk | 5 ++- .../docker-syncd-mlnx-rpc/Dockerfile.j2 | 40 ++++++++++--------- platform/mellanox/docker-syncd-mlnx.mk | 2 +- .../mellanox/docker-syncd-mlnx/Dockerfile.j2 | 2 +- platform/mellanox/iproute2.mk | 4 +- ...01-Remove-arpd-from-iproute2-package.patch | 17 ++++---- .../0002-Rename-iproute2-debian-package.patch | 23 ++++++----- .../patch/0003-Fix-version-identifier.patch | 19 --------- platform/mellanox/iproute2/patch/series | 1 - platform/mellanox/libsaithrift-dev.mk | 3 -- platform/mellanox/rules.mk | 2 + sonic-slave-bookworm/Dockerfile.j2 | 6 +++ 14 files changed, 62 insertions(+), 70 deletions(-) delete mode 100644 platform/mellanox/iproute2/patch/0003-Fix-version-identifier.patch diff --git a/platform/mellanox/docker-saiserver-mlnx.mk b/platform/mellanox/docker-saiserver-mlnx.mk index 74fb96f91d1b..f0ebfe225339 100644 --- a/platform/mellanox/docker-saiserver-mlnx.mk +++ b/platform/mellanox/docker-saiserver-mlnx.mk @@ -20,10 +20,10 @@ DOCKER_SAISERVER_MLNX = docker-saiserver$(SAITHRIFT_VER)-mlnx.gz $(DOCKER_SAISERVER_MLNX)_PATH = $(PLATFORM_PATH)/docker-saiserver-mlnx $(DOCKER_SAISERVER_MLNX)_DEPENDS += $(SAISERVER) $(PYTHON_SDK_API) $(DOCKER_SAISERVER_MLNX)_PYTHON_DEBS += $(MLNX_SFPD) -$(DOCKER_SAISERVER_MLNX)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE) +$(DOCKER_SAISERVER_MLNX)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BOOKWORM) SONIC_DOCKER_IMAGES += $(DOCKER_SAISERVER_MLNX) $(DOCKER_SAISERVER_MLNX)_CONTAINER_NAME = saiserver$(SAITHRIFT_VER) -SONIC_BULLSEYE_DOCKERS += $(DOCKER_SAISERVER_MLNX) +SONIC_BOOKWORM_DOCKERS += $(DOCKER_SAISERVER_MLNX) $(DOCKER_SAISERVER_MLNX)_RUN_OPT += --privileged -t $(DOCKER_SAISERVER_MLNX)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 b/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 index 40cf0634bbb7..a57f6bfb9852 100644 --- a/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 @@ -15,7 +15,7 @@ ## limitations under the License. ## {% from "dockers/dockerfile-macros.j2" import install_debian_packages %} -FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} +FROM docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name @@ -40,7 +40,7 @@ python-debs/{{ deb }}{{' '}} {%- endfor -%} debs/ -RUN apt-get install -y --no-install-recommends libxml2 iptables libbsd0 protobuf-c-compiler protobuf-compiler python3-protobuf libprotobuf-c1 python3-future python3-ipaddr libnet1 pkg-config asciidoc xmlto +RUN apt-get install -y --no-install-recommends libxml2 iptables libbsd0 protobuf-c-compiler protobuf-compiler python3-protobuf libprotobuf-c1 python3-future libnet1 pkg-config asciidoc xmlto {{ install_debian_packages(docker_saiserver_mlnx_debs.split(' ')) }} diff --git a/platform/mellanox/docker-syncd-mlnx-rpc.mk b/platform/mellanox/docker-syncd-mlnx-rpc.mk index 9d6ce4bc6f1b..d3f66702f4df 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc.mk +++ b/platform/mellanox/docker-syncd-mlnx-rpc.mk @@ -18,7 +18,8 @@ DOCKER_SYNCD_MLNX_RPC = docker-syncd-mlnx-rpc.gz $(DOCKER_SYNCD_MLNX_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-mlnx-rpc -$(DOCKER_SYNCD_MLNX_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) $(PTF) +$(DOCKER_SYNCD_MLNX_RPC)_PYTHON_WHEELS += $(PTF_PY3) +$(DOCKER_SYNCD_MLNX_RPC)_DEPENDS += $(SYNCD_RPC) $(DOCKER_SYNCD_MLNX_RPC)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) ifeq ($(INSTALL_DEBUG_TOOLS), y) $(DOCKER_SYNCD_MLNX_RPC)_DEPENDS += $(SYNCD_RPC_DBG) \ @@ -30,7 +31,7 @@ endif $(DOCKER_SYNCD_MLNX_RPC)_PYTHON_DEBS += $(MLNX_SFPD) $(DOCKER_SYNCD_MLNX_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX_RPC) -SONIC_BULLSEYE_DOCKERS += $(DOCKER_SYNCD_MLNX_RPC) +SONIC_BOOKWORM_DOCKERS += $(DOCKER_SYNCD_MLNX_RPC) ifeq ($(ENABLE_SYNCD_RPC),y) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX_RPC) endif diff --git a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 index 511e360cb5a5..a73879487765 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 @@ -39,15 +39,15 @@ RUN apt-get update \ python3-pip \ python3-dev \ python-is-python3 \ - python3-setuptools + python3-scapy \ + libnanomsg5 \ + libnanomsg-dev \ + libthrift-0.17.0 \ + thrift-compiler \ + python3-thrift RUN pip3 install --upgrade pip -# Build and install python-scapy -RUN curl http://ftp.us.debian.org/debian/pool/main/s/scapy/python3-scapy_2.4.0-2_all.deb --output python3-scapy_2.4.0-2_all.deb \ - && dpkg -i python3-scapy_2.4.0-2_all.deb \ - && apt install -f - {% if docker_syncd_mlnx_rpc_debs.strip() -%} # Copy locally-built Debian package dependencies {{ copy_files("debs/", docker_syncd_mlnx_rpc_debs.split(' '), "/debs/") }} @@ -68,29 +68,33 @@ RUN curl http://ftp.us.debian.org/debian/pool/main/s/scapy/python3-scapy_2.4.0-2 {{ install_debian_packages(docker_syncd_mlnx_rpc_pydebs.split(' ')) }} {% endif %} -RUN wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ - && tar xvfz 1.0.0.tar.gz \ - && cd nanomsg-1.0.0 \ - && mkdir -p build \ - && cmake . \ - && make install \ - && ldconfig \ - && cd .. \ - && rm -fr nanomsg-1.0.0 \ - && rm -f 1.0.0.tar.gz \ - && pip3 install cffi==1.16.0 \ +RUN pip3 install cffi==1.16.0 \ && pip3 install wheel \ && pip3 install nnpy \ - && pip3 install ptf \ && 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 +{% if docker_syncd_mlnx_rpc_whls.strip() -%} +# Copy locally-built Python wheel dependencies +{{ copy_files("python-wheels/", docker_syncd_mlnx_rpc_whls.split(' '), "/python-wheels/") }} +# Install locally-built Python wheel dependencies +{{ install_python_wheels(docker_syncd_mlnx_rpc_whls.split(' ')) }} +{% endif %} + COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] ## Clean up +RUN apt-get -y purge \ + cmake \ + libssl-dev \ + libffi-dev \ + python3-dev \ + libthrift-dev \ + build-essential + RUN apt-get clean -y && \ apt-get autoclean -y && \ apt-get autoremove -y && \ diff --git a/platform/mellanox/docker-syncd-mlnx.mk b/platform/mellanox/docker-syncd-mlnx.mk index 678a45fa8b0e..7dd1c77667e5 100644 --- a/platform/mellanox/docker-syncd-mlnx.mk +++ b/platform/mellanox/docker-syncd-mlnx.mk @@ -17,7 +17,7 @@ # docker image for mlnx syncd DOCKER_SYNCD_PLATFORM_CODE = mlnx -include $(PLATFORM_PATH)/../template/docker-syncd-bullseye.mk +include $(PLATFORM_PATH)/../template/docker-syncd-bookworm.mk $(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD) $(PYTHON_SDK_API) $(MFT) $(MFT_FWTRACE_CFG) $(IPROUTE2_MLNX) diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index bdc51abca7e7..adb74ee4127a 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -15,7 +15,7 @@ ## limitations under the License. ## {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} +FROM docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name diff --git a/platform/mellanox/iproute2.mk b/platform/mellanox/iproute2.mk index 98866c464475..2b71476ea087 100644 --- a/platform/mellanox/iproute2.mk +++ b/platform/mellanox/iproute2.mk @@ -15,8 +15,8 @@ # limitations under the License. # -IPROUTE2_MLNX_VERSION = 5.10.0 -IPROUTE2_MLNX_VERSION_FULL = $(IPROUTE2_MLNX_VERSION)-4~bpo10+1 +IPROUTE2_MLNX_VERSION = 6.1.0 +IPROUTE2_MLNX_VERSION_FULL = $(IPROUTE2_MLNX_VERSION)-3 export IPROUTE2_MLNX_VERSION export IPROUTE2_MLNX_VERSION_FULL diff --git a/platform/mellanox/iproute2/patch/0001-Remove-arpd-from-iproute2-package.patch b/platform/mellanox/iproute2/patch/0001-Remove-arpd-from-iproute2-package.patch index 7f9e8981cd39..8444c50f82ff 100644 --- a/platform/mellanox/iproute2/patch/0001-Remove-arpd-from-iproute2-package.patch +++ b/platform/mellanox/iproute2/patch/0001-Remove-arpd-from-iproute2-package.patch @@ -1,8 +1,9 @@ -From 28e58b34f1168de182c37eff640180b6064a800d Mon Sep 17 00:00:00 2001 -From: liora -Date: Tue, 18 Apr 2023 13:01:16 +0000 -Subject: [PATCH 1/1] Remove arpd from iproute2 package +From 9b10f163354059a6b6cc2029ded5275f871f23e8 Mon Sep 17 00:00:00 2001 +From: Vivek Reddy +Date: Fri, 26 Jan 2024 06:54:14 +0000 +Subject: [PATCH 1/2] Remove arpd from iproute2 package +Signed-off-by: Vivek Reddy --- debian/control | 3 +-- debian/iproute2.install | 1 - @@ -10,7 +11,7 @@ Subject: [PATCH 1/1] Remove arpd from iproute2 package 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/debian/control b/debian/control -index b5e8b0a..e735c26 100644 +index f3a49a8..adc66c4 100644 --- a/debian/control +++ b/debian/control @@ -28,8 +28,7 @@ Build-Depends: bison, @@ -24,7 +25,7 @@ index b5e8b0a..e735c26 100644 Depends: ${misc:Depends}, ${shlibs:Depends}, libcap2-bin, Recommends: ${ipmods:Recommends} diff --git a/debian/iproute2.install b/debian/iproute2.install -index f9e8c26..fba201d 100644 +index f93b273..b017b44 100644 --- a/debian/iproute2.install +++ b/debian/iproute2.install @@ -1,6 +1,5 @@ @@ -32,8 +33,8 @@ index f9e8c26..fba201d 100644 usr/include/iproute2/ -sbin/arpd /usr/sbin sbin/bridge + sbin/dcb sbin/devlink - sbin/genl /usr/sbin diff --git a/misc/Makefile b/misc/Makefile index 50dae79..1f3898f 100644 --- a/misc/Makefile @@ -50,5 +51,5 @@ index 50dae79..1f3898f 100644 ss: $(SSOBJ) -- -2.30.2 +2.17.1 diff --git a/platform/mellanox/iproute2/patch/0002-Rename-iproute2-debian-package.patch b/platform/mellanox/iproute2/patch/0002-Rename-iproute2-debian-package.patch index 7ff1aec6f5e1..950fc776ec6f 100644 --- a/platform/mellanox/iproute2/patch/0002-Rename-iproute2-debian-package.patch +++ b/platform/mellanox/iproute2/patch/0002-Rename-iproute2-debian-package.patch @@ -1,8 +1,9 @@ -From 6676c4a200df54a06c96faa9a30baaefc61a91b5 Mon Sep 17 00:00:00 2001 -From: liora -Date: Thu, 27 Apr 2023 03:34:10 +0000 -Subject: [PATCH 1/1] Rename iproute2 debian package +From e21c49764de5efc4b53685815837a74de37538f3 Mon Sep 17 00:00:00 2001 +From: Vivek Reddy +Date: Fri, 26 Jan 2024 06:59:51 +0000 +Subject: [PATCH 2/2] Rename iproute2 debian package +Signed-off-by: Vivek Reddy --- debian/control | 4 ++-- debian/{iproute2.install => iproute2-mlnx.install} | 0 @@ -11,7 +12,7 @@ Subject: [PATCH 1/1] Rename iproute2 debian package rename debian/{iproute2.install => iproute2-mlnx.install} (100%) diff --git a/debian/control b/debian/control -index e735c26..4b03a6f 100644 +index adc66c4..0eb5988 100644 --- a/debian/control +++ b/debian/control @@ -25,11 +25,11 @@ Build-Depends: bison, @@ -27,24 +28,24 @@ index e735c26..4b03a6f 100644 +Replaces: iproute, iproute2 Depends: ${misc:Depends}, ${shlibs:Depends}, libcap2-bin, Recommends: ${ipmods:Recommends} - Suggests: iproute2-doc + Suggests: iproute2-doc, python3:any diff --git a/debian/iproute2.install b/debian/iproute2-mlnx.install similarity index 100% rename from debian/iproute2.install rename to debian/iproute2-mlnx.install diff --git a/debian/rules b/debian/rules -index d940d3c..8bd4f84 100755 +index 4c93c86..4489d2c 100755 --- a/debian/rules +++ b/debian/rules -@@ -34,7 +34,7 @@ override_dh_clean: +@@ -33,7 +33,7 @@ execute_after_dh_clean: override_dh_shlibdeps: dh_shlibdeps -a -Xq_atm.so -Xm_xt.so -Xm_ipt.so -- dh_shlibdeps -a -- -pipmods -dRecommends -e debian/iproute2/usr/lib/tc/m_xt.so -e debian/iproute2/usr/lib/tc/q_atm.so -xlibc6 -+ dh_shlibdeps -a -- -pipmods -dRecommends -e debian/iproute2-mlnx/usr/lib/tc/m_xt.so -e debian/iproute2-mlnx/usr/lib/tc/q_atm.so -xlibc6 +- dh_shlibdeps -a -- -pipmods -dRecommends -e debian/iproute2/usr/lib/$(DEB_HOST_MULTIARCH)/tc/m_xt.so -e debian/iproute2/usr/lib/$(DEB_HOST_MULTIARCH)/tc/q_atm.so -xlibc6 ++ dh_shlibdeps -a -- -pipmods -dRecommends -e debian/iproute2-mlnx/usr/lib/$(DEB_HOST_MULTIARCH)/tc/m_xt.so -e debian/iproute2-mlnx/usr/lib/$(DEB_HOST_MULTIARCH)/tc/q_atm.so -xlibc6 override_dh_auto_test: # upstream test suite needs root and leaves machine unclean, skip it -- -2.30.2 +2.17.1 diff --git a/platform/mellanox/iproute2/patch/0003-Fix-version-identifier.patch b/platform/mellanox/iproute2/patch/0003-Fix-version-identifier.patch deleted file mode 100644 index 6fe738a6a288..000000000000 --- a/platform/mellanox/iproute2/patch/0003-Fix-version-identifier.patch +++ /dev/null @@ -1,19 +0,0 @@ -From e10409ea82c16c0e48316a0b4d71a0f649f92a54 Mon Sep 17 00:00:00 2001 -From: liora -Date: Mon, 17 Apr 2023 05:17:27 +0000 -Subject: [PATCH 1/1] Fix version identifier - ---- - include/version.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/include/version.h b/include/version.h -index 89d0597..cf7afbb 100644 ---- a/include/version.h -+++ b/include/version.h -@@ -1 +1 @@ --static const char version[] = "5.9.0"; -+static const char version[] = "5.10.0"; --- -2.30.2 - diff --git a/platform/mellanox/iproute2/patch/series b/platform/mellanox/iproute2/patch/series index cc49aa3dfb5c..47f3f80d25e1 100644 --- a/platform/mellanox/iproute2/patch/series +++ b/platform/mellanox/iproute2/patch/series @@ -1,4 +1,3 @@ 0001-Remove-arpd-from-iproute2-package.patch 0002-Rename-iproute2-debian-package.patch -0003-Fix-version-identifier.patch diff --git a/platform/mellanox/libsaithrift-dev.mk b/platform/mellanox/libsaithrift-dev.mk index 1ae8453d4eff..2bbff075fc89 100644 --- a/platform/mellanox/libsaithrift-dev.mk +++ b/platform/mellanox/libsaithrift-dev.mk @@ -20,9 +20,6 @@ SAI_VER = 0.9.4 LIBSAITHRIFT_DEV = libsaithrift$(SAITHRIFT_VER)-dev_$(SAI_VER)_$(CONFIGURED_ARCH).deb $(LIBSAITHRIFT_DEV)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI -$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) -$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT) -$(LIBSAITHRIFT_DEV)_BUILD_ENV = SAITHRIFT_VER=v2 # Workaround to use python3 in build $(LIBSAITHRIFT_DEV)_DEPENDS += $(MLNX_SAI) $(MLNX_SAI_DEV) $(LIBSAITHRIFT_DEV)_RDEPENDS += $(MLNX_SAI) diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index 2c598ab7d5d7..69bad6725b7d 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -44,6 +44,8 @@ $(SYNCD)_DEPENDS += $(MLNX_SAI) $(SYNCD)_UNINSTALLS += $(MLNX_SAI) ifeq ($(ENABLE_SYNCD_RPC),y) +# Remove the libthrift_0.11.0 dependency injected by rules/syncd.mk +$(SYNCD)_DEPENDS := $(filter-out $(LIBTHRIFT_DEV),$($(SYNCD)_DEPENDS)) $(SYNCD)_DEPENDS += $(LIBSAITHRIFT_DEV) endif diff --git a/sonic-slave-bookworm/Dockerfile.j2 b/sonic-slave-bookworm/Dockerfile.j2 index fd88a9a070a7..18a64a620cfb 100644 --- a/sonic-slave-bookworm/Dockerfile.j2 +++ b/sonic-slave-bookworm/Dockerfile.j2 @@ -590,6 +590,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