2022-03-14 05:09:20 -05:00
|
|
|
{% set prefix = DEFAULT_CONTAINER_REGISTRY %}
|
2021-04-18 10:17:57 -05:00
|
|
|
{% if CONFIGURED_ARCH == "armhf" and MULTIARCH_QEMU_ENVIRON == "y" %}
|
2022-03-14 05:09:20 -05:00
|
|
|
FROM {{ prefix }}multiarch/debian-debootstrap:armhf-stretch
|
2021-04-18 10:17:57 -05:00
|
|
|
{% elif CONFIGURED_ARCH == "arm64" and MULTIARCH_QEMU_ENVIRON == "y" %}
|
2022-03-14 05:09:20 -05:00
|
|
|
FROM {{ prefix }}multiarch/debian-debootstrap:arm64-stretch
|
2019-07-26 00:06:41 -05:00
|
|
|
{% else %}
|
2022-03-14 05:09:20 -05:00
|
|
|
FROM {{ prefix }}debian:buster
|
2019-07-26 00:06:41 -05:00
|
|
|
{% endif %}
|
2016-08-04 12:39:33 -05:00
|
|
|
|
2022-04-25 20:13:26 -05:00
|
|
|
{% from "dockers/dockerfile-macros.j2" import install_python_wheels, copy_files %}
|
|
|
|
|
|
|
|
USER root
|
|
|
|
WORKDIR /root
|
|
|
|
|
2016-08-04 12:39:33 -05:00
|
|
|
MAINTAINER Pavel Shirshov
|
|
|
|
|
2022-12-30 01:33:21 -06:00
|
|
|
COPY ["sources.list.{{ CONFIGURED_ARCH }}", "/etc/apt/sources.list"]
|
2023-03-12 22:13:21 -05:00
|
|
|
COPY ["no-check-valid-until", "/etc/apt/apt.conf.d"]
|
2022-12-30 01:33:21 -06:00
|
|
|
|
2016-08-04 12:39:33 -05:00
|
|
|
## Make apt-get non-interactive
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
|
|
|
## Set the apt source, update package cache and install necessary packages
|
2020-04-13 18:56:19 -05:00
|
|
|
## TODO: Clean up this step
|
2022-12-30 01:33:21 -06:00
|
|
|
RUN apt-get update \
|
2016-09-09 19:53:41 -05:00
|
|
|
&& apt-get upgrade -y \
|
2016-08-04 12:39:33 -05:00
|
|
|
&& apt-get dist-upgrade -y \
|
2016-09-09 19:53:41 -05:00
|
|
|
&& apt-get install -y \
|
2020-01-23 11:28:39 -06:00
|
|
|
autoconf \
|
2016-08-04 12:39:33 -05:00
|
|
|
openssh-server \
|
|
|
|
vim \
|
2019-11-25 11:00:47 -06:00
|
|
|
telnet \
|
2016-08-04 12:39:33 -05:00
|
|
|
net-tools \
|
|
|
|
traceroute \
|
|
|
|
lsof \
|
|
|
|
tcpdump \
|
2019-11-25 11:00:47 -06:00
|
|
|
ethtool \
|
2016-08-04 12:39:33 -05:00
|
|
|
unzip \
|
|
|
|
pkg-config \
|
|
|
|
binutils \
|
|
|
|
build-essential \
|
|
|
|
libssl-dev \
|
|
|
|
libffi-dev \
|
|
|
|
wget \
|
|
|
|
cmake \
|
2016-12-09 04:24:08 -06:00
|
|
|
libqt5core5a \
|
2017-05-01 20:47:29 -05:00
|
|
|
libqt5network5 \
|
2021-08-18 12:42:03 -05:00
|
|
|
libboost-atomic1.71.0 \
|
2017-05-24 03:34:37 -05:00
|
|
|
less \
|
2017-05-26 20:32:52 -05:00
|
|
|
git \
|
2017-05-31 12:49:31 -05:00
|
|
|
iputils-ping \
|
2017-06-16 09:25:40 -05:00
|
|
|
hping3 \
|
2017-07-06 04:27:05 -05:00
|
|
|
curl \
|
2019-11-20 09:39:49 -06:00
|
|
|
tmux \
|
2017-07-06 04:27:05 -05:00
|
|
|
python \
|
|
|
|
python-dev \
|
2019-11-09 00:57:05 -06:00
|
|
|
python-libpcap \
|
2019-03-12 23:38:25 -05:00
|
|
|
python-scapy \
|
2020-03-05 03:37:23 -06:00
|
|
|
python-six \
|
2022-04-25 20:13:26 -05:00
|
|
|
python3 \
|
|
|
|
python3-venv \
|
|
|
|
python3-pip \
|
|
|
|
python3-dev \
|
|
|
|
python3-scapy \
|
|
|
|
python3-six \
|
|
|
|
libpcap-dev \
|
2020-03-05 03:37:23 -06:00
|
|
|
tacacs+ \
|
2020-03-18 13:01:36 -05:00
|
|
|
rsyslog \
|
|
|
|
ntp \
|
|
|
|
ntpstat \
|
2020-04-13 18:56:19 -05:00
|
|
|
ntpdate \
|
|
|
|
arping \
|
2021-03-10 11:11:23 -06:00
|
|
|
bridge-utils \
|
2021-09-24 04:10:48 -05:00
|
|
|
libteam-utils \
|
2022-04-25 20:13:26 -05:00
|
|
|
gdb \
|
|
|
|
automake \
|
|
|
|
iproute2
|
2021-03-10 11:11:23 -06:00
|
|
|
|
2017-07-06 04:27:05 -05:00
|
|
|
# Install all python modules from pypi. python-scapy is exception, ptf debian package requires python-scapy
|
2020-04-13 18:56:19 -05:00
|
|
|
# TODO: Clean up this step
|
2016-12-09 04:24:08 -06:00
|
|
|
RUN rm -rf /debs \
|
2016-08-04 12:39:33 -05:00
|
|
|
&& apt-get -y autoclean \
|
|
|
|
&& apt-get -y autoremove \
|
|
|
|
&& rm -rf /var/lib/apt/lists/* \
|
2021-03-09 20:15:16 -06:00
|
|
|
&& wget --https-only https://bootstrap.pypa.io/pip/2.7/get-pip.py \
|
2017-07-06 04:27:05 -05:00
|
|
|
&& python get-pip.py \
|
|
|
|
&& rm -f get-pip.py \
|
|
|
|
&& pip install setuptools \
|
|
|
|
&& pip install supervisor \
|
|
|
|
&& pip install ipython==5.4.1 \
|
|
|
|
&& git clone https://github.com/p4lang/scapy-vxlan.git \
|
|
|
|
&& cd scapy-vxlan \
|
|
|
|
&& python setup.py install \
|
|
|
|
&& cd .. \
|
|
|
|
&& rm -fr scapy-vxlan \
|
2020-01-23 11:28:39 -06:00
|
|
|
&& git clone https://github.com/sflow/sflowtool \
|
|
|
|
&& cd sflowtool \
|
|
|
|
&& ./boot.sh \
|
|
|
|
&& ./configure \
|
|
|
|
&& make \
|
|
|
|
&& make install \
|
|
|
|
&& cd .. \
|
|
|
|
&& rm -fr sflowtool \
|
2021-12-14 13:46:48 -06:00
|
|
|
&& git clone https://github.com/dyninc/OpenBFDD.git \
|
|
|
|
&& cd OpenBFDD \
|
|
|
|
&& ./autogen.sh \
|
|
|
|
&& ./configure \
|
|
|
|
&& make \
|
|
|
|
&& make install \
|
|
|
|
&& cd .. \
|
|
|
|
&& rm -fr OpenBFDD \
|
2016-08-04 12:39:33 -05:00
|
|
|
&& 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 \
|
2016-09-09 19:53:41 -05:00
|
|
|
&& cd build \
|
|
|
|
&& cmake .. \
|
2016-08-04 12:39:33 -05:00
|
|
|
&& make install \
|
|
|
|
&& ldconfig \
|
2016-09-09 19:53:41 -05:00
|
|
|
&& cd ../.. \
|
2016-08-04 12:39:33 -05:00
|
|
|
&& rm -fr nanomsg-1.0.0 \
|
|
|
|
&& rm -f 1.0.0.tar.gz \
|
2017-07-06 04:27:05 -05:00
|
|
|
&& pip install cffi \
|
2016-08-04 12:39:33 -05:00
|
|
|
&& pip install nnpy \
|
2017-01-25 20:19:15 -06:00
|
|
|
&& pip install dpkt \
|
2017-02-01 14:49:43 -06:00
|
|
|
&& pip install ipaddress \
|
2017-04-29 02:15:12 -05:00
|
|
|
&& pip install pysubnettree \
|
2017-05-24 03:34:37 -05:00
|
|
|
&& pip install paramiko \
|
2017-06-16 09:25:40 -05:00
|
|
|
&& pip install flask \
|
|
|
|
&& pip install exabgp==3.4.17\
|
2017-07-20 01:21:03 -05:00
|
|
|
&& pip install pyaml \
|
2020-04-13 18:56:19 -05:00
|
|
|
&& pip install pybrctl pyro4 rpyc yabgp \
|
2021-08-11 22:55:21 -05:00
|
|
|
&& pip install unittest-xml-reporting \
|
2021-09-24 04:10:48 -05:00
|
|
|
&& pip install pyrasite \
|
2022-04-25 20:13:26 -05:00
|
|
|
&& pip install retrying \
|
2016-08-04 12:39:33 -05:00
|
|
|
&& mkdir -p /opt \
|
|
|
|
&& cd /opt \
|
2022-04-12 19:57:10 -05:00
|
|
|
&& wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py
|
2016-08-04 12:39:33 -05:00
|
|
|
|
Enable system-site-packages for ptf docker and install thrift for test_qos_sai (#12094)
Why I did it
test_sai_qos failed because of the following error:
"stderr_lines": [
"Traceback (most recent call last):",
" File \"/usr/bin/ptf\", line 522, in <module>",
" test_modules = load_test_modules(config)",
" File \"/usr/bin/ptf\", line 413, in load_test_modules",
" mod = imp.load_module(modname, *imp.find_module(modname, [root]))",
" File \"saitests/switch.py\", line 19, in <module>",
" import switch_sai_thrift",
"ImportError: No module named switch_sai_thrift"
],
It's because test_sai_qos runs ptf script which imports switch_sai_thrift, switch_sai_thrift is installed from python-saithrift_0.9.4_amd64.deb.
For master image, the deb file is for python3, but ptf only has virtual python3 environment, that's why we add --system-site-packages to allow virtual env to access system site-packeges.
Add thrift package in docker ptf virtual python3 env, because currently env-python3 doesn't have thrift module which is needed in switch_sai_thrift.
How I did it
Enable --system-site-packages for virtual py3 env in ptf docker and install thrift for test_qos_sai
How to verify it
load and login ptf conatiner
dpkg - i python-saithrift_0.9.4_amd64.deb
source /root/env-python3/bin/activate
python
import switch_sai_thrift.switch_sai_rpc
Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
2022-09-17 00:33:53 -05:00
|
|
|
RUN python3 -m venv --system-site-packages env-python3
|
2022-04-25 20:13:26 -05:00
|
|
|
|
|
|
|
# Activating a virtualenv. The virtualenv automatically works for RUN, ENV and CMD.
|
|
|
|
ENV VIRTUAL_ENV=/root/env-python3
|
|
|
|
ARG BACKUP_OF_PATH="$PATH"
|
|
|
|
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
|
|
|
|
|
|
|
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 PYTHONIOENCODING=UTF-8
|
|
|
|
|
|
|
|
RUN python3 -m pip install --upgrade --ignore-installed pip
|
|
|
|
|
|
|
|
# Install all python modules from pypi. python3-scapy is exception, ptf debian package requires python3-scapy
|
|
|
|
RUN python3 -m pip install setuptools \
|
|
|
|
&& pip3 install supervisor \
|
|
|
|
&& pip3 install ipython==5.4.1 \
|
|
|
|
&& pip3 install Cython \
|
|
|
|
&& pip3 install cffi \
|
|
|
|
&& pip3 install nnpy \
|
|
|
|
&& pip3 install dpkt \
|
|
|
|
&& pip3 install ipaddress \
|
|
|
|
&& pip3 install pysubnettree \
|
|
|
|
&& pip3 install paramiko \
|
|
|
|
&& pip3 install Flask \
|
|
|
|
&& pip3 install exabgp \
|
|
|
|
&& pip3 install pyaml \
|
|
|
|
&& pip3 install pybrctl pyro4 rpyc yabgp \
|
|
|
|
&& pip3 install unittest-xml-reporting \
|
|
|
|
&& pip3 install pyrasite \
|
|
|
|
&& pip3 install python-libpcap \
|
|
|
|
&& pip3 install enum34 \
|
|
|
|
&& pip3 install grpcio \
|
|
|
|
&& pip3 install grpcio-tools \
|
|
|
|
&& pip3 install protobuf \
|
|
|
|
&& pip3 install six==1.16.0 \
|
|
|
|
&& pip3 install itsdangerous \
|
|
|
|
&& pip3 install retrying \
|
|
|
|
&& pip3 install jinja2 \
|
Enable system-site-packages for ptf docker and install thrift for test_qos_sai (#12094)
Why I did it
test_sai_qos failed because of the following error:
"stderr_lines": [
"Traceback (most recent call last):",
" File \"/usr/bin/ptf\", line 522, in <module>",
" test_modules = load_test_modules(config)",
" File \"/usr/bin/ptf\", line 413, in load_test_modules",
" mod = imp.load_module(modname, *imp.find_module(modname, [root]))",
" File \"saitests/switch.py\", line 19, in <module>",
" import switch_sai_thrift",
"ImportError: No module named switch_sai_thrift"
],
It's because test_sai_qos runs ptf script which imports switch_sai_thrift, switch_sai_thrift is installed from python-saithrift_0.9.4_amd64.deb.
For master image, the deb file is for python3, but ptf only has virtual python3 environment, that's why we add --system-site-packages to allow virtual env to access system site-packeges.
Add thrift package in docker ptf virtual python3 env, because currently env-python3 doesn't have thrift module which is needed in switch_sai_thrift.
How I did it
Enable --system-site-packages for virtual py3 env in ptf docker and install thrift for test_qos_sai
How to verify it
load and login ptf conatiner
dpkg - i python-saithrift_0.9.4_amd64.deb
source /root/env-python3/bin/activate
python
import switch_sai_thrift.switch_sai_rpc
Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
2022-09-17 00:33:53 -05:00
|
|
|
&& pip3 install scapy==2.4.5 \
|
|
|
|
&& pip3 install thrift
|
2022-04-25 20:13:26 -05:00
|
|
|
|
|
|
|
{% if docker_ptf_whls.strip() -%}
|
|
|
|
# Copy locally-built Python wheel dependencies
|
|
|
|
{{ copy_files("python-wheels/", docker_ptf_whls.split(' '), "/python-wheels/") }}
|
|
|
|
|
|
|
|
# Install locally-built Python wheel dependencies
|
|
|
|
{{ install_python_wheels(docker_ptf_whls.split(' ')) }}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
# Deactivating a virtualenv.
|
|
|
|
ENV PATH="$BACKUP_OF_PATH"
|
|
|
|
|
2016-08-04 12:39:33 -05:00
|
|
|
## Adjust sshd settings
|
|
|
|
RUN mkdir /var/run/sshd \
|
2019-07-23 09:02:31 -05:00
|
|
|
&& echo 'root:root' | chpasswd \
|
|
|
|
&& sed -ri '/^#?PermitRootLogin/c\PermitRootLogin yes' /etc/ssh/sshd_config \
|
|
|
|
&& sed -ri '/^#?UsePAM/c\UsePAM no' /etc/ssh/sshd_config \
|
|
|
|
&& sed -ri '/^#?UseDNS/c\UseDNS no' /etc/ssh/sshd_config
|
2016-08-04 12:39:33 -05:00
|
|
|
|
2020-04-13 18:56:19 -05:00
|
|
|
COPY supervisord.conf /etc/supervisor/
|
|
|
|
COPY conf.d/ /etc/supervisor/conf.d/
|
|
|
|
COPY ptf_tgen.sh /ptf_tgen/
|
2017-07-24 15:36:40 -05:00
|
|
|
|
2017-11-29 18:36:26 -06:00
|
|
|
# Move tcpdump into /usr/bin Otherwise it's impossible to run tcpdump due to a docker bug
|
|
|
|
RUN mv /usr/sbin/tcpdump /usr/bin/tcpdump
|
|
|
|
RUN ln -s /usr/bin/tcpdump /usr/sbin/tcpdump
|
|
|
|
|
2017-07-24 15:36:40 -05:00
|
|
|
RUN mkdir -p /var/log/supervisor
|
2016-08-04 12:39:33 -05:00
|
|
|
|
2020-07-10 21:58:47 -05:00
|
|
|
# Install Python-based GNMI client
|
|
|
|
RUN git clone https://github.com/lguohan/gnxi.git \
|
|
|
|
&& cd gnxi \
|
2020-12-18 00:12:04 -06:00
|
|
|
&& git checkout 53901ab \
|
2020-07-10 21:58:47 -05:00
|
|
|
&& cd gnmi_cli_py \
|
|
|
|
&& pip install -r requirements.txt
|
|
|
|
|
2021-01-23 03:27:20 -06:00
|
|
|
COPY \
|
|
|
|
{% for deb in docker_ptf_debs.split(' ') -%}
|
|
|
|
debs/{{ deb }}{{' '}}
|
|
|
|
{%- endfor -%}
|
|
|
|
debs/
|
|
|
|
|
|
|
|
RUN dpkg -i \
|
|
|
|
{% for deb in docker_ptf_debs.split(' ') -%}
|
|
|
|
debs/{{ deb }}{{' '}}
|
|
|
|
{%- endfor %}
|
|
|
|
|
|
|
|
COPY ["*.ini", "/etc/ptf/"]
|
2020-04-13 18:56:19 -05:00
|
|
|
EXPOSE 22 8009
|
2016-08-04 12:39:33 -05:00
|
|
|
|
2017-07-24 15:36:40 -05:00
|
|
|
ENTRYPOINT ["/usr/local/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
|