[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
This commit is contained in:
parent
f929c3bd03
commit
aa59bfeab7
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -40,6 +40,9 @@
|
||||
[submodule "src/sonic-platform-daemons"]
|
||||
path = src/sonic-platform-daemons
|
||||
url = https://github.com/Azure/sonic-platform-daemons
|
||||
[submodule "src/sonic-platform-pde"]
|
||||
path = src/sonic-platform-pde
|
||||
url = https://github.com/Azure/sonic-platform-pdk-pde
|
||||
[submodule "src/sonic-frr/frr"]
|
||||
path = src/sonic-frr/frr
|
||||
url = https://github.com/Azure/sonic-frr.git
|
||||
|
@ -249,6 +249,7 @@ SONIC_BUILD_INSTRUCTION := make \
|
||||
SONIC_IMAGE_VERSION=$(SONIC_IMAGE_VERSION) \
|
||||
ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \
|
||||
ENABLE_ZTP=$(ENABLE_ZTP) \
|
||||
INCLUDE_PDE=$(INCLUDE_PDE) \
|
||||
SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \
|
||||
INCLUDE_KUBERNETES=$(INCLUDE_KUBERNETES) \
|
||||
KUBERNETES_VERSION=$(KUBERNETES_VERSION) \
|
||||
|
95
dockers/docker-pde/Dockerfile.j2
Normal file
95
dockers/docker-pde/Dockerfile.j2
Normal file
@ -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
dockers/docker-pde/base_image_files/pde-bench
Normal file
37
dockers/docker-pde/base_image_files/pde-bench
Normal file
@ -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 "-----------------------------------------------------------------------"
|
326
dockers/docker-pde/base_image_files/pde-bench-knet
Normal file
326
dockers/docker-pde/base_image_files/pde-bench-knet
Normal file
@ -0,0 +1,326 @@
|
||||
#!/bin/bash
|
||||
|
||||
PLATF_DIR=/usr/share/sonic/platform
|
||||
HWSKU_DIR=/usr/share/sonic/hwsku
|
||||
PORT=Ethernet0
|
||||
LANE=1
|
||||
SPEED=0
|
||||
BCMPORT=ce0
|
||||
DURATION=5
|
||||
|
||||
PPS_128=0
|
||||
BPS_128=0
|
||||
PPS_256=0
|
||||
BPS_256=0
|
||||
PPS_512=0
|
||||
BPS_512=0
|
||||
PPS_1024=0
|
||||
BPS_1024=0
|
||||
PPS_2048=0
|
||||
BPS_2048=0
|
||||
PPS_4096=0
|
||||
BPS_4096=0
|
||||
PPS_8192=0
|
||||
BPS_8192=0
|
||||
PPS_9000=0
|
||||
BPS_9000=0
|
||||
|
||||
# SWSS is mandatory for KNET benchmark
|
||||
sudo systemctl start swss
|
||||
for t in $(seq 1 15)
|
||||
do
|
||||
if [ $(docker ps | grep -c swss) -gt 0 ]; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
if [ $(docker ps | grep -c swss) -eq 0 ]; then
|
||||
echo "ERR: docker-swss is not alive, existing ..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Find out the PLATFORM and HWSKU
|
||||
if [ ! -d ${PLATF_DIR} ]; then
|
||||
name=$(grep 'onie_platform=' /host/machine.conf | cut -d '=' -f 2)
|
||||
PLATF_DIR=/usr/share/sonic/device/${name}
|
||||
fi
|
||||
|
||||
if [ ! -d ${HWSKU_DIR} ]; then
|
||||
name=$(head -1 ${PLATF_DIR}/default_sku | awk '{print $1}')
|
||||
HWSKU_DIR=${PLATF_DIR}/${name}
|
||||
fi
|
||||
|
||||
echo "PLATFORM='${PLATF_DIR}'"
|
||||
echo "HWSKU='${HWSKU_DIR}'"
|
||||
|
||||
# Determine the target port for KNET benchmark
|
||||
while IFS= read -r line; do
|
||||
line=$(echo ${line} | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
||||
if [[ ${line} = \#* ]]; then
|
||||
continue
|
||||
fi
|
||||
port=$(echo ${line} | awk '{print $1}')
|
||||
lane=$(echo ${line} | awk '{print $2}' | cut -d ',' -f 1)
|
||||
speed=$(echo ${line} | awk '{print $5}')
|
||||
if [ -z "${speed}" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ ${speed} -gt ${SPEED} ]; then
|
||||
PORT=${port}
|
||||
LANE=${lane}
|
||||
SPEED=${speed}
|
||||
fi
|
||||
done < ${HWSKU_DIR}/port_config.ini
|
||||
|
||||
echo "PORT=${PORT}"
|
||||
echo "LANE=${LANE}"
|
||||
echo "SPEED=${SPEED}"
|
||||
|
||||
# Find out the name of the corresponding bcm port
|
||||
TEMP=$(mktemp)
|
||||
bcmcmd 'show pmap' | grep ${LANE} > ${TEMP}
|
||||
while IFS= read -r line; do
|
||||
line=$(echo ${line} | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
||||
if [ $(echo ${line} | awk '{print $4}') -eq ${LANE} ]; then
|
||||
BCMPORT=$(echo ${line} | awk '{print $1}')
|
||||
break
|
||||
fi
|
||||
done < ${TEMP}
|
||||
rm -f ${TEMP}
|
||||
|
||||
echo "BCMPORT=${BCMPORT}"
|
||||
|
||||
# SWSS: Update the LLDP rate limit
|
||||
TEMP=$(mktemp)
|
||||
rm -f ${TEMP}.*
|
||||
docker cp swss:/etc/swss/config.d/00-copp.config.json ${TEMP}.old
|
||||
if [ ! -f ${TEMP}.old ]; then
|
||||
echo "Unable to get 00-copp.config.json from docker-swss"
|
||||
fi
|
||||
|
||||
lldp=0
|
||||
while IFS= read -r line
|
||||
do
|
||||
if [ $(echo $line | grep -c -E '\"COPP_TABLE:') -gt 0 ]; then
|
||||
lldp=0
|
||||
fi
|
||||
if [ $(echo $line | grep -c -E 'trap_ids.*,lldp') -gt 0 ]; then
|
||||
lldp=1
|
||||
fi
|
||||
if [ $lldp -gt 0 ]; then
|
||||
if [ $(echo $line | grep -c -E '.*\"cir\"') -gt 0 ]; then
|
||||
echo "${line%:*}:\"30000\"," >> ${TEMP}.new
|
||||
lldp=$(expr $lldp + 1)
|
||||
continue
|
||||
fi
|
||||
if [ $(echo $line | grep -c -E '.*\"cbs\"') -gt 0 ]; then
|
||||
echo "${line%:*}:\"30000\"," >> ${TEMP}.new
|
||||
lldp=$(expr $lldp + 1)
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
echo "$line" >> ${TEMP}.new
|
||||
done < "${TEMP}.old"
|
||||
|
||||
csum1=$(md5sum ${TEMP}.old | cut -d ' ' -f 1)
|
||||
csum2=$(md5sum ${TEMP}.new | cut -d ' ' -f 1)
|
||||
if [ "${csum1}" != "${csum2}" ]; then
|
||||
docker cp ${TEMP}.new swss:/etc/swss/config.d/00-copp.config.json
|
||||
sudo config copp rx-rate 100000
|
||||
sudo config save -y
|
||||
sudo config reload -y
|
||||
fi
|
||||
|
||||
# Disable ZTP
|
||||
sudo config ztp disable -y > /dev/null 2>&1
|
||||
|
||||
# Enable the target port for benchmarking
|
||||
echo "Allow 15 seconds for ${PORT} getting ready"
|
||||
|
||||
for tick in $(seq 1 15); do
|
||||
if [ -d /sys/class/net/${PORT} ]; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
sudo config interface startup ${PORT} > /dev/null 2>&1
|
||||
|
||||
# Enable MAC loopback mode to the target port
|
||||
bcmcmd "port ${BCMPORT} lb=mac" > /dev/null 2>&1
|
||||
|
||||
# Get started with the loopback benchmark test
|
||||
#
|
||||
|
||||
# 128B
|
||||
P1=$(cat /sys/class/net/${PORT}/statistics/rx_packets)
|
||||
B1=$(cat /sys/class/net/${PORT}/statistics/rx_bytes)
|
||||
if [ $(docker ps | grep -c pde) -gt 0 ]; then
|
||||
docker exec -it pde /usr/local/bin/pktsend ${PORT} ${DURATION} 128
|
||||
else
|
||||
/usr/local/bin/pktsend ${PORT} ${DURATION} 128
|
||||
fi
|
||||
P2=$(cat /sys/class/net/${PORT}/statistics/rx_packets)
|
||||
B2=$(cat /sys/class/net/${PORT}/statistics/rx_bytes)
|
||||
NUM=$(expr ${P2} - ${P1})
|
||||
PPS=$(expr ${NUM} / ${DURATION})
|
||||
NUM=$(expr ${B2} - ${B1})
|
||||
BPS=$(expr ${NUM} / ${DURATION})
|
||||
BPS=$(expr ${BPS} / 1000000)
|
||||
BPS=$(expr ${BPS} \* 8)
|
||||
echo "PPS=${PPS}, BPS=${BPS}Mbps"
|
||||
PPS_128=${PPS}
|
||||
BPS_128=${BPS}
|
||||
|
||||
# 256B
|
||||
P1=$(cat /sys/class/net/${PORT}/statistics/rx_packets)
|
||||
B1=$(cat /sys/class/net/${PORT}/statistics/rx_bytes)
|
||||
if [ $(docker ps | grep -c pde) -gt 0 ]; then
|
||||
docker exec -it pde /usr/local/bin/pktsend ${PORT} ${DURATION} 256
|
||||
else
|
||||
/usr/local/bin/pktsend ${PORT} ${DURATION} 256
|
||||
fi
|
||||
P2=$(cat /sys/class/net/${PORT}/statistics/rx_packets)
|
||||
B2=$(cat /sys/class/net/${PORT}/statistics/rx_bytes)
|
||||
NUM=$(expr ${P2} - ${P1})
|
||||
PPS=$(expr ${NUM} / ${DURATION})
|
||||
NUM=$(expr ${B2} - ${B1})
|
||||
BPS=$(expr ${NUM} / ${DURATION})
|
||||
BPS=$(expr ${BPS} / 1000000)
|
||||
BPS=$(expr ${BPS} \* 8)
|
||||
echo "PPS=${PPS}, BPS=${BPS}Mbps"
|
||||
PPS_256=${PPS}
|
||||
BPS_256=${BPS}
|
||||
|
||||
# 512B
|
||||
P1=$(cat /sys/class/net/${PORT}/statistics/rx_packets)
|
||||
B1=$(cat /sys/class/net/${PORT}/statistics/rx_bytes)
|
||||
if [ $(docker ps | grep -c pde) -gt 0 ]; then
|
||||
docker exec -it pde /usr/local/bin/pktsend ${PORT} ${DURATION} 512
|
||||
else
|
||||
/usr/local/bin/pktsend ${PORT} ${DURATION} 512
|
||||
fi
|
||||
P2=$(cat /sys/class/net/${PORT}/statistics/rx_packets)
|
||||
B2=$(cat /sys/class/net/${PORT}/statistics/rx_bytes)
|
||||
NUM=$(expr ${P2} - ${P1})
|
||||
PPS=$(expr ${NUM} / ${DURATION})
|
||||
NUM=$(expr ${B2} - ${B1})
|
||||
BPS=$(expr ${NUM} / ${DURATION})
|
||||
BPS=$(expr ${BPS} / 1000000)
|
||||
BPS=$(expr ${BPS} \* 8)
|
||||
echo "PPS=${PPS}, BPS=${BPS}Mbps"
|
||||
PPS_512=${PPS}
|
||||
BPS_512=${BPS}
|
||||
|
||||
# 1024B
|
||||
P1=$(cat /sys/class/net/${PORT}/statistics/rx_packets)
|
||||
B1=$(cat /sys/class/net/${PORT}/statistics/rx_bytes)
|
||||
if [ $(docker ps | grep -c pde) -gt 0 ]; then
|
||||
docker exec -it pde /usr/local/bin/pktsend ${PORT} ${DURATION} 1024
|
||||
else
|
||||
/usr/local/bin/pktsend ${PORT} ${DURATION} 1024
|
||||
fi
|
||||
P2=$(cat /sys/class/net/${PORT}/statistics/rx_packets)
|
||||
B2=$(cat /sys/class/net/${PORT}/statistics/rx_bytes)
|
||||
NUM=$(expr ${P2} - ${P1})
|
||||
PPS=$(expr ${NUM} / ${DURATION})
|
||||
NUM=$(expr ${B2} - ${B1})
|
||||
BPS=$(expr ${NUM} / ${DURATION})
|
||||
BPS=$(expr ${BPS} / 1000000)
|
||||
BPS=$(expr ${BPS} \* 8)
|
||||
echo "PPS=${PPS}, BPS=${BPS}Mbps"
|
||||
PPS_1024=${PPS}
|
||||
BPS_1024=${BPS}
|
||||
|
||||
# 2048B
|
||||
P1=$(cat /sys/class/net/${PORT}/statistics/rx_packets)
|
||||
B1=$(cat /sys/class/net/${PORT}/statistics/rx_bytes)
|
||||
if [ $(docker ps | grep -c pde) -gt 0 ]; then
|
||||
docker exec -it pde /usr/local/bin/pktsend ${PORT} ${DURATION} 2048
|
||||
else
|
||||
/usr/local/bin/pktsend ${PORT} ${DURATION} 2048
|
||||
fi
|
||||
P2=$(cat /sys/class/net/${PORT}/statistics/rx_packets)
|
||||
B2=$(cat /sys/class/net/${PORT}/statistics/rx_bytes)
|
||||
NUM=$(expr ${P2} - ${P1})
|
||||
PPS=$(expr ${NUM} / ${DURATION})
|
||||
NUM=$(expr ${B2} - ${B1})
|
||||
BPS=$(expr ${NUM} / ${DURATION})
|
||||
BPS=$(expr ${BPS} / 1000000)
|
||||
BPS=$(expr ${BPS} \* 8)
|
||||
echo "PPS=${PPS}, BPS=${BPS}Mbps"
|
||||
PPS_2048=${PPS}
|
||||
BPS_2048=${BPS}
|
||||
|
||||
# 4096B
|
||||
P1=$(cat /sys/class/net/${PORT}/statistics/rx_packets)
|
||||
B1=$(cat /sys/class/net/${PORT}/statistics/rx_bytes)
|
||||
if [ $(docker ps | grep -c pde) -gt 0 ]; then
|
||||
docker exec -it pde /usr/local/bin/pktsend ${PORT} ${DURATION} 4096
|
||||
else
|
||||
/usr/local/bin/pktsend ${PORT} ${DURATION} 4096
|
||||
fi
|
||||
P2=$(cat /sys/class/net/${PORT}/statistics/rx_packets)
|
||||
B2=$(cat /sys/class/net/${PORT}/statistics/rx_bytes)
|
||||
NUM=$(expr ${P2} - ${P1})
|
||||
PPS=$(expr ${NUM} / ${DURATION})
|
||||
NUM=$(expr ${B2} - ${B1})
|
||||
BPS=$(expr ${NUM} / ${DURATION})
|
||||
BPS=$(expr ${BPS} / 1000000)
|
||||
BPS=$(expr ${BPS} \* 8)
|
||||
echo "PPS=${PPS}, BPS=${BPS}Mbps"
|
||||
PPS_4096=${PPS}
|
||||
BPS_4096=${BPS}
|
||||
|
||||
# 8192B
|
||||
P1=$(cat /sys/class/net/${PORT}/statistics/rx_packets)
|
||||
B1=$(cat /sys/class/net/${PORT}/statistics/rx_bytes)
|
||||
if [ $(docker ps | grep -c pde) -gt 0 ]; then
|
||||
docker exec -it pde /usr/local/bin/pktsend ${PORT} ${DURATION} 8192
|
||||
else
|
||||
/usr/local/bin/pktsend ${PORT} ${DURATION} 8192
|
||||
fi
|
||||
P2=$(cat /sys/class/net/${PORT}/statistics/rx_packets)
|
||||
B2=$(cat /sys/class/net/${PORT}/statistics/rx_bytes)
|
||||
NUM=$(expr ${P2} - ${P1})
|
||||
PPS=$(expr ${NUM} / ${DURATION})
|
||||
NUM=$(expr ${B2} - ${B1})
|
||||
BPS=$(expr ${NUM} / ${DURATION})
|
||||
BPS=$(expr ${BPS} / 1000000)
|
||||
BPS=$(expr ${BPS} \* 8)
|
||||
echo "PPS=${PPS}, BPS=${BPS}Mbps"
|
||||
PPS_8192=${PPS}
|
||||
BPS_8192=${BPS}
|
||||
|
||||
# 9000B
|
||||
P1=$(cat /sys/class/net/${PORT}/statistics/rx_packets)
|
||||
B1=$(cat /sys/class/net/${PORT}/statistics/rx_bytes)
|
||||
if [ $(docker ps | grep -c pde) -gt 0 ]; then
|
||||
docker exec -it pde /usr/local/bin/pktsend ${PORT} ${DURATION} 9000
|
||||
else
|
||||
/usr/local/bin/pktsend ${PORT} ${DURATION} 9000
|
||||
fi
|
||||
P2=$(cat /sys/class/net/${PORT}/statistics/rx_packets)
|
||||
B2=$(cat /sys/class/net/${PORT}/statistics/rx_bytes)
|
||||
NUM=$(expr ${P2} - ${P1})
|
||||
PPS=$(expr ${NUM} / ${DURATION})
|
||||
NUM=$(expr ${B2} - ${B1})
|
||||
BPS=$(expr ${NUM} / ${DURATION})
|
||||
BPS=$(expr ${BPS} / 1000000)
|
||||
BPS=$(expr ${BPS} \* 8)
|
||||
echo "PPS=${PPS}, BPS=${BPS}Mbps"
|
||||
PPS_9000=${PPS}
|
||||
BPS_9000=${BPS}
|
||||
|
||||
# Disable MAC loopback mode to the target port
|
||||
bcmcmd "port ${BCMPORT} lb=none" > /dev/null 2>&1
|
||||
|
||||
# Generate the final report
|
||||
echo "payload size,loopback pps(Pkt/s),loopback Mbps(Mbit/s)"
|
||||
echo "128B,${PPS_128},${BPS_128}"
|
||||
echo "256B,${PPS_256},${BPS_256}"
|
||||
echo "512B,${PPS_512},${BPS_512}"
|
||||
echo "1024B,${PPS_1024},${BPS_1024}"
|
||||
echo "2048B,${PPS_2048},${BPS_2048}"
|
||||
echo "4096B,${PPS_4096},${BPS_4096}"
|
||||
echo "8192B,${PPS_8192},${BPS_8192}"
|
||||
echo "9000B,${PPS_9000},${BPS_9000}"
|
27
dockers/docker-pde/base_image_files/pde-stress
Normal file
27
dockers/docker-pde/base_image_files/pde-stress
Normal file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 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
|
||||
done
|
||||
if [ $(docker ps | grep -c pde) -eq 0 ]; then
|
||||
echo "docker-pde is not alive, existing ..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Now launch the PDE stress test
|
||||
docker exec -it pde /home/pde/stress-sfp-i2c.py $*
|
59
dockers/docker-pde/base_image_files/pde-test
Normal file
59
dockers/docker-pde/base_image_files/pde-test
Normal file
@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 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
|
||||
|
||||
# Make sure SWSS is deactivated
|
||||
if [ $(docker ps | grep -c swss) -ne 0 ]; then
|
||||
systemctl stop swss
|
||||
sleep 3
|
||||
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
|
||||
done
|
||||
if [ $(docker ps | grep -c pde) -eq 0 ]; then
|
||||
echo "docker-pde is not alive, existing ..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
usage()
|
||||
{
|
||||
echo "usage: $0 <help/list/commands>"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ $# -lt 1 ]
|
||||
then
|
||||
usage
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
-h | help)
|
||||
usage
|
||||
;;
|
||||
-l | ls | list)
|
||||
docker exec -it -w /usr/local/sonic_pde_tests pde ls
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Now launch the PDE pytest
|
||||
docker exec -it -w /usr/local/sonic_pde_tests pde pytest $*
|
||||
|
||||
# Reactivate the SWSS
|
||||
systemctl start swss
|
140
dockers/docker-pde/bench.sh
Normal file
140
dockers/docker-pde/bench.sh
Normal file
@ -0,0 +1,140 @@
|
||||
#!/bin/bash
|
||||
|
||||
CSV=/tmp/bench.csv
|
||||
|
||||
TST_FREQ=2000
|
||||
TST_CORE=4
|
||||
TST_RAMSZ=8
|
||||
TST_DISKSZ=14
|
||||
TST_SHA=10
|
||||
TST_BZ2=30
|
||||
TST_AES=5
|
||||
TST_DISKRD=180
|
||||
TST_DISKWR=30
|
||||
|
||||
cpu_benchmark()
|
||||
{
|
||||
export TIMEFORMAT='%1R'
|
||||
(time dd if=/dev/zero bs=1M count=500 2> /dev/null | \
|
||||
"$@" > /dev/null ) 2>&1
|
||||
}
|
||||
|
||||
# Platform Info
|
||||
PLATFORM=$(grep 'onie_platform=' /host/machine.conf | cut -d '=' -f 2)
|
||||
echo "Platform: ${PLATFORM}"
|
||||
|
||||
if [ -d /usr/share/sonic/platform ]; then
|
||||
HWSKU=$(head -1 /usr/share/sonic/platform/default_sku | awk '{print $1}')
|
||||
else
|
||||
HWSKU=$(head -1 /usr/share/sonic/device/${PLATFORM}/default_sku | awk '{print $1}')
|
||||
fi
|
||||
echo "HWSKU: ${HWSKU}"
|
||||
|
||||
REVISION=$(syseeprom.py 0x27)
|
||||
echo "Revision: ${REVISION}"
|
||||
|
||||
# Basic Info
|
||||
CPU_NAME=$(awk -F: '/model name/ {name=$2} END {print name}' /proc/cpuinfo | cut -d '@' -f 1 | sed 's/^[ \t]*//;s/[ \t]*$//')
|
||||
echo "CPU NAME: ${CPU_NAME}"
|
||||
|
||||
if [ $(lscpu | grep -c 'CPU max MHz') -gt 0 ]; then
|
||||
CPU_FREQ=$(lscpu | grep 'CPU max MHz' | cut -d ':' -f 2 | cut -d '.' -f 1 | sed 's/^[[:space:]]*//')
|
||||
else
|
||||
CPU_FREQ=$(lscpu | grep 'CPU MHz' | cut -d ':' -f 2 | cut -d '.' -f 1 | sed 's/^[[:space:]]*//')
|
||||
fi
|
||||
echo -n "CPU FREQ: ${CPU_FREQ} MHz ........"
|
||||
if [ ${CPU_FREQ} -ge ${TST_FREQ} ]; then
|
||||
echo "pass"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
|
||||
CPU_CORE=$(awk -F: '/model name/ {core++} END {print core}' /proc/cpuinfo)
|
||||
echo -n "CPU CORE: ${CPU_CORE} ..............."
|
||||
if [ ${CPU_CORE} -ge ${TST_CORE} ]; then
|
||||
echo "pass"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
|
||||
RAM_SIZE=$(grep MemTotal /proc/meminfo | awk '{print $2}')
|
||||
RAM_SIZE=$(expr ${RAM_SIZE} / 1024) # MB
|
||||
RAM_SIZE=$(expr ${RAM_SIZE} + 1023)
|
||||
RAM_SIZE=$(expr ${RAM_SIZE} / 1024) # GB
|
||||
echo -n "RAM SIZE: ${RAM_SIZE} GB ..........."
|
||||
if [ ${RAM_SIZE} -ge ${TST_RAMSZ} ]; then
|
||||
echo "pass"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
|
||||
DISK_SIZE=$(lsblk -d | grep disk | head -1 | awk '{print $4}' | cut -d 'G' -f 1)
|
||||
echo -n "DISK: ${DISK_SIZE} GB ..........."
|
||||
if [ $(expr ${DISK_SIZE} \>= ${TST_DISKSZ}) -eq 1 ]; then
|
||||
echo "pass"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
|
||||
# CPU tests
|
||||
SHA_TIME=$(cpu_benchmark sha256sum)
|
||||
echo -n "SHA256: ${SHA_TIME} sec ........."
|
||||
if [ $(echo "${SHA_TIME} <= ${TST_SHA}" | bc) -eq 1 ]; then
|
||||
echo "pass"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
|
||||
BZ2_TIME=$(cpu_benchmark bzip2)
|
||||
echo -n "BZIP2: ${BZ2_TIME} sec ........."
|
||||
if [ $(echo "${BZ2_TIME} <= ${TST_BZ2}" | bc) -eq 1 ]; then
|
||||
echo "pass"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
|
||||
AES_TIME=$(cpu_benchmark openssl enc -e -aes-256-cbc -pass pass:12345678 | sed '/^\*\*\* WARNING : deprecated key derivation used\.$/d;/^Using -iter or -pbkdf2 would be better\.$/d')
|
||||
echo -n "AES256: ${AES_TIME} sec ........."
|
||||
if [ $(echo "${AES_TIME} <= ${TST_AES}" | bc) -eq 1 ]; then
|
||||
echo "pass"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
|
||||
# Disk tests
|
||||
DISK_RD=$(ioping -DRL -w 5 ./ | tail -n 2 | head -n 1 | cut -d ',' -f 4 | awk '{print $1}')
|
||||
echo -n "DISK READ: ${DISK_RD} MB/s ......"
|
||||
if [ $(echo "${DISK_RD} >= ${TST_DISKRD}" | bc) -eq 1 ]; then
|
||||
echo "pass"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
|
||||
rm -f dummy.bin
|
||||
DISK_WR=$(dd if=/dev/zero of=dummy.bin bs=64k count=16k conv=fdatasync 2>&1 | tail -1 | awk '{print $10}')
|
||||
rm -f dummy.bin
|
||||
echo -n "DISK WRITE: ${DISK_WR} MB/s ......."
|
||||
if [ $(echo "${DISK_WR} >= ${TST_DISKWR}" | bc) -eq 1 ]; then
|
||||
echo "pass"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
|
||||
# Report
|
||||
rm -f ${CSV}
|
||||
echo "Platform,HwSKU,Revision,Processor,CPU cores,Frequency(MHz),RAM(G),Disk(G),SHA256(s),bzip2(s),AES(s),sequential read(MiB/s),sequential write(MiB/s)," >> ${CSV}
|
||||
|
||||
echo -n "${PLATFORM}," >> ${CSV}
|
||||
echo -n "${HWSKU}," >> ${CSV}
|
||||
echo -n "${REVISION}," >> ${CSV}
|
||||
echo -n "${CPU_NAME}," >> ${CSV}
|
||||
echo -n "${CPU_CORE}," >> ${CSV}
|
||||
echo -n "${CPU_FREQ}," >> ${CSV}
|
||||
echo -n "${RAM_SIZE}," >> ${CSV}
|
||||
echo -n "${DISK_SIZE}," >> ${CSV}
|
||||
echo -n "${SHA_TIME}," >> ${CSV}
|
||||
echo -n "${BZ2_TIME}," >> ${CSV}
|
||||
echo -n "${AES_TIME}," >> ${CSV}
|
||||
echo -n "${DISK_RD}," >> ${CSV}
|
||||
echo -n "${DISK_WR}," >> ${CSV}
|
||||
echo "" >> ${CSV}
|
42
dockers/docker-pde/docker_init.sh
Normal file
42
dockers/docker-pde/docker_init.sh
Normal file
@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
set -x
|
||||
|
||||
start_bcm()
|
||||
{
|
||||
[ -e /dev/linux-bcm-knet ] || mknod /dev/linux-bcm-knet c 122 0
|
||||
[ -e /dev/linux-user-bde ] || mknod /dev/linux-user-bde c 126 0
|
||||
[ -e /dev/linux-kernel-bde ] || mknod /dev/linux-kernel-bde c 127 0
|
||||
}
|
||||
|
||||
PLATFORM_DIR=/usr/share/sonic/platform
|
||||
HWSKU_DIR=/usr/share/sonic/hwsku
|
||||
|
||||
mkdir -p /etc/sai.d/
|
||||
|
||||
if [ -f $HWSKU_DIR/sai.profile ]; then
|
||||
cp $HWSKU_DIR/sai.profile /etc/sai.d/sai.profile
|
||||
fi
|
||||
|
||||
. /usr/bin/syncd_init_common.sh
|
||||
config_syncd
|
||||
|
||||
# If the sonic-platform package is not installed, try to install it
|
||||
pip show sonic-platform > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
SONIC_PLATFORM_WHEEL="/usr/share/sonic/platform/sonic_platform-1.0-py2-none-any.whl"
|
||||
echo "sonic-platform package not installed, attempting to install..."
|
||||
if [ -e ${SONIC_PLATFORM_WHEEL} ]; then
|
||||
pip install ${SONIC_PLATFORM_WHEEL}
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Successfully installed ${SONIC_PLATFORM_WHEEL}"
|
||||
else
|
||||
echo "Error: Failed to install ${SONIC_PLATFORM_WHEEL}"
|
||||
fi
|
||||
else
|
||||
echo "Error: Unable to locate ${SONIC_PLATFORM_WHEEL}"
|
||||
fi
|
||||
fi
|
||||
|
||||
start_bcm
|
||||
|
||||
exec /usr/bin/supervisord
|
154
dockers/docker-pde/stress-sfp-i2c.py
Normal file
154
dockers/docker-pde/stress-sfp-i2c.py
Normal file
@ -0,0 +1,154 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
try:
|
||||
import sys
|
||||
import time
|
||||
import imp
|
||||
from natsort import natsorted
|
||||
except ImportError as e:
|
||||
raise ImportError("%s - required module not found" % str(e))
|
||||
|
||||
HWSKU_PATH = "/usr/share/sonic/hwsku"
|
||||
PLATFORM_PATH = "/usr/share/sonic/platform"
|
||||
|
||||
PLATFORM_SPECIFIC_MODULE_NAME = 'sfputil'
|
||||
PLATFORM_SPECIFIC_CLASS_NAME = 'SfpUtil'
|
||||
|
||||
XCVR_EEPROM_TYPE_UNKNOWN = 0
|
||||
XCVR_EEPROM_TYPE_SFP = 1
|
||||
XCVR_EEPROM_TYPE_QSFP = 2
|
||||
XCVR_EEPROM_TYPE_QSFPDD = 3
|
||||
XCVR_EEPROM_TYPE_OSFP = XCVR_EEPROM_TYPE_QSFPDD
|
||||
|
||||
OSFP_TYPE_ID = "18"
|
||||
|
||||
# Global platform-specific sfputil class instance
|
||||
platform_sfputil = None
|
||||
|
||||
# Global port dictionaries
|
||||
port_dict = None
|
||||
|
||||
# Loads platform specific sfputil module from source
|
||||
def load_platform_sfputil():
|
||||
global platform_sfputil
|
||||
|
||||
if platform_sfputil is not None:
|
||||
return
|
||||
|
||||
try:
|
||||
module_file = "/".join([PLATFORM_PATH, "plugins", PLATFORM_SPECIFIC_MODULE_NAME + ".py"])
|
||||
module = imp.load_source(PLATFORM_SPECIFIC_MODULE_NAME, module_file)
|
||||
except IOError, e:
|
||||
print("Failed to load platform module '%s': %s" % (PLATFORM_SPECIFIC_MODULE_NAME, str(e)), True)
|
||||
|
||||
assert module is not None
|
||||
|
||||
try:
|
||||
platform_sfputil_class = getattr(module, PLATFORM_SPECIFIC_CLASS_NAME)
|
||||
platform_sfputil = platform_sfputil_class()
|
||||
except AttributeError, e:
|
||||
print("Failed to instantiate '%s' class: %s" % (PLATFORM_SPECIFIC_CLASS_NAME, str(e)), True)
|
||||
|
||||
assert platform_sfputil is not None
|
||||
return
|
||||
|
||||
# Loads platform port dictionaries
|
||||
def load_platform_portdict():
|
||||
global port_dict
|
||||
|
||||
if port_dict is not None:
|
||||
return
|
||||
|
||||
port_dict = {}
|
||||
idx = 0
|
||||
file = open(HWSKU_PATH + "/port_config.ini", "r")
|
||||
line = file.readline()
|
||||
while line is not None and len(line) > 0:
|
||||
line = line.strip()
|
||||
if line.startswith("#"):
|
||||
line = file.readline()
|
||||
continue
|
||||
list = line.split()
|
||||
if len(list) >= 4:
|
||||
idx = int(list[3])
|
||||
port_dict[list[0]] = { "index": str(idx) }
|
||||
idx += 1
|
||||
line = file.readline()
|
||||
|
||||
return port_dict
|
||||
|
||||
def get_sfp_eeprom_type(port, data):
|
||||
type = XCVR_EEPROM_TYPE_UNKNOWN
|
||||
|
||||
if (port in platform_sfputil.osfp_ports) or (port in platform_sfputil.qsfp_ports):
|
||||
if data is None:
|
||||
return type
|
||||
|
||||
if data[0] in OSFP_TYPE_ID:
|
||||
code = 0
|
||||
for i in range(128, 222):
|
||||
code += int(data[i], 16)
|
||||
if (code & 0xff) == int(data[222], 16):
|
||||
type = XCVR_EEPROM_TYPE_OSFP
|
||||
else:
|
||||
type = XCVR_EEPROM_TYPE_QSFP
|
||||
else:
|
||||
type = XCVR_EEPROM_TYPE_QSFP
|
||||
else:
|
||||
type = XCVR_EEPROM_TYPE_SFP
|
||||
|
||||
return type
|
||||
|
||||
# Test for SFP EEPROM
|
||||
def stress_sfp_i2c_one():
|
||||
load_platform_sfputil()
|
||||
load_platform_portdict()
|
||||
num_sfp = 0
|
||||
for intf in natsorted(port_dict.keys()):
|
||||
port = int(port_dict[intf]['index'])
|
||||
if not platform_sfputil._is_valid_port(port):
|
||||
continue
|
||||
if platform_sfputil.get_presence(port):
|
||||
num_sfp += 1
|
||||
|
||||
assert num_sfp >= 2, "2 or more SFP modules should be attached for this test"
|
||||
|
||||
for intf in natsorted(port_dict.keys()):
|
||||
port = int(port_dict[intf]['index'])
|
||||
if not platform_sfputil._is_valid_port(port):
|
||||
continue
|
||||
if not platform_sfputil.get_presence(port):
|
||||
continue
|
||||
|
||||
data = platform_sfputil.get_eeprom_raw(port, 256)
|
||||
assert data is not None, "SFP{}: unable to read EEPROM".format(port)
|
||||
|
||||
code = 0
|
||||
type = get_sfp_eeprom_type(port, data)
|
||||
if type == XCVR_EEPROM_TYPE_QSFPDD:
|
||||
for i in range(128, 222):
|
||||
code += int(data[i], 16)
|
||||
assert (code & 0xff) == int(data[222], 16), "{}: check code error".format(intf)
|
||||
elif type == XCVR_EEPROM_TYPE_QSFP:
|
||||
for i in range(128, 191):
|
||||
code += int(data[i], 16)
|
||||
assert (code & 0xff) == int(data[191], 16), "{}: check code error".format(intf)
|
||||
else:
|
||||
for i in range(0, 63):
|
||||
code += int(data[i], 16)
|
||||
assert (code & 0xff) == int(data[63], 16), "{}: check code error".format(intf)
|
||||
|
||||
def stress_sfp_i2c(sec=180):
|
||||
print("Initiating {} seconds SFP I2C stress test...".format(sec))
|
||||
timeout = time.time() + sec
|
||||
while timeout >= time.time():
|
||||
stress_sfp_i2c_one()
|
||||
sys.stdout.write("#")
|
||||
sys.stdout.flush()
|
||||
print("\nPASS")
|
||||
|
||||
if __name__ == '__main__':
|
||||
sec = 180
|
||||
if len(sys.argv) >= 2:
|
||||
sec = int(sys.argv[1])
|
||||
stress_sfp_i2c(sec)
|
12
dockers/docker-pde/supervisord.conf
Normal file
12
dockers/docker-pde/supervisord.conf
Normal file
@ -0,0 +1,12 @@
|
||||
[supervisord]
|
||||
logfile_maxbytes=1MB
|
||||
logfile_backups=2
|
||||
nodaemon=true
|
||||
|
||||
[program:rsyslogd]
|
||||
command=/bin/bash -c "rm -f /var/run/rsyslogd.pid && /usr/sbin/rsyslogd -n"
|
||||
priority=1
|
||||
autostart=true
|
||||
autorestart=false
|
||||
stdout_logfile=syslog
|
||||
stderr_logfile=syslog
|
65
dockers/docker-pde/syseeprom.py
Normal file
65
dockers/docker-pde/syseeprom.py
Normal file
@ -0,0 +1,65 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import sys
|
||||
import imp
|
||||
|
||||
PLATFORM_SPECIFIC_MODULE_NAME = "eeprom"
|
||||
PLATFORM_SPECIFIC_CLASS_NAME = "board"
|
||||
|
||||
platform_eeprom = None
|
||||
platform_eeprom_data = None
|
||||
|
||||
# Returns path to platform and hwsku
|
||||
def get_path_to_platform_and_hwsku():
|
||||
platform_path = '/usr/share/sonic/platform'
|
||||
hwsku_path = '/usr/share/sonic/hwsku'
|
||||
return (platform_path, hwsku_path)
|
||||
|
||||
# Loads platform specific psuutil module from source
|
||||
def load_platform_util(module_name, class_name):
|
||||
platform_util = None
|
||||
|
||||
# Get path to platform and hwsku
|
||||
(platform_path, hwsku_path) = get_path_to_platform_and_hwsku()
|
||||
|
||||
try:
|
||||
module_file = "/".join([platform_path, "plugins", module_name + ".py"])
|
||||
module = imp.load_source(module_name, module_file)
|
||||
except IOError, e:
|
||||
assert False, ("Failed to load platform module '%s': %s" % (module_name, str(e)))
|
||||
|
||||
try:
|
||||
platform_util_class = getattr(module, class_name)
|
||||
# board class of eeprom requires 4 paramerters, need special treatment here.
|
||||
platform_util = platform_util_class('','','','')
|
||||
except AttributeError, e:
|
||||
assert False, ("Failed to instantiate '%s' class: %s" % (class_name, str(e)))
|
||||
|
||||
return platform_util
|
||||
|
||||
def init_platform_eeprom():
|
||||
global platform_eeprom
|
||||
global platform_eeprom_data
|
||||
|
||||
if platform_eeprom is None:
|
||||
platform_eeprom = load_platform_util(PLATFORM_SPECIFIC_MODULE_NAME, \
|
||||
PLATFORM_SPECIFIC_CLASS_NAME)
|
||||
if platform_eeprom_data is None:
|
||||
platform_eeprom_data = platform_eeprom.read_eeprom()
|
||||
|
||||
return platform_eeprom_data
|
||||
|
||||
def main():
|
||||
e = init_platform_eeprom()
|
||||
c = platform_eeprom._TLV_CODE_PLATFORM_NAME
|
||||
if len(sys.argv) > 1:
|
||||
c = int(sys.argv[1], 0)
|
||||
v, t = platform_eeprom.get_tlv_field(e, c)
|
||||
if v:
|
||||
print(t[2])
|
||||
else:
|
||||
print("Unknown")
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
@ -93,6 +93,16 @@ function preStartAction()
|
||||
docker cp /tmp/dump.rdb database$DEV:/var/lib/redis/
|
||||
fi
|
||||
fi
|
||||
{%- elif docker_container_name == "pde" %}
|
||||
if [[ $(/bin/systemctl status swss | grep -c running) -gt 0 ]]; then
|
||||
echo "Stopping SWSS before starting PDE"
|
||||
systemctl stop swss
|
||||
fi
|
||||
|
||||
if [[ $(/bin/systemctl status watchdog-control.service | grep -c running) -gt 0 ]]; then
|
||||
echo "Stopping watchdog-control.service before starting PDE"
|
||||
systemctl stop watchdog-control.service
|
||||
fi
|
||||
{%- elif docker_container_name == "snmp" %}
|
||||
$SONIC_DB_CLI STATE_DB HSET 'DEVICE_METADATA|localhost' chassis_serial_number $(decode-syseeprom -s)
|
||||
{%- else %}
|
||||
|
22
files/build_templates/pde.service.j2
Normal file
22
files/build_templates/pde.service.j2
Normal file
@ -0,0 +1,22 @@
|
||||
[Unit]
|
||||
Description=PDE container
|
||||
{% if sonic_asic_platform == 'broadcom' %}
|
||||
Requires=opennsl-modules.service
|
||||
ConditionPathExists=!/usr/bin/swss.sh
|
||||
{% endif %}
|
||||
|
||||
After=updategraph.service
|
||||
{% if sonic_asic_platform == 'broadcom' %}
|
||||
After=opennsl-modules.service
|
||||
{% endif %}
|
||||
|
||||
Before=
|
||||
|
||||
[Service]
|
||||
User={{ sonicadmin_user }}
|
||||
ExecStartPre=/usr/bin/{{ docker_container_name }}.sh start
|
||||
ExecStart=/usr/bin/{{ docker_container_name }}.sh wait
|
||||
ExecStop=/usr/bin/{{ docker_container_name }}.sh stop
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
12
platform/broadcom/docker-pde.dep
Normal file
12
platform/broadcom/docker-pde.dep
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
DPATH := $($(DOCKER_PDE)_PATH)
|
||||
DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/broadcom/docker-pde.mk platform/broadcom/docker-pde.dep
|
||||
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
|
||||
DEP_FILES += $(SONIC_COMMON_DOCKER_FILES_LIST)
|
||||
DEP_FILES += $(shell git ls-files $(DPATH))
|
||||
|
||||
$(DOCKER_PDE)_CACHE_MODE := GIT_CONTENT_SHA
|
||||
$(DOCKER_PDE)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
|
||||
$(DOCKER_PDE)_DEP_FILES := $(DEP_FILES)
|
||||
|
||||
$(eval $(call add_dbg_docker,$(DOCKER_PDE),$(DOCKER_PDE_DBG)))
|
49
platform/broadcom/docker-pde.mk
Normal file
49
platform/broadcom/docker-pde.mk
Normal file
@ -0,0 +1,49 @@
|
||||
# Docker image for SONiC Platform Development Environment (PDE)
|
||||
|
||||
ifeq ($(INCLUDE_PDE), y)
|
||||
DOCKER_PDE_STEM = docker-pde
|
||||
DOCKER_PDE = $(DOCKER_PDE_STEM).gz
|
||||
DOCKER_PDE_DBG = $(DOCKER_PDE_STEM)-$(DBG_IMAGE_MARK).gz
|
||||
$(DOCKER_PDE)_PATH = $(DOCKERS_PATH)/$(DOCKER_PDE_STEM)
|
||||
$(DOCKER_PDE)_DEPENDS += $(PYTHON_NETIFACES)
|
||||
$(DOCKER_PDE)_DEPENDS += $(SONIC_PLATFORM_PDE) $(BRCM_SAI)
|
||||
|
||||
$(DOCKER_PDE_RDEPENDS += $(PYTHON_NETIFACES)
|
||||
$(DOCKER_PDE)_PYTHON_DEBS += $(SONIC_UTILS)
|
||||
$(DOCKER_PDE)_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY3)
|
||||
|
||||
ifeq ($(PDDF_SUPPORT), y)
|
||||
$(DOCKER_PDE)_PYTHON_WHEELS += $(PDDF_PLATFORM_API_BASE_PY3)
|
||||
endif
|
||||
$(DOCKER_PDE)_PYTHON_WHEELS += $(SONIC_DAEMON_BASE_PY3)
|
||||
$(DOCKER_PDE)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS)
|
||||
$(DOCKER_PDE)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES)
|
||||
$(DOCKER_PDE)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BUSTER)
|
||||
|
||||
SONIC_DOCKER_IMAGES += $(DOCKER_PDE)
|
||||
SONIC_BUSTER_DOCKERS += $(DOCKER_PDE)
|
||||
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_PDE)
|
||||
SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_PDE_DBG)
|
||||
SONIC_DOCKER_DBG_IMAGES += $(DOCKER_PDE_DBG)
|
||||
SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_PDE_DBG)
|
||||
|
||||
$(DOCKER_PDE)_CONTAINER_NAME = pde
|
||||
$(DOCKER_PDE)_RUN_OPT += --net=host --privileged -t
|
||||
$(DOCKER_PDE)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
|
||||
$(DOCKER_PDE)_RUN_OPT += -v /host/machine.conf:/host/machine.conf:ro
|
||||
$(DOCKER_PDE)_RUN_OPT += -v /usr/lib/python2.7/dist-packages:/usr/share/sonic/classes:ro
|
||||
|
||||
$(DOCKER_PDE)_RUN_OPT += -v /usr/local/lib/python3.7/dist-packages/utilities_common:/usr/local/lib/python3.7/dist-packages/utilities_common:ro
|
||||
$(DOCKER_PDE)_RUN_OPT += -v /var/log/syslog:/var/log/syslog:ro
|
||||
$(DOCKER_PDE)_RUN_OPT += -v /lib/modules:/lib/modules:ro
|
||||
$(DOCKER_PDE)_RUN_OPT += -v /boot:/boot:ro
|
||||
$(DOCKER_PDE)_RUN_OPT += -v /var/log/ramfs:/var/log/ramfs:ro
|
||||
$(DOCKER_PDE)_RUN_OPT += -v /usr/share/sonic/device/x86_64-broadcom_common:/usr/share/sonic/device/x86_64-broadcom_common:ro
|
||||
$(DOCKER_PDE)_RUN_OPT += -v /usr/share/sonic/device/pddf:/usr/share/sonic/device/pddf:ro
|
||||
|
||||
$(DOCKER_PDE)_BASE_IMAGE_FILES += pde-test:/usr/local/bin/pde-test
|
||||
$(DOCKER_PDE)_BASE_IMAGE_FILES += pde-bench:/usr/local/bin/pde-bench
|
||||
$(DOCKER_PDE)_BASE_IMAGE_FILES += pde-stress:/usr/local/bin/pde-stress
|
||||
$(DOCKER_PDE)_BASE_IMAGE_FILES += pde-bench-knet:/usr/local/bin/pde-bench-knet
|
||||
|
||||
endif
|
@ -1,2 +0,0 @@
|
||||
#DPKG FRK
|
||||
$(SONIC_ONE_PDE_IMAGE)_CACHE_MODE := none
|
@ -17,8 +17,11 @@ include $(PLATFORM_PATH)/platform-modules-brcm-xlr-gts.dep
|
||||
include $(PLATFORM_PATH)/docker-syncd-brcm.dep
|
||||
include $(PLATFORM_PATH)/docker-syncd-brcm-rpc.dep
|
||||
include $(PLATFORM_PATH)/docker-saiserver-brcm.dep
|
||||
ifeq ($(INCLUDE_PDE), y)
|
||||
include $(PLATFORM_PATH)/docker-pde.dep
|
||||
include $(PLATFORM_PATH)/sonic-pde-tests.dep
|
||||
endif
|
||||
include $(PLATFORM_PATH)/one-image.dep
|
||||
include $(PLATFORM_PATH)/one-pde-image.dep
|
||||
include $(PLATFORM_PATH)/raw-image.dep
|
||||
include $(PLATFORM_PATH)/one-aboot.dep
|
||||
include $(PLATFORM_PATH)/libsaithrift-dev.dep
|
||||
|
@ -17,6 +17,10 @@ include $(PLATFORM_PATH)/platform-modules-ragile.mk
|
||||
include $(PLATFORM_PATH)/docker-syncd-brcm.mk
|
||||
include $(PLATFORM_PATH)/docker-syncd-brcm-rpc.mk
|
||||
include $(PLATFORM_PATH)/docker-saiserver-brcm.mk
|
||||
ifeq ($(INCLUDE_PDE), y)
|
||||
include $(PLATFORM_PATH)/docker-pde.mk
|
||||
include $(PLATFORM_PATH)/sonic-pde-tests.mk
|
||||
endif
|
||||
include $(PLATFORM_PATH)/one-image.mk
|
||||
include $(PLATFORM_PATH)/raw-image.mk
|
||||
include $(PLATFORM_PATH)/one-aboot.mk
|
||||
|
10
platform/broadcom/sonic-pde-tests.dep
Normal file
10
platform/broadcom/sonic-pde-tests.dep
Normal file
@ -0,0 +1,10 @@
|
||||
SPATH := $($(SONIC_PLATFORM_PDE)_SRC_PATH)
|
||||
DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/broadcom/sonic-pde-tests.mk platform/broadcom/sonic-pde-tests.dep
|
||||
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
|
||||
SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files))
|
||||
|
||||
$(SONIC_PLATFORM_PDE)_CACHE_MODE := GIT_CONTENT_SHA
|
||||
$(SONIC_PLATFORM_PDE)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
|
||||
$(SONIC_PLATFORM_PDE)_DEP_FILES := $(DEP_FILES)
|
||||
$(SONIC_PLATFORM_PDE)_SMDEP_FILES := $(SMDEP_FILES)
|
||||
$(SONIC_PLATFORM_PDE)_SMDEP_PATHS := $(SPATH)
|
7
platform/broadcom/sonic-pde-tests.mk
Normal file
7
platform/broadcom/sonic-pde-tests.mk
Normal file
@ -0,0 +1,7 @@
|
||||
# sonic pde package
|
||||
|
||||
SONIC_PLATFORM_PDE = sonic-platform-pde_1.0_amd64.deb
|
||||
$(SONIC_PLATFORM_PDE)_SRC_PATH = $(SRC_PATH)/sonic-platform-pde
|
||||
$(SONIC_PLATFORM_PDE)_DEPENDS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(SWIG)
|
||||
|
||||
SONIC_DPKG_DEBS += $(SONIC_PLATFORM_PDE)
|
@ -51,6 +51,8 @@ DEFAULT_PASSWORD = YourPaSsWoRd
|
||||
# ENABLE_ZTP - installs Zero Touch Provisioning support.
|
||||
# ENABLE_ZTP = y
|
||||
|
||||
# INCLUDE_PDE - Enable platform development enviroment
|
||||
# INCLUDE_PDE = y
|
||||
# SHUTDOWN_BGP_ON_START - if set to y all bgp sessions will be in admin down state when
|
||||
# bgp service starts.
|
||||
# SHUTDOWN_BGP_ON_START = y
|
||||
|
2
slave.mk
2
slave.mk
@ -249,6 +249,7 @@ $(info "HTTP_PROXY" : "$(HTTP_PROXY)")
|
||||
$(info "HTTPS_PROXY" : "$(HTTPS_PROXY)")
|
||||
$(info "NO_PROXY" : "$(NO_PROXY)")
|
||||
$(info "ENABLE_ZTP" : "$(ENABLE_ZTP)")
|
||||
$(info "INCLUDE_PDE" : "$(INCLUDE_PDE)")
|
||||
$(info "SONIC_DEBUGGING_ON" : "$(SONIC_DEBUGGING_ON)")
|
||||
$(info "SONIC_PROFILING_ON" : "$(SONIC_PROFILING_ON)")
|
||||
$(info "KERNEL_PROCURE_METHOD" : "$(KERNEL_PROCURE_METHOD)")
|
||||
@ -938,6 +939,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
|
||||
export include_mgmt_framework="$(INCLUDE_MGMT_FRAMEWORK)"
|
||||
export include_iccpd="$(INCLUDE_ICCPD)"
|
||||
export pddf_support="$(PDDF_SUPPORT)"
|
||||
export include_pde="$(INCLUDE_PDE)"
|
||||
export shutdown_bgp_on_start="$(SHUTDOWN_BGP_ON_START)"
|
||||
export default_buffer_model="$(SONIC_BUFFER_MODEL)"
|
||||
export include_kubernetes="$(INCLUDE_KUBERNETES)"
|
||||
|
1
src/sonic-platform-pde
Submodule
1
src/sonic-platform-pde
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit f18ebc297d8b751c162dffd120d284d784aa977d
|
Loading…
Reference in New Issue
Block a user