test/automated-pytest-suite/utils/guest_scripts/dpdk_pktgen.sh
Yang Liu 33756ac899 Initial submission for starlingx pytest framework.
Include:
- util modules. such as table_parser, ssh/localhost clients, cli module,
exception, logger, etc. Util modules are mostly used by keywords.
- keywords modules. These are helper functions that are used directly by
test functions.
- platform (with platform or platform_sanity marker) and stx-openstack
(with sanity, sx_sanity, cpe_sanity, or storage_sanity marker) sanity
testcases
- pytest config conftest, and test fixture modules
- test config file template/example

Required packages:
- python3.4 or python3.5
- pytest >=3.10,<4.0
- pexpect
- requests
- pyyaml
- selenium (firefox, ffmpeg, pyvirtualdisplay, Xvfb or Xephyr or Xvnc)

Limitations:
- Anything that requires copying from Test File Server will not work until
a public share is configured to shared test files. Tests skipped for now.

Co-Authored-By: Maria Yousaf <maria.yousaf@windriver.com>
Co-Authored-By: Marvin Huang <marvin.huang@windriver.com>
Co-Authored-By: Yosief Gebremariam <yosief.gebremariam@windriver.com>
Co-Authored-By: Paul Warner <paul.warner@windriver.com>
Co-Authored-By: Xueguang Ma <Xueguang.Ma@windriver.com>
Co-Authored-By: Charles Chen <charles.chen@windriver.com>
Co-Authored-By: Daniel Graziano <Daniel.Graziano@windriver.com>
Co-Authored-By: Jordan Li <jordan.li@windriver.com>
Co-Authored-By: Nimalini Rasa <nimalini.rasa@windriver.com>
Co-Authored-By: Senthil Mukundakumar <senthil.mukundakumar@windriver.com>
Co-Authored-By: Anuejyan Manokeran <anujeyan.manokeran@windriver.com>
Co-Authored-By: Peng Peng <peng.peng@windriver.com>
Co-Authored-By: Chris Winnicki <chris.winnicki@windriver.com>
Co-Authored-By: Joe Vimar <Joe.Vimar@windriver.com>
Co-Authored-By: Alex Kozyrev <alex.kozyrev@windriver.com>
Co-Authored-By: Jack Ding <jack.ding@windriver.com>
Co-Authored-By: Ming Lei <ming.lei@windriver.com>
Co-Authored-By: Ankit Jain <ankit.jain@windriver.com>
Co-Authored-By: Eric Barrett <eric.barrett@windriver.com>
Co-Authored-By: William Jia <william.jia@windriver.com>
Co-Authored-By: Joseph Richard <Joseph.Richard@windriver.com>
Co-Authored-By: Aldo Mcfarlane <aldo.mcfarlane@windriver.com>

Story: 2005892
Task: 33750
Signed-off-by: Yang Liu <yang.liu@windriver.com>

Change-Id: I7a88a47e09733d39f024144530f5abb9aee8cad2
2019-07-15 15:30:00 -04:00

50 lines
1.5 KiB
Bash

#!/bin/bash
# the original version from /usr/local/bin/launch_pktgen.sh
# written by Allain Legacy
sleep 60
PKTGEN=${PKTGEN:-/usr/local/bin/pktgen}
HUGETLBMNT=${HUGETLBMNT:-/dev/hugepages}
# Assumes 3 nic guest, with first nic virtio
# using only the first nic
DEVICES=("0000:00:04.0")
## Automatically unbind/rebind PCI devices
modprobe igb_uio
USEDEVICES=""
for DEVICE in ${DEVICES[@]}; do
UIO_DRIVER=/sys/bus/pci/drivers/igb_uio
SYSFS=/sys/bus/pci/devices/${DEVICE}
if [ ! -d ${SYSFS} ]; then
echo "Unable to find device directory: ${SYSFS}"
exit 1
fi
# Add the device to the list of supported devices of the UIO driver
UEVENT=${SYSFS}/uevent
PCI_ID=($(cat ${UEVENT} | grep PCI_ID | sed -e 's/^.*=//' | tr ":" " "))
echo "${PCI_ID[0]} ${PCI_ID[1]}" > ${UIO_DRIVER}/new_id
# Unbind from the old driver and bind to the new driver
echo -n ${DEVICE} > ${SYSFS}/driver/unbind
echo -n ${DEVICE} > ${UIO_DRIVER}/bind
USEDEVICES+=" --pci-whitelist ${DEVICE}"
done
# cpu mask cannot be set for lcores not exist on the system
# 2vcpus setup
# ${PKTGEN} -c 0x3 -n 1 --huge-dir ${HUGETLBMNT} --proc-type primary
# --socket-mem 512 ${USEDEVICES} --file-prefix pg -- -p 0xFFFF -P -N
# -m "[1:1].0" -f /root/dpdk_pktgen.config
# 3vcpus setup
${PKTGEN} -c 0x7 -n 2 --huge-dir ${HUGETLBMNT} --proc-type primary \
--socket-mem 512 ${USEDEVICES} --file-prefix pg -- -p 0xFFFF -P -N \
-m "[1:1-2].0" -f /root/dpdk_pktgen.config
exit $?