-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PDE]: introduce the SONiC Platform Development Env (#7510)
The PDE silicon test harness and platform test harness can be found in src/sonic-platform-pdk-pde
- Loading branch information
Showing
24 changed files
with
1,084 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
FROM {{ docker_pde_load_image }} | ||
|
||
ARG docker_container_name | ||
ENV PYTHONPATH=/usr/share/sonic/platform | ||
|
||
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf | ||
|
||
# Make apt-get non-interactive | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
{% if ARTIFACTORY_URL is defined and ARTIFACTORY_URL|length -%} | ||
# Insert Artifactory URL references | ||
COPY ["files/03_stretch_af.list", "/etc/apt/sources.list.d/"] | ||
{%- endif %} | ||
|
||
# Update apt's cache of available packages | ||
RUN apt-get update && apt-get install -y ipmitool telnet busybox kmod libpcap-dev | ||
|
||
# Packages for benchmark tool - nench.sh | ||
RUN apt-get install -y bzip2 curl ioping openssl bc sysstat | ||
|
||
# Packages for PDDF | ||
|
||
RUN apt-get install -y python-jsonschema | ||
|
||
RUN pip3 install pytest pexpect | ||
|
||
{% if docker_pde_debs.strip() -%} | ||
# Copy locally-built Debian package dependencies | ||
COPY \ | ||
{% for deb in docker_pde_debs.split(' ') -%} | ||
debs/{{ deb }}{{' '}} | ||
{%- endfor -%} | ||
/debs/ | ||
|
||
# Install locally-built Debian packages and implicitly install their dependencies | ||
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }{%- for deb in docker_pde_debs.split(' ') %}; \ | ||
dpkg_apt /debs/{{ deb }} | ||
{%- endfor %} | ||
{%- endif %} | ||
|
||
{% if docker_pde_pydebs.strip() -%} | ||
# Copy locally-built Debian package dependencies | ||
COPY \ | ||
{% for deb in docker_pde_pydebs.split(' ') -%} | ||
python-debs/{{ deb }}{{' '}} | ||
{%- endfor -%} | ||
/debs/ | ||
|
||
# Install locally-built Debian packages and implicitly install their dependencies | ||
{%- for deb in docker_pde_pydebs.split(' ') %} | ||
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /debs/{{ deb }} | ||
{%- endfor %} | ||
{%- endif %} | ||
|
||
{% if docker_pde_whls.strip() -%} | ||
# Copy locally-built Python wheel dependencies | ||
COPY \ | ||
{% for whl in docker_pde_whls.split(' ') -%} | ||
python-wheels/{{ whl }}{{' '}} | ||
{%- endfor -%} | ||
/python-wheels/ | ||
|
||
# Install locally-built Python wheel dependencies | ||
|
||
RUN pip3 install \ | ||
|
||
|
||
{% for whl in docker_pde_whls.split(' ') -%} | ||
/python-wheels/{{ whl }}{{' '}} | ||
{%- endfor %} | ||
{% endif %} | ||
|
||
{% if ARTIFACTORY_URL is defined and ARTIFACTORY_URL|length -%} | ||
# Remove Artifactory URL references | ||
RUN rm -f /etc/apt/sources.list.d/03_stretch_af.list && apt-get update | ||
{%- endif %} | ||
|
||
# Clean up | ||
RUN apt-get clean -y; \ | ||
apt-get autoclean -y; \ | ||
apt-get autoremove -y | ||
RUN rm -rf /debs ~/.cache | ||
|
||
RUN mkdir -p /home/pde | ||
|
||
COPY ["bench.sh", "/usr/bin/"] | ||
COPY ["stress-sfp-i2c.py", "/home/pde"] | ||
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] | ||
COPY ["syseeprom.py", "/usr/bin/"] | ||
COPY ["docker_init.sh", "/usr/bin/"] | ||
COPY ["cancun_files/cancun_4.5.0/*", "cancun_files/cancun_6.6.1/*", "cancun_files/cancun_4.3.0/*", "/usr/lib/cancun/"] | ||
COPY ["syncd_init_common.sh", "/usr/bin/"] | ||
|
||
ENTRYPOINT ["/usr/bin/docker_init.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
CSV=/tmp/bench.csv | ||
|
||
# Make sure only root can run our script | ||
if [ "$(id -u)" != "0" ]; then | ||
echo "This script must be run as root" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
# Start PDE if it's deactivated | ||
if [ $(docker ps | grep -c pde) -eq 0 ]; then | ||
pde.sh start | ||
fi | ||
|
||
# Allow 5 seconds for PDE to be coming up | ||
for t in $(seq 1 5) | ||
do | ||
if [ $(docker ps | grep -c pde) -gt 0 ]; then | ||
break | ||
fi | ||
sleep 1 | ||
done | ||
if [ $(docker ps | grep -c pde) -eq 0 ]; then | ||
echo "docker-pde is not alive, existing ..." | ||
exit 1 | ||
fi | ||
|
||
# Launch the benchmark test suite | ||
docker exec -it pde /usr/bin/bench.sh | ||
echo "$(docker exec -it pde cat ${CSV})" > ${CSV} | ||
|
||
echo "" | ||
echo "CSV Report: ${CSV}" | ||
echo "-----------------------------------------------------------------------" | ||
echo "$(cat ${CSV})" | ||
echo "-----------------------------------------------------------------------" |
Oops, something went wrong.