From 9f68812dbc7050063da70694cb2052a43e8d8450 Mon Sep 17 00:00:00 2001 From: liorghub Date: Wed, 6 Dec 2023 16:32:03 +0200 Subject: [PATCH 1/5] Revert "[Mellanox] Install python2 on syncd (#14151)" This reverts commit c4e34452afeccdeb3c8b8f1f2d280f39a57fe0d1. --- platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index 69bd6294fd45..63a20a1f5fd0 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -29,20 +29,17 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && \ apt-get install -y \ libxml2 \ - python-dev \ python3-pip \ python3-dev \ + python-is-python3 \ {%- if ENABLE_ASAN == "y" %} libasan6 \ {%- endif %} - python-setuptools \ python3-setuptools RUN pip3 install --upgrade pip RUN apt-get purge -y python-pip -RUN curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py - {% if docker_syncd_mlnx_debs.strip() -%} # Copy locally-built Debian package dependencies {{ copy_files("debs/", docker_syncd_mlnx_debs.split(' '), "/debs/") }} From 9ba32c27f4fa22b9919f1ed7d0693a757ea49031 Mon Sep 17 00:00:00 2001 From: liorghub Date: Sun, 3 Dec 2023 21:08:17 +0200 Subject: [PATCH 2/5] Remove python2 from compilation of python-sdk-api --- platform/mellanox/sdk-src/python-sdk-api/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/sdk-src/python-sdk-api/Makefile b/platform/mellanox/sdk-src/python-sdk-api/Makefile index 47f0ad5a01ff..0b42fb853b2b 100644 --- a/platform/mellanox/sdk-src/python-sdk-api/Makefile +++ b/platform/mellanox/sdk-src/python-sdk-api/Makefile @@ -18,7 +18,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : ./autogen.sh fi - debuild -e PYTHON_INTERPRETERS="\"python2 python3\"" -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) + debuild -e PYTHON_INTERPRETERS="\"python3\"" -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) popd From 55b5346c6aad875278c2f62cb319f3c157c5b71b Mon Sep 17 00:00:00 2001 From: liorghub Date: Sun, 10 Dec 2023 13:58:23 +0200 Subject: [PATCH 3/5] Upgrade Python version in syncd RPC docker image to Python3 --- .../docker-syncd-mlnx-rpc/Dockerfile.j2 | 46 +++++++++---------- .../docker-syncd-mlnx-rpc/ptf_nn_agent.conf | 2 +- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 index d10d560110c6..38a227d5f680 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 @@ -25,23 +25,27 @@ RUN mkdir -p /var/run/sx_sdk RUN apt-get purge -y syncd ## Pre-install the fundamental packages -RUN apt-get update \ - && apt-get -y install \ - net-tools \ - python-setuptools \ - build-essential \ - libssl-dev \ - libffi-dev \ - python-dev \ - wget \ - cmake \ - libqt5core5a \ - libqt5network5 \ - libboost-atomic1.74.0 +RUN apt-get update \ + && apt-get -y install \ + net-tools \ + build-essential \ + libssl-dev \ + libffi-dev \ + wget \ + cmake \ + libqt5core5a \ + libqt5network5 \ + libboost-atomic1.74.0 \ + python3-pip \ + python3-dev \ + python-is-python3 \ + python3-setuptools + +RUN pip3 install --upgrade pip # Build and install python-scapy -RUN curl http://ftp.us.debian.org/debian/pool/main/s/scapy/python-scapy_2.4.0-2_all.deb --output python-scapy_2.4.0-2_all.deb \ - && dpkg -i python-scapy_2.4.0-2_all.deb \ +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() -%} @@ -64,10 +68,6 @@ RUN curl http://ftp.us.debian.org/debian/pool/main/s/scapy/python-scapy_2.4.0-2_ {{ install_debian_packages(docker_syncd_mlnx_rpc_pydebs.split(' ')) }} {% endif %} -# Install pip2 since it is no longer in the APT upstream -RUN curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py \ - && python2 get-pip.py - 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 \ @@ -78,10 +78,10 @@ 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 \ - && pip2 install cffi==1.7.0 \ - && pip2 install --upgrade cffi==1.7.0 \ - && pip2 install wheel \ - && pip2 install nnpy \ + && 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 \ diff --git a/platform/mellanox/docker-syncd-mlnx-rpc/ptf_nn_agent.conf b/platform/mellanox/docker-syncd-mlnx-rpc/ptf_nn_agent.conf index 80812464a19e..1b91d3efbeba 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc/ptf_nn_agent.conf +++ b/platform/mellanox/docker-syncd-mlnx-rpc/ptf_nn_agent.conf @@ -1,5 +1,5 @@ [program:ptf_nn_agent] -command=/usr/bin/python2 /opt/ptf_nn_agent.py --device-socket 1@tcp://0.0.0.0:10900 -i 1-3@Ethernet12 --set-nn-rcv-buffer=109430400 --set-iface-rcv-buffer=109430400 --set-nn-snd-buffer=109430400 --set-iface-snd-buffer=109430400 +command=/usr/bin/python3 /opt/ptf_nn_agent.py --device-socket 1@tcp://0.0.0.0:10900 -i 1-3@Ethernet12 --set-nn-rcv-buffer=109430400 --set-iface-rcv-buffer=109430400 --set-nn-snd-buffer=109430400 --set-iface-snd-buffer=109430400 process_name=ptf_nn_agent stdout_logfile=/tmp/ptf_nn_agent.out.log stderr_logfile=/tmp/ptf_nn_agent.err.log From 4ae518d971eb7f2bd30808f8a43e4303e4b0a769 Mon Sep 17 00:00:00 2001 From: liorghub Date: Wed, 20 Dec 2023 10:14:03 +0200 Subject: [PATCH 4/5] Update header in syncd docker files Signed-off-by: liorghub --- platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 | 2 +- platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 index 38a227d5f680..2e3f7b86678b 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 @@ -1,5 +1,5 @@ ## -## Copyright (c) 2016-2021 NVIDIA CORPORATION & AFFILIATES. +## Copyright (c) 2016-2023 NVIDIA CORPORATION & AFFILIATES. ## Apache-2.0 ## ## Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index 63a20a1f5fd0..26790a8baeb9 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -1,5 +1,5 @@ ## -## Copyright (c) 2016-2021 NVIDIA CORPORATION & AFFILIATES. +## Copyright (c) 2016-2023 NVIDIA CORPORATION & AFFILIATES. ## Apache-2.0 ## ## Licensed under the Apache License, Version 2.0 (the "License"); From cc8a88609fd61a0f4ca1247c0b720f43c6523499 Mon Sep 17 00:00:00 2001 From: liorghub Date: Sun, 21 Jan 2024 18:33:22 +0200 Subject: [PATCH 5/5] Second update in syncd docker files --- platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 | 2 +- platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 index 2e3f7b86678b..511e360cb5a5 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 @@ -1,5 +1,5 @@ ## -## Copyright (c) 2016-2023 NVIDIA CORPORATION & AFFILIATES. +## Copyright (c) 2016-2024 NVIDIA CORPORATION & AFFILIATES. ## Apache-2.0 ## ## Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index 26790a8baeb9..2c57399ca177 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -1,5 +1,5 @@ ## -## Copyright (c) 2016-2023 NVIDIA CORPORATION & AFFILIATES. +## Copyright (c) 2016-2024 NVIDIA CORPORATION & AFFILIATES. ## Apache-2.0 ## ## Licensed under the Apache License, Version 2.0 (the "License");