diff options
Diffstat (limited to 'scripts/automation/regression')
-rwxr-xr-x | scripts/automation/regression/hltapi_playground.py (renamed from scripts/automation/regression/hltapi_example.py) | 32 | ||||
-rwxr-xr-x | scripts/automation/regression/unit_tests/functional_tests/hltapi_stream_builder_test.py | 90 | ||||
-rw-r--r-- | scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py | 9 |
3 files changed, 76 insertions, 55 deletions
diff --git a/scripts/automation/regression/hltapi_example.py b/scripts/automation/regression/hltapi_playground.py index 5695d32f..793b0282 100755 --- a/scripts/automation/regression/hltapi_example.py +++ b/scripts/automation/regression/hltapi_playground.py @@ -1,7 +1,8 @@ #!/router/bin/python import outer_packages -from trex_stl_lib.trex_stl_hltapi import CTRexHltApi, CStreamsPerPort +#from trex_stl_lib.trex_stl_hltapi import CTRexHltApi, CStreamsPerPort +from trex_stl_lib.trex_stl_hltapi import * import traceback import sys, time from pprint import pprint @@ -53,13 +54,27 @@ if __name__ == "__main__": res = check_res(hlt_client.connect(device = args.device, port_list = [0, 1], username = 'danklei', break_locks = True, reset = True)) port_handle = res['port_handle'] print('Connected, got port handles %s' % port_handle) - ports_streams_dict = CStreamsPerPort(port_handle) - - print('Imix should create 3 streams (forth ratio is 0)') - res = check_res(hlt_client.traffic_config(mode = 'create', l2_encap = 'ethernet_ii_vlan', bidirectional = True, length_mode = 'imix', - port_handle = port_handle, save_to_yaml = '/tmp/d1.yaml')) + ports_streams_dict = CStreamsPerPort() + + res = check_res(hlt_client.traffic_config(mode = 'create', l2_encap = 'ethernet_ii_vlan', rate_pps = 1, + l3_protocol = 'ipv4', + length_mode = 'imix', l3_length = 200, + ipv6_dst_mode = 'decrement', ipv6_dst_count = 300, ipv6_dst_addr = 'fe80:0:0:0:0:0:0:000f', + port_handle = port_handle, port_handle2 = port_handle[1], save_to_yaml = '/tmp/d1.yaml')) + #print res + #print hlt_client._streams_history + #print hlt_client.trex_client._STLClient__get_all_streams(port_id = port_handle[0]) + #print hlt_client.trex_client._STLClient__get_all_streams(port_id = port_handle[1]) + #ports_streams_dict.add_streams_from_res(res) + sys.exit(0) + res = check_res(hlt_client.traffic_config(mode = 'create', l2_encap = 'ethernet_ii_vlan', rate_pps = 1, + port_handle = port_handle[0], port_handle2 = port_handle[1], save_to_yaml = '/tmp/d1.yaml', + l4_protocol = 'udp', + #udp_src_port_mode = 'decrement', + #udp_src_port_count = 10, udp_src_port = 5, + )) ports_streams_dict.add_streams_from_res(res) - + sys.exit(0) #print ports_streams_dict #print hlt_client.trex_client._STLClient__get_all_streams(port_id = port_handle[0]) res = check_res(hlt_client.traffic_config(mode = 'modify', port_handle = port_handle[0], stream_id = ports_streams_dict[0][0], @@ -71,7 +86,8 @@ if __name__ == "__main__": #print hlt_client.trex_client._STLClient__get_all_streams(port_id = port_handle[0]) check_res(hlt_client.traffic_config(mode = 'reset', port_handle = port_handle)) - res = check_res(hlt_client.traffic_config(mode = 'create', bidirectional = True, length_mode = 'fixed', port_handle = port_handle, + res = check_res(hlt_client.traffic_config(mode = 'create', bidirectional = True, length_mode = 'fixed', + port_handle = port_handle[0], port_handle2 = port_handle[1], transmit_mode = 'single_burst', pkts_per_burst = 100, rate_pps = 100, mac_src = '1-2-3-4-5-6', mac_dst = '6:5:4:4:5:6', 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 df93aba1..297034db 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 @@ -112,30 +112,30 @@ TBD self_start: true vm: instructions: - - init_value: 3232235777 - max_value: 3232235781 - min_value: 3232235777 - name: ip_src + - init_value: 0 + max_value: 4 + min_value: 0 + name: inc_4_4_1 op: inc size: 4 step: 1 type: flow_var - - add_value: 0 + - add_value: 3232235777 is_big_endian: true - name: ip_src + name: inc_4_4_1 pkt_offset: 26 type: write_flow_var - init_value: 0 max_value: 4294967295 min_value: 0 - name: ip_dst + name: ip_dst_random op: random size: 4 step: 1 type: flow_var - add_value: 0 is_big_endian: true - name: ip_dst + name: ip_dst_random pkt_offset: 30 type: write_flow_var - pkt_offset: 14 @@ -170,35 +170,35 @@ TBD self_start: true vm: instructions: - - init_value: 1024 - max_value: 1024 - min_value: 1015 - name: tcp_src + - 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: 1015 is_big_endian: true - name: tcp_src + name: dec_2_9_1 pkt_offset: 34 type: write_flow_var - init_value: 0 max_value: 65535 min_value: 0 - name: tcp_dst + name: tcp_dst_random op: random size: 2 step: 1 type: flow_var - add_value: 0 is_big_endian: true - name: tcp_dst + name: tcp_dst_random pkt_offset: 36 type: write_flow_var - pkt_offset: 14 type: fix_checksum_ipv4 - split_by_var: tcp_src + split_by_var: dec_2_9_1 ''' # Eth / IP / UDP, udp ports are changed by VM @@ -247,35 +247,35 @@ TBD self_start: true vm: instructions: - - init_value: 1234 - max_value: 1234 - min_value: 1225 - name: udp_src + - 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: 1225 is_big_endian: true - name: udp_src + name: dec_2_9_1 pkt_offset: 34 type: write_flow_var - - init_value: 1234 - max_value: 1243 - min_value: 1234 - name: udp_dst + - init_value: 0 + max_value: 9 + min_value: 0 + name: inc_2_9_1 op: inc size: 2 step: 1 type: flow_var - - add_value: 0 + - add_value: 1234 is_big_endian: true - name: udp_dst + name: inc_2_9_1 pkt_offset: 36 type: write_flow_var - pkt_offset: 14 type: fix_checksum_ipv4 - split_by_var: udp_src + split_by_var: dec_2_9_1 ''' # Eth/IP/TCP, packet length is changed in VM by frame_size @@ -543,7 +543,7 @@ TBD pps: 1 type: continuous packet: - binary: AAAAAAAAAAABAAABht1gAAAAAFIGQP6AAAAAAAAAAAAAAAAAABL+gAAAAAAAAAAAAAAAAAAiBAAAUAAAAAEAAAABUAAP5Zs3AAAhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhIQ== + binary: AAAAAAAAAAABAAABht1gAAAAAG4GQP6AAAAAAAAAAAAAAAAAABL+gAAAAAAAAAAAAAAAAAAiBAAAUAAAAAEAAAABUAAP5ctLAAAhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISE= meta: '' rx_stats: enabled: false @@ -573,40 +573,40 @@ TBD pps: 1 type: continuous packet: - binary: AAAAAAAAAAABAAABht1gAAAAAFIRQBERIiIzM0REVVVmZnd3iIgRERERERERERERERERERERBAAAUABSQkIhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhIQ== + binary: AAAAAAAAAAABAAABht1gAAAAAG4RQBERIiIzM0REVVVmZnd3iIgRERERERERERERERERERERBAAAUABucjohISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISE= meta: '' rx_stats: enabled: false self_start: true vm: instructions: - - init_value: 2004322440 - max_value: 2004322485 - min_value: 2004322440 - name: ipv6_src + - init_value: 0 + max_value: 45 + min_value: 0 + name: inc_4_9_5 op: inc size: 4 step: 5 type: flow_var - - add_value: 0 + - add_value: 2004322440 is_big_endian: true - name: ipv6_src + name: inc_4_9_5 pkt_offset: 34 type: write_flow_var - - init_value: 286331153 - max_value: 286331153 - min_value: 286328620 - name: ipv6_dst + - init_value: 2533 + max_value: 2533 + min_value: 0 + name: dec_4_149_17 op: dec size: 4 step: 17 type: flow_var - - add_value: 0 + - add_value: 286328620 is_big_endian: true - name: ipv6_dst + name: dec_4_149_17 pkt_offset: 50 type: write_flow_var - split_by_var: ipv6_dst + split_by_var: dec_4_149_17 ''' 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 8b9c9bac..c92bc5ac 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 @@ -200,9 +200,14 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test): def test_hlt_profiles (self): p = ( ['hlt/hlt_udp_inc_dec_len_9k.py', '-m 1 -l 20', True], - ['hlt/hlt_imix_default.py', '-m 1 -l 40', True], + ['hlt/hlt_imix_default.py', '-m 1 -l 20', True], + ['hlt/hlt_imix_4rates.py', '-m 1 -l 20', True], + ['hlt/hlt_david1.py', '-m 1 -l 20', True], + ['hlt/hlt_david2.py', '-m 1 -l 20', True], + ['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], ) - for obj in p: self.run_py_profile_path (obj[0], obj[1], compare =obj[2], do_no_remove=True) |