summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-02-24 14:07:11 -0500
committerYaroslav Brustinov <ybrustin@cisco.com>2016-02-24 14:07:11 -0500
commit42afa885616f4def18f5f1f1ca303efdf742356f (patch)
tree187412cbca140ee5763172330e88b386705b3454
parent547112ad112a2c3f8792a41e3f41b9d257a2fa7a (diff)
hltapi : add dst_mac vm; vlan mask variable now can be shared; add 2 more profiles; add consistent_random argument for same random sequence each time
-rwxr-xr-xscripts/automation/regression/unit_tests/functional_tests/hltapi_stream_builder_test.py32
-rw-r--r--scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py2
-rwxr-xr-xscripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_hltapi.py93
-rw-r--r--scripts/exp/hlt_david4.pcapbin1624 -> 1624 bytes
-rw-r--r--scripts/exp/hlt_udp_ports.pcapbin0 -> 1624 bytes
-rw-r--r--scripts/exp/hlt_udp_random_ports.pcapbin0 -> 1624 bytes
-rwxr-xr-xscripts/stl/hlt/hlt_david1.py4
-rwxr-xr-xscripts/stl/hlt/hlt_david2.py4
-rwxr-xr-xscripts/stl/hlt/hlt_david3.py4
-rwxr-xr-xscripts/stl/hlt/hlt_david4.py11
-rwxr-xr-xscripts/stl/hlt/hlt_imix_4rates.py4
-rwxr-xr-xscripts/stl/hlt/hlt_tcp_ranges.py3
-rwxr-xr-xscripts/stl/hlt/hlt_udp_inc_dec_len_9k.py10
-rwxr-xr-xscripts/stl/hlt/hlt_udp_ports.py33
-rwxr-xr-xscripts/stl/hlt/hlt_udp_random_ports.py28
15 files changed, 180 insertions, 48 deletions
diff --git a/scripts/automation/regression/unit_tests/functional_tests/hltapi_stream_builder_test.py b/scripts/automation/regression/unit_tests/functional_tests/hltapi_stream_builder_test.py
index 54daa12f..7b501d97 100755
--- a/scripts/automation/regression/unit_tests/functional_tests/hltapi_stream_builder_test.py
+++ b/scripts/automation/regression/unit_tests/functional_tests/hltapi_stream_builder_test.py
@@ -475,34 +475,34 @@ TBD
self_start: true
vm:
instructions:
- - init_value: 1
- max_value: 7
- min_value: 1
- name: vlan_id0
+ - init_value: 0
+ max_value: 6
+ min_value: 0
+ name: dec_2_3_2
op: inc
size: 2
step: 2
type: flow_var
- - add_value: 0
+ - add_value: 1
is_big_endian: true
mask: 4095
- name: vlan_id0
+ name: dec_2_3_2
pkt_cast_size: 2
pkt_offset: 14
shift: 0
type: write_mask_flow_var
- - init_value: 1000
- max_value: 1000
- min_value: 991
- name: vlan_id2
+ - init_value: 9
+ max_value: 9
+ min_value: 0
+ name: dec_2_9_1
op: dec
size: 2
step: 1
type: flow_var
- - add_value: 0
+ - add_value: 991
is_big_endian: true
mask: 4095
- name: vlan_id2
+ name: dec_2_9_1
pkt_cast_size: 2
pkt_offset: 22
shift: 0
@@ -510,7 +510,7 @@ TBD
- init_value: 0
max_value: 65535
min_value: 0
- name: vlan_id3
+ name: vlan_id_random
op: random
size: 2
step: 1
@@ -518,12 +518,12 @@ TBD
- add_value: 0
is_big_endian: true
mask: 4095
- name: vlan_id3
+ name: vlan_id_random
pkt_cast_size: 2
pkt_offset: 26
shift: 0
type: write_mask_flow_var
- split_by_var: vlan_id2
+ split_by_var: dec_2_9_1
'''
@@ -621,7 +621,7 @@ TBD
def yaml_save_location(self):
- return os.devnull
+ #return os.devnull
# debug/deveopment, comment line above
return '/tmp/%s.yaml' % self._testMethodName
diff --git a/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py b/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py
index 22a63ddd..5ae890ba 100644
--- a/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py
+++ b/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py
@@ -207,6 +207,8 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test):
['hlt/hlt_david3.py', '-m 1 -l 20', True],
['hlt/hlt_david4.py', '-m 1 -l 20', True],
['hlt/hlt_tcp_ranges.py', '-m 1 -l 20', True],
+ ['hlt/hlt_udp_ports.py', '-m 1 -l 20', True],
+ ['hlt/hlt_udp_random_ports.py', '-m 1 -l 20', True],
)
for obj in p:
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_hltapi.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_hltapi.py
index 593c4c47..2e5d141f 100755
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_hltapi.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_hltapi.py
@@ -3,7 +3,7 @@
'''
Supported functions/arguments/defaults:
'''
-# connect()
+
connect_kwargs = {
'device': 'localhost', # ip or hostname of TRex
'port_list': None, # list of ports
@@ -12,17 +12,16 @@ connect_kwargs = {
'break_locks': False,
}
-# cleanup_session()
cleanup_session_kwargs = {
'maintain_lock': False, # release ports at the end or not
'port_list': None,
'port_handle': None,
}
-# traffic_config()
traffic_config_kwargs = {
'mode': None, # ( create | modify | remove | reset )
'split_by_cores': 'split', # ( split | duplicate | single ) TRex extention: split = split traffic by cores, duplicate = duplicate traffic for all cores, single = run only with sinle core (not implemented yet)
+ 'consistent_random': False, # TRex extention: False (default): random sequence will be different every run, True: random sequence will be same every run
'port_handle': None,
'port_handle2': None,
# stream builder parameters
@@ -37,7 +36,7 @@ traffic_config_kwargs = {
'pkts_per_burst': 1,
'burst_loop_count': 1,
'inter_burst_gap': 12,
- 'length_mode': 'fixed', # ( auto | fixed | increment | decrement | random | imix )
+ 'length_mode': 'fixed', # ( auto | fixed | increment | decrement | random | imix )
'l3_imix1_size': 60,
'l3_imix1_ratio': 28,
'l3_imix2_size': 590,
@@ -156,13 +155,11 @@ traffic_config_kwargs = {
'udp_dst_port_count': 1,
}
-# traffic_control()
traffic_control_kwargs = {
'action': None, # ( run | stop )
'port_handle': None
}
-# traffic_stats()
traffic_stats_kwargs = {
'mode': 'aggregate', # ( aggregate )
'port_handle': None
@@ -712,7 +709,6 @@ def STLHltStream(**user_kwargs):
# packet generation
packet = generate_packet(**user_kwargs)
try:
- # TODO: verify if bps is L1 or L2, use L2 for now
rate_types_dict = {'rate_pps': 'pps', 'rate_bps': 'bps_L2', 'rate_percent': 'percentage'}
rate_stateless = {rate_types_dict[rate_key]: float(kwargs[rate_key])}
transmit_mode = kwargs['transmit_mode']
@@ -732,12 +728,13 @@ def STLHltStream(**user_kwargs):
# stream generation
try:
stream = STLStream(packet = packet,
+ random_seed = 1 if kwargs['consistent_random'] else 0,
#enabled = True,
#self_start = True,
mode = transmit_mode_class,
#rx_stats = rx_stats,
- stream_id = kwargs.get('stream_id'),
- name = kwargs.get('name'),
+ stream_id = kwargs['stream_id'],
+ name = kwargs['name'],
)
except Exception as e:
raise STLError('Could not create stream: %s' % e if isinstance(e, STLError) else traceback.format_exc())
@@ -770,7 +767,7 @@ def generate_packet(**user_kwargs):
count = int(kwargs['mac_src_count']) - 1
if count < 0:
raise STLError('mac_src_count has to be at least 1')
- if count > 0:
+ if count > 0 or kwargs['mac_src_mode'] == 'random':
mac_src = mac_str_to_num(mac2str(kwargs['mac_src']))
step = kwargs['mac_src_step']
if step < 1:
@@ -794,11 +791,44 @@ def generate_packet(**user_kwargs):
vm_variables_cache[var_name] = True
elif kwargs['mac_src_mode'] == 'random':
var_name = 'mac_src_random'
- vm_cmds.append(CTRexVmDescFlowVar(name = var_name, size = 4, op = 'random', max_value = 0xffffffffffff))
+ vm_cmds.append(CTRexVmDescFlowVar(name = var_name, size = 4, op = 'random', max_value = 0xffffffff))
else:
raise STLError('mac_src_mode %s is not supported' % kwargs['mac_src_mode'])
vm_cmds.append(CTRexVmDescWrFlowVar(fv_name = var_name, pkt_offset = 'Ethernet.src', offset_fixup = 2, add_val = add_val))
-
+
+ if kwargs['mac_dst_mode'] != 'fixed':
+ count = int(kwargs['mac_dst_count']) - 1
+ if count < 0:
+ raise STLError('mac_dst_count has to be at least 1')
+ if count > 0 or kwargs['mac_dst_mode'] == 'random':
+ mac_dst = mac_str_to_num(mac2str(kwargs['mac_dst']))
+ step = kwargs['mac_dst_step']
+ if step < 1:
+ raise STLError('mac_dst_step has to be at least 1')
+ if type(step) is str:
+ step = mac_str_to_num(mac2str(step))
+ add_val = 0
+ if kwargs['mac_dst_mode'] == 'increment':
+ add_val = mac_dst
+ var_name = '%s_%s_%s_%s' % ('inc', 4, count, step)
+ if var_name not in vm_variables_cache:
+ vm_cmds.append(CTRexVmDescFlowVar(name = var_name, size = 4, op = 'inc', step = step,
+ max_value = count * step))
+ vm_variables_cache[var_name] = True
+ elif kwargs['mac_dst_mode'] == 'decrement':
+ add_val = mac_dst - count * step
+ var_name = '%s_%s_%s_%s' % ('dec', 4, count, step)
+ if var_name not in vm_variables_cache:
+ vm_cmds.append(CTRexVmDescFlowVar(name = 'mac_dst', size = 4, op = 'dec', step = step,
+ max_value = count * step))
+ vm_variables_cache[var_name] = True
+ elif kwargs['mac_dst_mode'] == 'random':
+ var_name = 'mac_dst_random'
+ vm_cmds.append(CTRexVmDescFlowVar(name = var_name, size = 4, op = 'random', max_value = 0xffffffff))
+ else:
+ raise STLError('mac_dst_mode %s is not supported' % kwargs['mac_dst_mode'])
+ vm_cmds.append(CTRexVmDescWrFlowVar(fv_name = var_name, pkt_offset = 'Ethernet.dst', offset_fixup = 2, add_val = add_val))
+
if kwargs['l2_encap'] == 'ethernet_ii_vlan' or (kwargs['l2_encap'] == 'ethernet_ii' and vlan_in_args(user_kwargs)):
#fields_desc = [ BitField("prio", 0, 3),
# BitField("id", 0, 1),
@@ -823,25 +853,32 @@ def generate_packet(**user_kwargs):
if count < 0:
raise STLError('vlan_id_count has to be at least 1')
if count > 0 or vlan_id_mode == 'random':
+ add_val = 0
var_name = 'vlan_id%s' % i
step = int(vlan_kwargs['vlan_id_step'])
if step < 1:
raise STLError('vlan_id_step has to be at least 1')
if vlan_id_mode == 'increment':
- vm_cmds.append(CTRexVmDescFlowVar(name = var_name, size = 2, op = 'inc', step = step,
- min_value = vlan_id,
- max_value = vlan_id + count * step))
+ add_val = vlan_id
+ var_name = '%s_%s_%s_%s' % ('dec', 2, count, step)
+ if var_name not in vm_variables_cache:
+ vm_cmds.append(CTRexVmDescFlowVar(name = var_name, size = 2, op = 'inc', step = step,
+ max_value = count * step))
+ vm_variables_cache[var_name] = True
elif vlan_id_mode == 'decrement':
- vm_cmds.append(CTRexVmDescFlowVar(name = var_name, size = 2, op = 'dec', step = step,
- min_value = vlan_id - count * step,
- max_value = vlan_id))
+ add_val = vlan_id - count * step
+ var_name = '%s_%s_%s_%s' % ('dec', 2, count, step)
+ if var_name not in vm_variables_cache:
+ vm_cmds.append(CTRexVmDescFlowVar(name = var_name, size = 2, op = 'dec', step = step,
+ max_value = count * step))
+ vm_variables_cache[var_name] = True
elif vlan_id_mode == 'random':
+ var_name = 'vlan_id_random'
vm_cmds.append(CTRexVmDescFlowVar(name = var_name, size = 2, op = 'random', min_value = 0, max_value = 0xffff))
else:
raise STLError('vlan_id_mode %s is not supported' % vlan_id_mode)
vm_cmds.append(STLVmWrMaskFlowVar(fv_name = var_name, pkt_offset = '802|1Q:%s.vlan' % i,
- pkt_cast_size = 2, mask = 0xfff))
-
+ pkt_cast_size = 2, mask = 0xfff, add_value = add_val))
else:
raise NotImplementedError("l2_encap does not support the desired encapsulation '%s'" % kwargs['l2_encap'])
base_pkt = l2_layer
@@ -878,7 +915,7 @@ def generate_packet(**user_kwargs):
count = int(kwargs['ip_src_count']) - 1
if count < 0:
raise STLError('ip_src_count has to be at least 1')
- if count > 0:
+ if count > 0 or kwargs['ip_src_mode'] == 'random':
fix_ipv4_checksum = True
add_val = 0
ip_src_addr = kwargs['ip_src_addr']
@@ -914,7 +951,7 @@ def generate_packet(**user_kwargs):
count = int(kwargs['ip_dst_count']) - 1
if count < 0:
raise STLError('ip_dst_count has to be at least 1')
- if count > 0:
+ if count > 0 or kwargs['ip_dst_mode'] == 'random':
fix_ipv4_checksum = True
add_val = 0
ip_dst_addr = kwargs['ip_dst_addr']
@@ -971,7 +1008,7 @@ def generate_packet(**user_kwargs):
count = int(kwargs['ipv6_src_count']) - 1
if count < 0:
raise STLError('ipv6_src_count has to be at least 1')
- if count > 0:
+ if count > 0 or kwargs['ipv6_src_mode'] == 'random':
add_val = 0
ipv6_src_addr_num = ipv4_str_to_num(is_valid_ipv6(kwargs['ipv6_src_addr'])[-4:])
step = kwargs['ipv6_src_step']
@@ -1004,7 +1041,7 @@ def generate_packet(**user_kwargs):
count = int(kwargs['ipv6_dst_count']) - 1
if count < 0:
raise STLError('ipv6_dst_count has to be at least 1')
- if count > 0:
+ if count > 0 or kwargs['ipv6_dst_mode'] == 'random':
add_val = 0
ipv6_dst_addr_num = ipv4_str_to_num(is_valid_ipv6(kwargs['ipv6_dst_addr'])[-4:])
step = kwargs['ipv6_dst_step']
@@ -1072,7 +1109,7 @@ def generate_packet(**user_kwargs):
count = int(kwargs['tcp_src_port_count']) - 1
if count < 0:
raise STLError('tcp_src_port_count has to be at least 1')
- if count > 0:
+ if count > 0 or kwargs['tcp_src_port_mode'] == 'random':
fix_ipv4_checksum = True
add_val = 0
step = kwargs['tcp_src_port_step']
@@ -1103,7 +1140,7 @@ def generate_packet(**user_kwargs):
count = int(kwargs['tcp_dst_port_count']) - 1
if count < 0:
raise STLError('tcp_dst_port_count has to be at least 1')
- if count > 0:
+ if count > 0 or kwargs['tcp_dst_port_mode'] == 'random':
fix_ipv4_checksum = True
add_val = 0
step = kwargs['tcp_dst_port_step']
@@ -1143,7 +1180,7 @@ def generate_packet(**user_kwargs):
count = int(kwargs['udp_src_port_count']) - 1
if count < 0:
raise STLError('udp_src_port_count has to be at least 1')
- if count > 0:
+ if count > 0 or kwargs['udp_src_port_mode'] == 'random':
fix_ipv4_checksum = True
add_val = 0
step = kwargs['udp_src_port_step']
@@ -1174,7 +1211,7 @@ def generate_packet(**user_kwargs):
count = int(kwargs['udp_dst_port_count']) - 1
if count < 0:
raise STLError('udp_dst_port_count has to be at least 1')
- if count > 0:
+ if count > 0 or kwargs['udp_dst_port_mode'] == 'random':
fix_ipv4_checksum = True
add_val = 0
step = kwargs['udp_dst_port_step']
diff --git a/scripts/exp/hlt_david4.pcap b/scripts/exp/hlt_david4.pcap
index a28d8ab1..520675c4 100644
--- a/scripts/exp/hlt_david4.pcap
+++ b/scripts/exp/hlt_david4.pcap
Binary files differ
diff --git a/scripts/exp/hlt_udp_ports.pcap b/scripts/exp/hlt_udp_ports.pcap
new file mode 100644
index 00000000..91905f39
--- /dev/null
+++ b/scripts/exp/hlt_udp_ports.pcap
Binary files differ
diff --git a/scripts/exp/hlt_udp_random_ports.pcap b/scripts/exp/hlt_udp_random_ports.pcap
new file mode 100644
index 00000000..86c09468
--- /dev/null
+++ b/scripts/exp/hlt_udp_random_ports.pcap
Binary files differ
diff --git a/scripts/stl/hlt/hlt_david1.py b/scripts/stl/hlt/hlt_david1.py
index 922bb632..73d258e3 100755
--- a/scripts/stl/hlt/hlt_david1.py
+++ b/scripts/stl/hlt/hlt_david1.py
@@ -2,6 +2,10 @@ from trex_stl_lib.trex_stl_hltapi import STLHltStream
class STLS1(object):
+ '''
+ Example number 1 of using HLTAPI from David
+ Creates 3 streams (imix) Eth/802.1Q/IP/TCP without VM
+ '''
def create_streams (self, direction = 0):
return STLHltStream(
diff --git a/scripts/stl/hlt/hlt_david2.py b/scripts/stl/hlt/hlt_david2.py
index be21c93d..d3e669a1 100755
--- a/scripts/stl/hlt/hlt_david2.py
+++ b/scripts/stl/hlt/hlt_david2.py
@@ -2,6 +2,10 @@ from trex_stl_lib.trex_stl_hltapi import STLHltStream
class STLS1(object):
+ '''
+ Example number 2 of using HLTAPI from David
+ Creates 3 streams (imix) Eth/802.1Q/IP/TCP without VM
+ '''
def create_streams (self, direction = 0):
return STLHltStream(
diff --git a/scripts/stl/hlt/hlt_david3.py b/scripts/stl/hlt/hlt_david3.py
index af41b3d4..21445700 100755
--- a/scripts/stl/hlt/hlt_david3.py
+++ b/scripts/stl/hlt/hlt_david3.py
@@ -2,6 +2,10 @@ from trex_stl_lib.trex_stl_hltapi import STLHltStream
class STLS1(object):
+ '''
+ Example number 3 of using HLTAPI from David
+ Creates Eth/802.1Q/802.1Q/IP/TCP stream
+ '''
def create_streams (self, direction = 0):
return STLHltStream(
diff --git a/scripts/stl/hlt/hlt_david4.py b/scripts/stl/hlt/hlt_david4.py
index 9624c0bb..1019a15e 100755
--- a/scripts/stl/hlt/hlt_david4.py
+++ b/scripts/stl/hlt/hlt_david4.py
@@ -2,6 +2,13 @@ from trex_stl_lib.trex_stl_hltapi import STLHltStream
class STLS1(object):
+ '''
+ Example number 3 of using HLTAPI from David
+ Creates Eth/802.1Q/802.1Q/IP/TCP stream with complex VM:
+ The first vlan_id will be incremented, second const.
+ MAC src, IP src, IP dst will have <mac_src_count> number of incremental values
+ MAC dst will have <mac_dst_count> number of incremental values
+ '''
def create_streams (self, direction = 0):
mac_dst_count = 10
@@ -11,7 +18,7 @@ class STLS1(object):
intf_traffic_src_ip = '16.0.0.1'
return STLHltStream(
- #enable_auto_detect_instrumentation = 1, # not supported
+ #enable_auto_detect_instrumentation = 1, # not supported yet
ip_dst_addr = intf_traffic_dst_ip,
ip_dst_count = mac_src_count,
ip_dst_mode = 'increment',
@@ -22,7 +29,7 @@ class STLS1(object):
ip_src_step = '0.0.1.0',
l3_protocol = 'ipv4',
mac_dst_count = mac_dst_count,
- #mac_dst_mode = 'discovery', # not supported
+ #mac_dst_mode = 'discovery', # not supported yet
mac_dst_mode = 'increment',
mac_dst_step = 1,
mac_src_count = mac_src_count,
diff --git a/scripts/stl/hlt/hlt_imix_4rates.py b/scripts/stl/hlt/hlt_imix_4rates.py
index 653c3876..f6bfdd30 100755
--- a/scripts/stl/hlt/hlt_imix_4rates.py
+++ b/scripts/stl/hlt/hlt_imix_4rates.py
@@ -2,6 +2,10 @@ from trex_stl_lib.trex_stl_hltapi import STLHltStream
class STLS1(object):
+ '''
+ Creating 4 streams Eth/IP/UDP with different size and rate (smallest with highest rate)
+ Each stream will get rate_pps * his ratio / sum of ratios
+ '''
def create_streams (self, direction = 0):
return STLHltStream(length_mode = 'imix', rate_pps = 2,
diff --git a/scripts/stl/hlt/hlt_tcp_ranges.py b/scripts/stl/hlt/hlt_tcp_ranges.py
index b720e1e2..28e66855 100755
--- a/scripts/stl/hlt/hlt_tcp_ranges.py
+++ b/scripts/stl/hlt/hlt_tcp_ranges.py
@@ -2,6 +2,9 @@ from trex_stl_lib.trex_stl_hltapi import STLHltStream
class STLS1(object):
+ '''
+ Eth/IP/TCP stream with VM to get 10 different TCP ports
+ '''
def create_streams (self, direction = 0):
return [STLHltStream(tcp_src_port_mode = 'decrement',
diff --git a/scripts/stl/hlt/hlt_udp_inc_dec_len_9k.py b/scripts/stl/hlt/hlt_udp_inc_dec_len_9k.py
index e8766da4..b3fec989 100755
--- a/scripts/stl/hlt/hlt_udp_inc_dec_len_9k.py
+++ b/scripts/stl/hlt/hlt_udp_inc_dec_len_9k.py
@@ -2,10 +2,16 @@ from trex_stl_lib.trex_stl_hltapi import STLHltStream
class STLS1(object):
+ '''
+ Create 2 Eth/IP/UDP steams with different packet size:
+ First stream will start from 64 bytes (default) and will increase until max_size (9,216)
+ Seconds stream will decrease the packet size in reverse way
+ '''
def create_streams (self):
+ max_size = 9*1024
return [STLHltStream(length_mode = 'increment',
- frame_size_max = 9*1024,
+ frame_size_max = max_size,
ip_src_addr = '16.0.0.1',
ip_dst_addr = '48.0.0.1',
l4_protocol = 'udp',
@@ -14,7 +20,7 @@ class STLS1(object):
rate_pps = 1,
),
STLHltStream(length_mode = 'decrement',
- frame_size_max = 9*1024,
+ frame_size_max = max_size,
ip_src_addr = '16.0.0.1',
ip_dst_addr = '48.0.0.1',
l4_protocol = 'udp',
diff --git a/scripts/stl/hlt/hlt_udp_ports.py b/scripts/stl/hlt/hlt_udp_ports.py
new file mode 100755
index 00000000..20862141
--- /dev/null
+++ b/scripts/stl/hlt/hlt_udp_ports.py
@@ -0,0 +1,33 @@
+from trex_stl_lib.trex_stl_hltapi import STLHltStream
+
+
+class STLS1(object):
+ '''
+ Eth/IP/UDP stream with VM for different UDP ports inc/dec
+ The ports overlap the max and min at very first packets
+ '''
+
+ def create_streams (self, direction = 0):
+ return [STLHltStream(l4_protocol = 'udp',
+ udp_src_port_mode = 'decrement',
+ udp_src_port_count = 45,
+ udp_src_port_step = 20,
+ udp_src_port = 123,
+ udp_dst_port_mode = 'increment',
+ udp_dst_port_count = 100,
+ udp_dst_port_step = 300,
+ udp_dst_port = 65000,
+ direction = direction,
+ rate_pps = 1000,
+ ),
+ ]
+
+ def get_streams (self, direction = 0):
+ return self.create_streams(direction)
+
+# dynamic load - used for trex console or simulator
+def register():
+ return STLS1()
+
+
+
diff --git a/scripts/stl/hlt/hlt_udp_random_ports.py b/scripts/stl/hlt/hlt_udp_random_ports.py
new file mode 100755
index 00000000..0f60958d
--- /dev/null
+++ b/scripts/stl/hlt/hlt_udp_random_ports.py
@@ -0,0 +1,28 @@
+from trex_stl_lib.trex_stl_hltapi import STLHltStream
+
+
+class STLS1(object):
+ '''
+ Eth/IP/UDP stream with VM for random UDP ports inc/dec.
+ Using "consistent_random = True" to have same random ports each test
+ '''
+
+ def create_streams (self, direction = 0):
+ return [STLHltStream(l4_protocol = 'udp',
+ udp_src_port_mode = 'random',
+ udp_dst_port_mode = 'random',
+ direction = direction,
+ rate_pps = 1000,
+ consistent_random = True,
+ ),
+ ]
+
+ def get_streams (self, direction = 0):
+ return self.create_streams(direction)
+
+# dynamic load - used for trex console or simulator
+def register():
+ return STLS1()
+
+
+