TRex - Introduction

How to configure, deploy, and test the open source TRex on Catalyst 9000

Know about TRex and learn how to configure, deploy, and test the TRex traffic generator on Catalyst 9000.

TRex is an open source, low cost, stateful and stateless traffic generator tool. It is designed to benchmark platforms using realistic traffic. In this sample example, we will deploy TRex as Docker application on Catalyst 9000 and generate multi stream traffic on container ports. The configuration in example below is to demonstrate the looping traffic in container.

Refer to https://trex-tgn.cisco.com for application details and download.

Following sections explains how to configure, deploy and test TRex traffic generator on Catalyst 9000.

Configuration

The interface AppGigabitEthernet is configured in trunk mode, with allowed vlan 500. 700.

Inside the application container, eth0 is configured on vlan 700 and eth1 is configured vlan 500. On Catalyst 9000 connect GigabitEthernet 23 and GigabitEthernet 24 with loopback cable, and configure those interfaces in vlan 500 and vlan 700 respectively, as shown below:

interface AppGigabitEthernet1/0/1
 switchport trunk allowed vlan 500,700
 switchport mode trunk

interface GigabitEthernet1/0/23
 switchport access vlan 700
!
interface GigabitEthernet1/0/24
 switchport access vlan 500

IP address for App container is configured as static IP address. The runtime parameter required for docker container is configured under app-resource in run-opts.

app-hosting appid trex
 app-vnic AppGigabitEthernet trunk
  vlan 500 guest-interface 1
   guest-ipaddress 10.0.1.2 netmask 255.255.255.0
  vlan 700 guest-interface 0
   guest-ipaddress 10.0.0.2 netmask 255.255.255.0
 app-default-gateway 10.0.1.1 guest-interface 1
 app-resource docker
  run-opts 1 "--cap-add=NET_ADMIN --ulimit memlock=100000000:100000000 --entrypoint '/bin/sleep 10000'"

TRex application needs the configuration in yaml format. This file is to be copied to usbflash in Catalyst 9000:

trex_cfg.yaml
port_limit    : 2
  version       : 2
  low_end       : true
  interfaces    : ["eth0", "eth1"]
  port_info     :  # set eh mac addr
            - ip         : 10.0.0.2
              default_gw : 10.0.1.2
            - ip         : 10.0.1.2
              default_gw : 10.0.0.2

Deployment

a. Copy the downloaded docker tar to usbflash1

b. Install app from USBFlash1

app-hosting install appid trex package usbflash1:<path to tar file>

c. Activate the application with pre-configured resources

app-hosting activate appid trex

d. Upload the TRex Configuration yaml file to container

app-hosting data appid trex copy usbflash1:trex_cfg.yaml trex_cfg.yaml

e. Start the app

app-hosting start appid iperf

Testing

a. Connect to container and start TRex server

app-hosting connect appid trex session

trex_shell$ ./t-rex-64 -i --cfg /iox_data/appdata/trex_cfg.yaml

b. Connect to container again from different terminal and generate traffic

app-hosting connect appid trex session

trex_shell$ ./trex-console

// start 500Mbps multi stream UDP traffic
trex_console> start -f stl/udp_1pkt_multi.py -m 500mbps -a

//view stats
trex_console> stats