Skip to content

Commit 0824509

Browse files
daallabdosi
authored andcommitted
[docker-ptf] Add support for spytest to ptf container (#4410)
- Install apt and pip dependencies - Define traffic generator service Signed-off-by: Danny Allen <[email protected]>
1 parent 0d6754d commit 0824509

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

dockers/docker-ptf/Dockerfile.j2

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ debs/
2222
ENV DEBIAN_FRONTEND=noninteractive
2323

2424
## Set the apt source, update package cache and install necessary packages
25+
## TODO: Clean up this step
2526
RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' /etc/apt/sources.list \
2627
&& apt-get update \
2728
&& apt-get upgrade -y \
@@ -38,7 +39,6 @@ RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' /
3839
unzip \
3940
pkg-config \
4041
binutils \
41-
net-tools \
4242
build-essential \
4343
libssl-dev \
4444
libffi-dev \
@@ -52,7 +52,6 @@ RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' /
5252
iputils-ping \
5353
hping3 \
5454
curl \
55-
tcpdump \
5655
tmux \
5756
python \
5857
python-dev \
@@ -63,14 +62,17 @@ RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' /
6362
rsyslog \
6463
ntp \
6564
ntpstat \
66-
ntpdate
65+
ntpdate \
66+
arping \
67+
bridge-utils
6768

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

7374
# Install all python modules from pypi. python-scapy is exception, ptf debian package requires python-scapy
75+
# TODO: Clean up this step
7476
RUN rm -rf /debs \
7577
&& apt-get -y autoclean \
7678
&& apt-get -y autoremove \
@@ -106,6 +108,7 @@ RUN rm -rf /debs \
106108
&& pip install flask \
107109
&& pip install exabgp==3.4.17\
108110
&& pip install pyaml \
111+
&& pip install pybrctl pyro4 rpyc yabgp \
109112
&& mkdir -p /opt \
110113
&& cd /opt \
111114
&& wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py
@@ -117,15 +120,16 @@ RUN mkdir /var/run/sshd \
117120
&& sed -ri '/^#?UsePAM/c\UsePAM no' /etc/ssh/sshd_config \
118121
&& sed -ri '/^#?UseDNS/c\UseDNS no' /etc/ssh/sshd_config
119122

120-
COPY ["supervisord.conf", "/etc/supervisor/"]
121-
COPY ["conf.d/supervisord.conf", "conf.d/sshd.conf", "conf.d/ptf_nn_agent.conf", "/etc/supervisor/conf.d/"]
123+
COPY supervisord.conf /etc/supervisor/
124+
COPY conf.d/ /etc/supervisor/conf.d/
125+
COPY ptf_tgen.sh /ptf_tgen/
122126

123127
# Move tcpdump into /usr/bin Otherwise it's impossible to run tcpdump due to a docker bug
124128
RUN mv /usr/sbin/tcpdump /usr/bin/tcpdump
125129
RUN ln -s /usr/bin/tcpdump /usr/sbin/tcpdump
126130

127131
RUN mkdir -p /var/log/supervisor
128132

129-
EXPOSE 22
133+
EXPOSE 22 8009
130134

131135
ENTRYPOINT ["/usr/local/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[program:ptf_tgen]
2+
command=/ptf_tgen/ptf_tgen.sh
3+
process_name=ptf_tgen
4+
stdout_logfile=/tmp/ptf_tgen.out.log
5+
stderr_logfile=/tmp/ptf_tgen.err.log
6+
redirect_stderr=false
7+
autostart=false
8+
autorestart=true
9+
startsecs=1
10+
numprocs=1

dockers/docker-ptf/ptf_tgen.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# PLACEHOLDER - This file is intended to be overwritten by SPYTest.

0 commit comments

Comments
 (0)