Repo with Cisco T-rex traffic profiles.
- Download and untar T-rex to /opt/trex directory:
wget --no-check-certificate --no-cache https://trex-tgn.cisco.com/trex/release/v3.02.tar.gz
sudo mkdir /opt/trex
sudo tar xvf v3.02.tar.gz -C /opt/trex --strip-components 1
- Configure Cisco T-rex interfaces:
cd /opt/trex && sudo ./dpdk_setup_ports.py -i
- /etc/trex_cfg.yaml will be created.
Example:
### Config file generated by dpdk_setup_ports.py ###
- version: 2
interfaces: ['17:00.0', '17:00.1']
c: 16
port_info:
- dest_mac: b4:96:91:f6:51:95 # MAC OF LOOPBACK TO IT'S DUAL INTERFACE
src_mac: b4:96:91:f6:51:94
- dest_mac: b4:96:91:f6:51:94 # MAC OF LOOPBACK TO IT'S DUAL INTERFACE
src_mac: b4:96:91:f6:51:95
platform:
master_thread_id: 1
latency_thread_id: 24
dual_if:
- socket: 0
threads: [2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]
I. Run test using Trex as a service and trex wrapper script
The benefit of that you don't need to start Trex server each time when you need to generate workload. Also you'll have more flexibility by assertions, test result analysis, monitoring and attacks sending.
- Create systemd unit for trex:
[Unit]
Description=TREX Service
[Service]
StandardOutput=journal
StandardError=journal
WorkingDirectory=/opt/trex
ExecStart=/opt/trex/t-rex-64 -i --astf --tso-disable --lro-disable --iom 0
[Install]
WantedBy=multi-user.target
systemctl daemon-reload && systemctl start trex
- Start test. Example for udp_max_pps.py profile with 1400B packet size:
cd ~/trex-perf
./trex_run.py -m 100 -d 60 -f trex_profiles/udp_max_pps.py -t size=1400
-m: multiplier for traffic profile
-d: test duration in seconds
- Run test with attacks (will be sent in a sequence):
./trex_run.py -m 100 -d 60 -a <pcaps_with_attacks_repo> -f trex_profiles/http_max_tp.py
- Available options for trex_run.py:
./trex_run.py -h
usage: trex_run.py [-h] [-s SERVER] [-m MULT] [-f FILE] [-d DURATION]
[-a ATTACKS_PATH] [--drp DRP]
[-t [TUNABLES [TUNABLES ...]]] [--send_stats SEND_STATS]
[--influx_addr INFLUX_ADDR] [--influx_port INFLUX_PORT]
[--influx_admin INFLUX_ADMIN]
[--influx_passwd INFLUX_PASSWD] [--influx_db INFLUX_DB]
[--influx_interval INFLUX_INTERVAL] [--test_id TEST_ID]
[--grafana_url GRAFANA_URL] [--dashboard_uid DASHBOARD_UID]
[--dashboard_name DASHBOARD_NAME]
TRex ASTF mode
optional arguments:
-h, --help show this help message and exit
-s SERVER remote TRex address (default: 127.0.0.1)
-m MULT multiplier of main traffic (default: 1)
-f FILE profile path for sending main traffic (default: None)
-d DURATION duration of traffic, sec (default: 10)
-a ATTACKS_PATH attack pcaps absolute path directory for sending
attacks (default: None)
--drp DRP Allowed main traffic drop rate, % (default: 1)
-t [TUNABLES [TUNABLES ...]]
tunables for main profile: key1=value1 key2=value2...
(default: None)
--send_stats SEND_STATS
Send stats to InfluxDB (default: True)
--influx_addr INFLUX_ADDR
InfluxDB address (default: 127.0.0.1)
--influx_port INFLUX_PORT
InfluxDB port (default: 8086)
--influx_admin INFLUX_ADMIN
InfluxDB admin user (default: admin)
--influx_passwd INFLUX_PASSWD
InfluxDB admin password (default: admin)
--influx_db INFLUX_DB
Influx DB name (default: trex)
--influx_interval INFLUX_INTERVAL
Influx send interval, sec (default: 1)
--test_id TEST_ID Test ID (default: None)
--grafana_url GRAFANA_URL
Grafana URL (default: http://127.0.0.1:3000)
--dashboard_uid DASHBOARD_UID
Dashboard UID (default: cisco-trex)
--dashboard_name DASHBOARD_NAME
Dashboard name (default: cisco-trex)
II. Run test in batch mode
- Example for udp_max_pps.py profile with 1400B frame size:
-m: multiplier for traffic profile
cd /opt/trex && sudo ./t-rex-64 --astf -f ~/trex-perf/trex_profiles/udp_max_pps.py -m 10000 -d 300 --tso-disable --lro-disable -t size=1400
-d: test duration in seconds