diff options
-rw-r--r-- | conf/03_traffic.conf | 2 | ||||
-rw-r--r-- | conf/10_custom.conf | 2 | ||||
-rw-r--r-- | docs/testing/user/configguide/trafficgen.rst | 11 | ||||
-rw-r--r-- | tools/pkt_gen/trex/trex.py | 43 |
4 files changed, 50 insertions, 8 deletions
diff --git a/conf/03_traffic.conf b/conf/03_traffic.conf index 419ca704..b5533833 100644 --- a/conf/03_traffic.conf +++ b/conf/03_traffic.conf @@ -441,7 +441,7 @@ TRAFFICGEN_TREX_LATENCY_PPS = 1000 # Example 10 Gbps: TRAFFICGEN_TREXINE_SPEED_GBPS = '10' # Today only 10 Gbps is supported TRAFFICGEN_TREX_LINE_SPEED_GBPS = '10' -# FOR SR-IOV tests to work with T-Rex enable Promiscuous mode +# FOR SR-IOV or multistream layer 2 tests to work with T-Rex enable Promiscuous mode TRAFFICGEN_TREX_PROMISCUOUS=False PATHS['trafficgen'] = { 'trex': { diff --git a/conf/10_custom.conf b/conf/10_custom.conf index 9dc605e0..8020bb93 100644 --- a/conf/10_custom.conf +++ b/conf/10_custom.conf @@ -136,7 +136,7 @@ TRAFFICGEN_TREX_LATENCY_PPS = 1000 # Example 10 Gbps: TRAFFICGEN_TREXINE_SPEED_GBPS = '10' # Today only 10 Gbps is supported TRAFFICGEN_TREX_LINE_SPEED_GBPS = '10' -# FOR SR-IOV tests to work with T-Rex enable Promiscuous mode +# FOR SR-IOV or multistream layer 2 tests to work with T-Rex enable Promiscuous mode TRAFFICGEN_TREX_PROMISCUOUS=False # TREX Configuration and Connection Info-- END diff --git a/docs/testing/user/configguide/trafficgen.rst b/docs/testing/user/configguide/trafficgen.rst index 2d2b9a9e..7caa501e 100644 --- a/docs/testing/user/configguide/trafficgen.rst +++ b/docs/testing/user/configguide/trafficgen.rst @@ -811,7 +811,7 @@ Example of this configuration is in conf/03_traffic.conf or conf/10_custom.conf. TRAFFICGEN_TREX_USER has to have sudo permission and passwordless access. TRAFFICGEN_TREX_BASE_DIR is the place, where is stored 't-rex-64' file. -It is possible to specify the accurancy of RFC2544 Throughput measurement. +It is possible to specify the accuracy of RFC2544 Throughput measurement. Threshold below defines maximal difference between frame rate of successful (i.e. defined frameloss was reached) and unsuccessful (i.e. frameloss was exceeded) iterations. @@ -822,14 +822,17 @@ Default value of this parameter is defined in conf/03_traffic.conf as follows: TRAFFICGEN_TREX_RFC2544_TPUT_THRESHOLD = '' -SR-IOV -~~~~~~ +SR-IOV and Multistream layer 2 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ T-Rex by default only accepts packets on the receive side if the destination mac matches the -MAC address specificed in the /etc/trex-cfg.yaml on the server side. For SR-IOV this creates +MAC address specified in the /etc/trex-cfg.yaml on the server side. For SR-IOV this creates challenges with modifying the MAC address in the traffic profile to correctly flow packets through specified VFs. To remove this limitation enable promiscuous mode on T-Rex to allow all packets regardless of the destination mac to be accepted. +This also creates problems when doing multistream at layer 2 since the source macs will be +modified. Enable Promiscuous mode when doing multistream at layer 2 testing with T-Rex. + .. code-block:: console TRAFFICGEN_TREX_PROMISCUOUS=True diff --git a/tools/pkt_gen/trex/trex.py b/tools/pkt_gen/trex/trex.py index 7b554ecb..abae35dc 100644 --- a/tools/pkt_gen/trex/trex.py +++ b/tools/pkt_gen/trex/trex.py @@ -21,6 +21,7 @@ import subprocess import sys from collections import OrderedDict # pylint: disable=unused-import +import netaddr import zmq from conf import settings from conf import merge_spec @@ -174,8 +175,46 @@ class Trex(ITrafficGenerator): fsize_no_fcs = frame_size - 4 payload_a = max(0, fsize_no_fcs - len(base_pkt_a)) * 'x' payload_b = max(0, fsize_no_fcs - len(base_pkt_b)) * 'x' - pkt_a = STLPktBuilder(pkt=base_pkt_a/payload_a) - pkt_b = STLPktBuilder(pkt=base_pkt_b/payload_b) + + # Multistream configuration, increments source values only + ms_mod = list() # mod list for incrementing values to be populated based on layer + if traffic['multistream'] > 1: + if traffic['stream_type'].upper() == 'L2': + for _ in [base_pkt_a, base_pkt_b]: + ms_mod += [STLVmFlowVar(name="mac_start", min_value=0, + max_value=traffic['multistream'] - 1, size=4, op="inc"), + STLVmWrFlowVar(fv_name="mac_start", pkt_offset=7)] + elif traffic['stream_type'].upper() == 'L3': + ip_src = {"start": int(netaddr.IPAddress(traffic['l3']['srcip'])), + "end": int(netaddr.IPAddress(traffic['l3']['srcip'])) + traffic['multistream'] - 1} + ip_dst = {"start": int(netaddr.IPAddress(traffic['l3']['dstip'])), + "end": int(netaddr.IPAddress(traffic['l3']['dstip'])) + traffic['multistream'] - 1} + for ip_address in [ip_src, ip_dst]: + ms_mod += [STLVmFlowVar(name="ip_src", min_value=ip_address['start'], + max_value=ip_address['end'], size=4, op="inc"), + STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP.src")] + elif traffic['stream_type'].upper() == 'L4': + for udpport in [traffic['l4']['srcport'], traffic['l4']['dstport']]: + if udpport + (traffic['multistream'] - 1) > 65535: + start_port = udpport + # find the max/min port number based on the loop around of 65535 to 0 if needed + minimum_value = 65535 - (traffic['multistream'] -1) + maximum_value = 65535 + else: + start_port, minimum_value = udpport, udpport + maximum_value = start_port + (traffic['multistream'] - 1) + ms_mod += [STLVmFlowVar(name="port_src", init_value=start_port, + min_value=minimum_value, max_value=maximum_value, + size=2, op="inc"), + STLVmWrFlowVar(fv_name="port_src", pkt_offset="UDP.sport"),] + + if ms_mod: # multistream detected + pkt_a = STLPktBuilder(pkt=base_pkt_a/payload_a, vm=[ms_mod[0], ms_mod[1]]) + pkt_b = STLPktBuilder(pkt=base_pkt_b/payload_b, vm=[ms_mod[2], ms_mod[3]]) + else: + pkt_a = STLPktBuilder(pkt=base_pkt_a / payload_a) + pkt_b = STLPktBuilder(pkt=base_pkt_b / payload_b) + stream_1 = STLStream(packet=pkt_a, name='stream_1', mode=STLTXCont(percentage=traffic['frame_rate'])) |