Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docker-ptf] Add support for spytest to ptf container #4410

Merged
merged 1 commit into from
Apr 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 10 additions & 6 deletions dockers/docker-ptf/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ debs/
ENV DEBIAN_FRONTEND=noninteractive

## Set the apt source, update package cache and install necessary packages
## TODO: Clean up this step
yxieca marked this conversation as resolved.
Show resolved Hide resolved
RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' /etc/apt/sources.list \
&& apt-get update \
&& apt-get upgrade -y \
Expand All @@ -39,7 +40,6 @@ RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' /
unzip \
pkg-config \
binutils \
net-tools \
build-essential \
libssl-dev \
libffi-dev \
Expand All @@ -53,7 +53,6 @@ RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' /
iputils-ping \
hping3 \
curl \
tcpdump \
tmux \
python \
python-dev \
Expand All @@ -64,14 +63,17 @@ RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' /
rsyslog \
ntp \
ntpstat \
ntpdate
ntpdate \
arping \
bridge-utils

RUN dpkg -i \
{% for deb in docker_ptf_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
{%- endfor %}

# Install all python modules from pypi. python-scapy is exception, ptf debian package requires python-scapy
# TODO: Clean up this step
yxieca marked this conversation as resolved.
Show resolved Hide resolved
RUN rm -rf /debs \
&& apt-get -y autoclean \
&& apt-get -y autoremove \
Expand Down Expand Up @@ -115,6 +117,7 @@ RUN rm -rf /debs \
&& pip install flask \
&& pip install exabgp==3.4.17\
&& pip install pyaml \
&& pip install pybrctl pyro4 rpyc yabgp \
&& mkdir -p /opt \
&& cd /opt \
&& wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py
Expand All @@ -126,15 +129,16 @@ RUN mkdir /var/run/sshd \
&& sed -ri '/^#?UsePAM/c\UsePAM no' /etc/ssh/sshd_config \
&& sed -ri '/^#?UseDNS/c\UseDNS no' /etc/ssh/sshd_config

COPY ["supervisord.conf", "/etc/supervisor/"]
COPY ["conf.d/supervisord.conf", "conf.d/sshd.conf", "conf.d/ptf_nn_agent.conf", "/etc/supervisor/conf.d/"]
COPY supervisord.conf /etc/supervisor/
COPY conf.d/ /etc/supervisor/conf.d/
COPY ptf_tgen.sh /ptf_tgen/

# 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

RUN mkdir -p /var/log/supervisor

EXPOSE 22
EXPOSE 22 8009

ENTRYPOINT ["/usr/local/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
10 changes: 10 additions & 0 deletions dockers/docker-ptf/conf.d/ptf_tgen.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[program:ptf_tgen]
command=/ptf_tgen/ptf_tgen.sh
process_name=ptf_tgen
stdout_logfile=/tmp/ptf_tgen.out.log
stderr_logfile=/tmp/ptf_tgen.err.log
redirect_stderr=false
autostart=false
autorestart=true
startsecs=1
numprocs=1
1 change: 1 addition & 0 deletions dockers/docker-ptf/ptf_tgen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# PLACEHOLDER - This file is intended to be overwritten by SPYTest.