Download, install and configure TRex with Napatech support.
Before you begin
About this task
The procedure describes commands to download, install and configure TRex with Napatech support.
Procedure
-
Download the TRex package from https://github.com/cisco-system-traffic-generator/trex-core/releases or clone
from https://github.com/cisco-system-traffic-generator/trex-core.git.
wget https://github.com/cisco-system-traffic-generator/trex-core/archive/v2.71.tar.gz tar xzvf v2.71.tar.gz cd trex-core-2.71/
Orgit clone https://github.com/cisco-system-traffic-generator/trex-core.git
-
Build TRex with Napatech support.
cd linux_dpdk ./b configure --with-ntacc ./b
An output example:./b configure --with-ntacc Setting top to : /root/packages/trex/trex-core-2.71 Setting out to : /root/packages/trex/trex-core-2.71/linux_dpdk/build_dpdk Checking for program 'g++, c++' : /usr/lib64/ccache/g++ Checking for program 'ar' : /usr/bin/ar Checking if the -o link must be split from arguments : yes Checking for program 'gcc, cc' : /usr/lib64/ccache/gcc Checking for program 'ar' : /usr/bin/ar Checking if the -o link must be split from arguments : yes Checking for program 'ldd' : /usr/bin/ldd Checking for library z : yes Build sanitized images (GCC >= 4.9.0) : no Checking for OFED : not found Checking for library mnl : not found, will use internal version Warning: will use internal version of ibverbs. If you need to use Mellanox NICs, install OFED: https://trex-tgn.cisco.com/trex/doc/trex_manual.html#_mellanox_connectx_4_support Checking for NTAPI : Found needed NTAPI library 'configure' finished successfully (1.229s)
./b Waf: Entering directory `/root/packages/trex/trex-core-2.71/linux_dpdk/build_dpdk' Info: Using internal libverbs. Info: Using internal libmnl. update version files ... [1626/1628] Compiling ../src/main_dpdk.cpp [1627/1628] Compiling ../src/44bsd/udp.cpp [1628/1628] Linking build_dpdk/linux_dpdk/_t-rex-64-o Waf: Leaving directory `/root/packages/trex/trex-core-2.71/linux_dpdk/build_dpdk' *** generating softlinks *** ... Build commands will be stored in build_dpdk/compile_commands.json 'build' finished successfully (1m22.873s)
-
Create a TRex configuration file. The provided script in the package can be used to
automatically generate the basic configuration file or you can manually create the
configuration file.
The following command example shows running the script in interactive mode.
cd ../scripts ./dpdk_setup_ports.py -i
An output example:./dpdk_setup_ports.py -i By default, IP based configuration file will be created. Do you want to use MAC based config? (y/N)
-
Enter y to use the MAC based configuration.
An output example:
By default, IP based configuration file will be created. Do you want to use MAC based config? (y/N)y +-----+------+-----------+-------------------+-------------------------------------------+--------+----------+----------+ | ID | NUMA | PCI | MAC | Name | Driver | Linux IF | Active | +=====+======+===========+===================+===========================================+========+==========+==========+ ... +-----+------+-----------+-------------------+-------------------------------------------+--------+----------+----------+ | 4/0 | 0 | 03:00.0/0 | 00:0d:e9:07:9d:17 | NT200A02 Network Adapter | nt3gd | | | +-----+------+-----------+-------------------+-------------------------------------------+--------+----------+----------+ | 4/1 | 0 | 03:00.0/1 | 00:0d:e9:07:9d:18 | NT200A02 Network Adapter | nt3gd | | | +-----+------+-----------+-------------------+-------------------------------------------+--------+----------+----------+ Please choose even number of interfaces from the list above, either by ID , PCI or Linux IF Stateful will use order of interfaces: Client1 Server1 Client2 Server2 etc. for flows. Stateless can be in any order. Enter list of interfaces separated by space (for example: 1 3) :
-
Enter the Napatech interfaces, 4/0 and 4/1 in this example.
An output example:
Enter list of interfaces separated by space (for example: 1 3) : 4/0 4/1 For interface 4, assuming loopback to it's dual interface 4. Destination MAC is 00:0d:e9:07:9d:18. Change it to MAC of DUT? (y/N).
-
Enter N to test transmitting and receiving packets between port 0 and
port 1 of the SmartNIC.
An output example:
For interface 4, assuming loopback to it's dual interface 4. Destination MAC is 00:0d:e9:07:9d:18. Change it to MAC of DUT? (y/N).N For interface 4, assuming loopback to it's dual interface 4. Destination MAC is 00:0d:e9:07:9d:17. Change it to MAC of DUT? (y/N).N Print preview of generated config? (Y/n)
-
Enter Y to preview the configuration.
An output example:
Print preview of generated config? (Y/n)Y ### Config file generated by dpdk_setup_ports.py ### - version: 2 interfaces: ['03:00.0/0', '03:00.0/1'] port_info: - dest_mac: 00:0d:e9:07:9d:18 # MAC OF LOOPBACK TO IT'S DUAL INTERFACE src_mac: 00:0d:e9:07:9d:17 - dest_mac: 00:0d:e9:07:9d:17 # MAC OF LOOPBACK TO IT'S DUAL INTERFACE src_mac: 00:0d:e9:07:9d:18 platform: master_thread_id: 0 latency_thread_id: 38 dual_if: - socket: 0 threads: [2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36] Save the config to file? (Y/n)
Note: The Napatech SmartNIC interfaces use <PCI device ID>/<Port Number>. 03:00.0/0 and 03:00.0/1 are detected in this example. -
Enter Y to save the configuration.
An output example:
Save the config to file? (Y/n)Y Default filename is /etc/trex_cfg.yaml Press ENTER to confirm or enter new file: File /etc/trex_cfg.yaml already exist, overwrite? (y/N)y Saved to /etc/trex_cfg.yaml.