From c58923053adf043125a79005282f50eb797c9b31 Mon Sep 17 00:00:00 2001 From: ShiyanWangMS Date: Tue, 11 Jul 2023 09:54:10 +0800 Subject: [PATCH] Add Python3 packages to sonic-mgmt-docker (#15726) Why I did it This is part of sonic-mgmt-docker Python3 migration project. Currently Python3 packages are in the Python3 virtual environment. This PR will add Python3 packages to real file system. After we migrate all script to use Python3 in real file system, the Python3 venv will be deleted. After this PR, in sonic-mgmt-docker, Directly run cmd - pytest will use Python2's version. python3 -m pytest will use Python3's version. How I did it Modify sonic-mgmt-docker j2 script. How to verify it Build a private sonic-mgmt-docker and run basic test case with Python3. --- dockers/docker-sonic-mgmt/Dockerfile.j2 | 87 +++++++++++++++++++++---- 1 file changed, 75 insertions(+), 12 deletions(-) diff --git a/dockers/docker-sonic-mgmt/Dockerfile.j2 b/dockers/docker-sonic-mgmt/Dockerfile.j2 index 5534d3112a41..0a5e31eac415 100755 --- a/dockers/docker-sonic-mgmt/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt/Dockerfile.j2 @@ -38,6 +38,80 @@ RUN apt-get update && apt-get install -y apt-transport-https \ telnet \ vim +RUN pip3 install --upgrade pip setuptools wheel +RUN pip3 install aiohttp \ + allure-pytest==2.8.22 \ + ansible==2.9.27 \ + azure-storage-blob==12.9.0 \ + azure-kusto-data \ + azure-kusto-ingest \ + defusedxml \ + celery[redis]==4.4.7 \ + cffi \ + contextlib2==0.6.0.post1 \ + cryptography==3.3.2 \ + dpkt \ + "future>=0.16.0" \ + gitpython \ + ipaddr \ + ipython==5.4.1 \ + ixnetwork-restpy==1.0.64 \ + ixnetwork-open-traffic-generator==0.0.79 \ + jinja2==2.10.1 \ + jsonpatch \ + lxml \ + markupsafe==2.0.1 \ + mock \ + msrest==0.6.21 \ + natsort \ + ncclient \ + netaddr \ + netmiko==2.4.2 \ + paramiko==2.7.1 \ + passlib \ + pexpect \ + prettytable \ + psutil \ + ptf \ + pyasn1==0.4.8 \ + pycryptodome==3.9.8 \ + pyfiglet \ + pylint==1.8.1 \ + pyro4 \ + pysnmp==4.4.12 \ + pysubnettree \ + pytest-ansible \ + pytest-html \ + pytest-repeat \ + pytest-xdist==1.28.0 \ + python-dateutil \ + pytest==7.1.3 \ + redis \ + requests \ + retry \ + rpyc \ + scandir \ + scapy==2.4.5 \ + setuptools-rust \ + six \ + snappi[ixnetwork,convergence]==0.7.44 \ + tabulate \ + textfsm==1.1.2 \ + thrift==0.11.0 \ + virtualenv \ + && wget https://github.com/nanomsg/nanomsg/archive/1.2.tar.gz \ + && tar xvfz 1.2.tar.gz \ + && cd nanomsg-1.2 \ + && mkdir -p build \ + && cd build \ + && cmake .. \ + && make install \ + && ldconfig \ + && cd ../.. \ + && rm -fr nanomsg-1.2 \ + && rm -f 1.2.tar.gz \ + && pip3 install nnpy + RUN curl -fsSL http://archive.ubuntu.com/ubuntu/pool/universe/s/scapy/python-scapy_2.3.3-3_all.deb \ --output python-scapy_2.3.3-3_all.deb \ && dpkg -i python-scapy_2.3.3-3_all.deb \ @@ -72,6 +146,7 @@ RUN pip install allure-pytest==2.8.22 \ natsort \ netaddr \ netmiko==2.4.2 \ + nnpy \ paramiko==2.7.1 \ passlib \ pexpect \ @@ -108,18 +183,6 @@ RUN pip install allure-pytest==2.8.22 \ && python setup.py install \ && cd .. \ && rm -fr scapy-vxlan \ - && 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 \ - && cd build \ - && cmake .. \ - && make install \ - && ldconfig \ - && cd ../.. \ - && rm -fr nanomsg-1.0.0 \ - && rm -f 1.0.0.tar.gz \ - && pip install nnpy \ && pip install scapy==2.4.5 --upgrade --ignore-installed # Install docker-ce-cli