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

Initial commit for introducing the SONiC Platform Development Env (Re… #7510

Merged
merged 36 commits into from
Jul 24, 2021
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c152419
Initial commit for introducing the SONiC Platform Development Env (Re…
geans-pin May 4, 2021
de606bb
Initial commit for introducing the SONiC Platform Development Env (Re…
geans-pin May 4, 2021
1945c12
Merge branch 'pde_infra' of https://github.com/geans-pin/sonic-buildi…
geans-pin May 27, 2021
18c82ae
Fix conflict
geans-pin May 27, 2021
38592f9
Merge branch 'pde_infra' of https://github.com/geans-pin/sonic-buildi…
geans-pin May 27, 2021
d0f6bb2
Fix review comment
geans-pin Jun 4, 2021
01d43db
Initial commit for introducing the SONiC Platform Development Env (Re…
geans-pin May 4, 2021
edfd308
Fix review comment
geans-pin Jun 4, 2021
bfb9670
Merge branch 'pde_infra' of https://github.com/geans-pin/sonic-buildi…
geans-pin Jun 11, 2021
7cd31a4
Fix LGTM
geans-pin Jun 11, 2021
1ebb2a8
Initial commit for introducing the SONiC Platform Development Env (Re…
geans-pin May 4, 2021
f4bfad2
Initial commit for introducing the SONiC Platform Development Env (Re…
geans-pin May 4, 2021
89d75bc
Fix review comment
geans-pin Jun 4, 2021
1d18264
Initial commit for introducing the SONiC Platform Development Env (Re…
geans-pin May 4, 2021
7368837
Fix review comment
geans-pin Jun 4, 2021
ef975aa
Fix LGTM
geans-pin Jun 11, 2021
eed698c
Merge branch 'pde_infra' of https://github.com/geans-pin/sonic-buildi…
geans-pin Jun 23, 2021
b1ab9d5
Initial commit for introducing the SONiC Platform Development Env (Re…
geans-pin May 4, 2021
7771db9
Initial commit for introducing the SONiC Platform Development Env (Re…
geans-pin May 4, 2021
d595039
Fix review comment
geans-pin Jun 4, 2021
c375869
Initial commit for introducing the SONiC Platform Development Env (Re…
geans-pin May 4, 2021
9714e61
Fix review comment
geans-pin Jun 4, 2021
dfea080
Fix LGTM
geans-pin Jun 11, 2021
4fdfc29
Merge branch 'pde_infra' of https://github.com/geans-pin/sonic-buildi…
geans-pin Jun 23, 2021
d34215c
Merge branch 'master' into pde_infra
geans-pin Jun 23, 2021
636d587
Fix review comment
geans-pin Jun 24, 2021
5b2232e
Merge branch 'pde_infra' of https://github.com/geans-pin/sonic-buildi…
geans-pin Jun 24, 2021
64532b3
Fix review comment
geans-pin Jun 24, 2021
42107fe
Remove empty lines
geans-pin Jun 24, 2021
964d61f
Link to pde submodule
geans-pin Jul 2, 2021
d9a5e2a
ADD submodule sonic-platform-pde/
geans-pin Jul 2, 2021
fbd5f24
fix submodule add
geans-pin Jul 2, 2021
e4cff3e
Fix review comment
geans-pin Jul 23, 2021
9ed8ebb
Fix build err
geans-pin Jul 23, 2021
c79d04d
Removed unused
geans-pin Jul 23, 2021
7895160
Fix comment 2nd
geans-pin Jul 23, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion Makefile.work
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ SONIC_BUILD_INSTRUCTION := make \
SONIC_IMAGE_VERSION=$(SONIC_IMAGE_VERSION) \
ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \
ENABLE_ZTP=$(ENABLE_ZTP) \
ENABLE_PDE=$(ENABLE_PDE) \
geans-pin marked this conversation as resolved.
Show resolved Hide resolved
SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \
INCLUDE_KUBERNETES=$(INCLUDE_KUBERNETES) \
KUBERNETES_VERSION=$(KUBERNETES_VERSION) \
Expand Down Expand Up @@ -277,7 +278,18 @@ SONIC_BUILD_INSTRUCTION := make \
SLAVE_DIR=$(SLAVE_DIR) \
$(SONIC_OVERRIDE_BUILD_VARS)

.PHONY: sonic-slave-build sonic-slave-bash init reset
PDESUBMODULES = src/sonic-linux-kernel \
geans-pin marked this conversation as resolved.
Show resolved Hide resolved
src/sonic-utilities \
src/sonic-platform-common \
src/sonic-swss-common \
src/sonic-swss \
src/sonic-py-swsssdk \
src/redis-dump-load \
src/sonic-sairedis \
src/sonic-ztp \
src/sonic-platform-daemons \
src/sonic-platform-pde
.PHONY: sonic-slave-build sonic-slave-bash init initpde reset

.DEFAULT_GOAL := all

Expand Down Expand Up @@ -346,6 +358,14 @@ showtag:
@echo $(SLAVE_IMAGE):$(SLAVE_TAG)
@echo $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG)

initpde:
geans-pin marked this conversation as resolved.
Show resolved Hide resolved

@for submodule in $(PDESUBMODULES) ; do \
git submodule update --init --recursive $$submodule ; \
done
@git submodule foreach --recursive '[ -f .git ] && echo "gitdir: $$(realpath --relative-to=. $$(cut -d" " -f2 .git))" > .git'


init :
@git submodule update --init --recursive
@git submodule foreach --recursive '[ -f .git ] && echo "gitdir: $$(realpath --relative-to=. $$(cut -d" " -f2 .git))" > .git'
Expand Down
95 changes: 95 additions & 0 deletions dockers/docker-pde/Dockerfile.j2
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"]
37 changes: 37 additions & 0 deletions dockers/docker-pde/base_image_files/pde-bench
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 "-----------------------------------------------------------------------"
Loading