cae65ab1c86c652b1cd6c152df0f4fc1de09cbc5
[csit.git] / docs / report / introduction / methodology_trex_traffic_generator.rst
1 TRex Traffic Generator
2 ----------------------
3
4 Usage
5 ~~~~~
6
7 `TRex traffic generator <https://trex-tgn.cisco.com>`_ is used for majority of
8 CSIT performance tests. TRex stateless mode is used to measure NDR and PDR
9 throughputs using MLRsearch and to measure maximum transfer rate in MRR tests.
10
11 TRex is installed and run on the TG compute node. The typical procedure is:
12
13 - TRex configuration is set in its configuration file
14   ::
15
16   $ sudo -E -S sh -c 'cat << EOF > /etc/trex_cfg.yaml
17   - version: 2
18     c: 15
19     limit_memory: 8192
20     interfaces: ["${pci1}","${pci2}"]
21     port_info:
22       - dest_mac: [${dest_mac1}]
23         src_mac: [${src_mac1}]
24       - dest_mac: [${dest_mac2}]
25         src_mac: [${src_mac2}]
26     platform :
27       master_thread_id: 0
28       latency_thread_id: 16
29       dual_if:
30           - socket: 0
31             threads: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
32   EOF'
33
34 - TRex is started in the interactive mode as a background service
35   ::
36
37   $ sh -c 'cd <t-rex-install-dir>/scripts/ && \
38     sudo nohup ./t-rex-64 -i --prefix $(hostname) --hdrh --no-scapy-server \
39     > /tmp/trex.log 2>&1 &' > /dev/null
40
41 - There are traffic streams dynamically prepared for each test, based on traffic
42   profiles. The traffic is sent and the statistics obtained using API
43   :command:`trex.stl.api.STLClient`.
44
45 Measuring Packet Loss
46 ~~~~~~~~~~~~~~~~~~~~~
47
48 Following sequence is followed to measure packet loss:
49
50 - Create an instance of STLClient.
51 - Connect to the client.
52 - Add all streams.
53 - Clear statistics.
54 - Send the traffic for defined time.
55 - Get the statistics.
56
57 If there is a warm-up phase required, the traffic is sent also before
58 test and the statistics are ignored.
59
60 Measuring Latency
61 ~~~~~~~~~~~~~~~~~
62
63 If measurement of latency is requested, two more packet streams are
64 created (one for each direction) with TRex flow_stats parameter set to
65 STLFlowLatencyStats. In that case, returned statistics will also include
66 min/avg/max latency values and encoded HDRHistogram data.