diff options
author | 2016-02-23 15:32:19 +0200 | |
---|---|---|
committer | 2016-02-23 15:32:19 +0200 | |
commit | 36cc1ecef32dcee3640e6ddf96422c07d89777b3 (patch) | |
tree | 6a9eadb662ad0f98395886077fe32943512fd040 /scripts/automation/regression/unit_tests | |
parent | 68ebd739646a27f1bb92ce8eacb5bb76f6399580 (diff) | |
parent | 81059eb5df274efe48ad3914039ddb657c3285ab (diff) |
Merge ipv4 checksum issue
Diffstat (limited to 'scripts/automation/regression/unit_tests')
-rwxr-xr-x | scripts/automation/regression/unit_tests/functional_tests/hltapi_stream_builder_test.py | 169 | ||||
-rwxr-xr-x | scripts/automation/regression/unit_tests/trex_general_test.py | 11 |
2 files changed, 139 insertions, 41 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 e76e3bb0..df93aba1 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 @@ -38,11 +38,10 @@ class CTRexHltApi_Test(unittest.TestCase): with self.assertRaises(Exception): STLHltStream(l2_encap = 'ethernet_sdfgsdfg') # all default values - test_stream = STLHltStream(name = 'stream-0') + test_stream = STLHltStream() self.test_yaml = test_stream.dump_to_yaml(self.yaml_save_location()) self.golden_yaml = ''' -- name: stream-0 - stream: +- stream: action_count: 0 enabled: true flags: 3 @@ -61,10 +60,10 @@ class CTRexHltApi_Test(unittest.TestCase): split_by_var: '' ''' - # Eth/IP/TCP, test L2 fields, wait for masking of variables for MAC + # Eth/IP/TCP, test MAC fields VM, wait for masking of variables for MAC @nottest - def test_l2_basic(self): - test_stream = STLHltStream(name = 'stream-0') + def test_macs_vm(self): + test_stream = STLHltStream(name = 'stream-0', ) self.test_yaml = test_stream.dump_to_yaml(self.yaml_save_location()) self.golden_yaml = ''' TBD @@ -73,16 +72,30 @@ TBD # Eth/IP/TCP, ip src and dest is changed by VM def test_ip_ranges(self): - test_stream = STLHltStream(ip_src_addr = '192.168.1.1', + # running on single core not implemented yet + with self.assertRaises(Exception): + test_stream = STLHltStream(split_by_cores = 'single', + ip_src_addr = '192.168.1.1', + ip_src_mode = 'increment', + ip_src_count = 5,) + # wrong type + with self.assertRaises(Exception): + test_stream = STLHltStream(split_by_cores = 12345, + ip_src_addr = '192.168.1.1', + ip_src_mode = 'increment', + ip_src_count = 5,) + + test_stream = STLHltStream(split_by_cores = 'duplicate', + ip_src_addr = '192.168.1.1', ip_src_mode = 'increment', ip_src_count = 5, ip_dst_addr = '5.5.5.5', ip_dst_count = 2, ip_dst_mode = 'random', - name = 'stream-0') + name = 'test_ip_ranges') self.test_yaml = test_stream.dump_to_yaml(self.yaml_save_location()) self.golden_yaml = ''' -- name: stream-0 +- name: test_ip_ranges stream: action_count: 0 enabled: true @@ -112,9 +125,9 @@ TBD name: ip_src pkt_offset: 26 type: write_flow_var - - init_value: 84215045 - max_value: 84215046 - min_value: 84215045 + - init_value: 0 + max_value: 4294967295 + min_value: 0 name: ip_dst op: random size: 4 @@ -137,10 +150,10 @@ TBD tcp_dst_port_mode = 'random', tcp_dst_port_count = 10, tcp_dst_port = 1234, - name = 'stream-0') + name = 'test_tcp_ranges') self.test_yaml = test_stream.dump_to_yaml(self.yaml_save_location()) self.golden_yaml = ''' -- name: stream-0 +- name: test_tcp_ranges stream: action_count: 0 enabled: true @@ -170,9 +183,9 @@ TBD name: tcp_src pkt_offset: 34 type: write_flow_var - - init_value: 1234 - max_value: 1243 - min_value: 1234 + - init_value: 0 + max_value: 65535 + min_value: 0 name: tcp_dst op: random size: 2 @@ -185,7 +198,7 @@ TBD type: write_flow_var - pkt_offset: 14 type: fix_checksum_ipv4 - split_by_var: '' + split_by_var: tcp_src ''' # Eth / IP / UDP, udp ports are changed by VM @@ -214,10 +227,10 @@ TBD udp_dst_port_mode = 'increment', udp_dst_port_count = 10, udp_dst_port = 1234, - name = 'stream-0') + name = 'test_udp_ranges') self.test_yaml = test_stream.dump_to_yaml(self.yaml_save_location()) self.golden_yaml = ''' -- name: stream-0 +- name: test_udp_ranges stream: action_count: 0 enabled: true @@ -262,7 +275,7 @@ TBD type: write_flow_var - pkt_offset: 14 type: fix_checksum_ipv4 - split_by_var: '' + split_by_var: udp_src ''' # Eth/IP/TCP, packet length is changed in VM by frame_size @@ -274,10 +287,10 @@ TBD test_stream = STLHltStream(length_mode = 'decrement', frame_size_min = 100, frame_size_max = 3000, - name = 'stream-0') + name = 'test_pkt_len_by_framesize') self.test_yaml = test_stream.dump_to_yaml(self.yaml_save_location()) self.golden_yaml = ''' -- name: stream-0 +- name: test_pkt_len_by_framesize stream: action_count: 0 enabled: true @@ -311,7 +324,7 @@ TBD type: write_flow_var - pkt_offset: 14 type: fix_checksum_ipv4 - split_by_var: '' + split_by_var: pkt_len ''' # Eth/IP/UDP, packet length is changed in VM by l3_length @@ -320,10 +333,10 @@ TBD length_mode = 'random', l3_length_min = 100, l3_length_max = 400, - name = 'stream-0') + name = 'test_pkt_len_by_l3length') self.test_yaml = test_stream.dump_to_yaml(self.yaml_save_location()) self.golden_yaml = ''' -- name: stream-0 +- name: test_pkt_len_by_l3length stream: action_count: 0 enabled: true @@ -373,11 +386,11 @@ TBD test_stream = STLHltStream(l2_encap = 'ethernet_ii') assert ':802.1Q:' not in test_stream.get_pkt_type(), 'Default packet should not include dot1q' - test_stream = STLHltStream(name = 'stream-0', l2_encap = 'ethernet_ii_vlan') + test_stream = STLHltStream(name = 'test_vlan_basic', l2_encap = 'ethernet_ii_vlan') assert ':802.1Q:' in test_stream.get_pkt_type(), 'No dot1q in packet with encap ethernet_ii_vlan' self.test_yaml = test_stream.dump_to_yaml(self.yaml_save_location()) self.golden_yaml = ''' -- name: stream-0 +- name: test_vlan_basic stream: action_count: 0 enabled: true @@ -402,12 +415,14 @@ TBD # default frame size should be not enough with self.assertRaises(Exception): STLHltStream(vlan_id = [1, 2, 3, 4]) - test_stream = STLHltStream(name = 'stream-0', frame_size = 100, vlan_id = [1, 2, 3, 4], vlan_protocol_tag_id = '8100 0x8100') + test_stream = STLHltStream(name = 'test_vlan_multiple', frame_size = 100, + vlan_id = [1, 2, 3, 4], # can be either array or string separated by spaces + vlan_protocol_tag_id = '8100 0x8100') pkt_layers = test_stream.get_pkt_type() - assert ':802.1Q:802.1Q:802.1Q:802.1Q:' in pkt_layers, 'No four dot1q layers in packet: %s' % pkt_layers + assert '802.1Q:' * 4 in pkt_layers, 'No four dot1q layers in packet: %s' % pkt_layers self.test_yaml = test_stream.dump_to_yaml(self.yaml_save_location()) self.golden_yaml = ''' -- name: stream-0 +- name: test_vlan_multiple stream: action_count: 0 enabled: true @@ -427,6 +442,84 @@ TBD split_by_var: '' ''' + # Eth/IP/TCP, with 5 vlans and VMs on vlan_id + def test_vlan_vm(self): + test_stream = STLHltStream(name = 'test_vlan_vm', frame_size = 100, + vlan_id = '1 2 1000 4 5', # 5 vlans + vlan_id_mode = 'increment fixed decrement random', # 5th vlan will be default fixed + vlan_id_step = 2, # 1st vlan step will be 2, others - default 1 + vlan_id_count = [4, 1, 10], # 4th independent on count, 5th will be fixed + ) + pkt_layers = test_stream.get_pkt_type() + self.test_yaml = test_stream.dump_to_yaml(self.yaml_save_location()) + assert '802.1Q:' * 5 in pkt_layers, 'No five dot1q layers in packet: %s' % pkt_layers + self.golden_yaml = ''' +- name: test_vlan_vm + stream: + action_count: 0 + enabled: true + flags: 3 + isg: 0.0 + mode: + pps: 1 + type: continuous + packet: + binary: AAAAAAAAAAABAAABgQAwAYEAMAKBADPogQAwBIEAMAUIAEUAAEIAAAAAQAa6tQAAAADAAAABBAAAUAAAAAEAAAABUAAP5SzkAAAhISEhISEhISEhISEhISEhISEhISEhISEhIQ== + meta: '' + rx_stats: + enabled: false + self_start: true + vm: + instructions: + - init_value: 1 + max_value: 7 + min_value: 1 + name: vlan_id0 + op: inc + size: 2 + step: 2 + type: flow_var + - is_big_endian: true + mask: 4095 + name: vlan_id0 + 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 + op: dec + size: 2 + step: 1 + type: flow_var + - is_big_endian: true + mask: 4095 + name: vlan_id2 + pkt_cast_size: 2 + pkt_offset: 22 + shift: 0 + type: write_mask_flow_var + - init_value: 0 + max_value: 65535 + min_value: 0 + name: vlan_id3 + op: random + size: 2 + step: 1 + type: flow_var + - is_big_endian: true + mask: 4095 + name: vlan_id3 + pkt_cast_size: 2 + pkt_offset: 26 + shift: 0 + type: write_mask_flow_var + split_by_var: vlan_id2 +''' + + # Eth/IPv6/TCP, no VM def test_ipv6_basic(self): # default frame size should be not enough @@ -437,10 +530,10 @@ TBD # error should affect with self.assertRaises(Exception): STLHltStream(l3_protocol = 'ipv6', ipv6_src_addr = 'asdfasdfasgasdf') - test_stream = STLHltStream(name = 'stream-0', l3_protocol = 'ipv6', length_mode = 'fixed', l3_length = 150, ) + test_stream = STLHltStream(name = 'test_ipv6_basic', l3_protocol = 'ipv6', length_mode = 'fixed', l3_length = 150, ) self.test_yaml = test_stream.dump_to_yaml(self.yaml_save_location()) self.golden_yaml = ''' -- name: stream-0 +- name: test_ipv6_basic stream: action_count: 0 enabled: true @@ -462,7 +555,7 @@ TBD # Eth/IPv6/UDP, VM on ipv6 fields def test_ipv6_src_dst_ranges(self): - test_stream = STLHltStream(name = 'stream-0', l3_protocol = 'ipv6', l3_length = 150, l4_protocol = 'udp', + test_stream = STLHltStream(name = 'test_ipv6_src_dst_ranges', l3_protocol = 'ipv6', l3_length = 150, l4_protocol = 'udp', ipv6_src_addr = '1111:2222:3333:4444:5555:6666:7777:8888', ipv6_dst_addr = '1111:1111:1111:1111:1111:1111:1111:1111', ipv6_src_mode = 'increment', ipv6_src_step = 5, ipv6_src_count = 10, @@ -470,7 +563,7 @@ TBD ) self.test_yaml = test_stream.dump_to_yaml(self.yaml_save_location()) self.golden_yaml = ''' -- name: stream-0 +- name: test_ipv6_src_dst_ranges stream: action_count: 0 enabled: true @@ -488,7 +581,7 @@ TBD vm: instructions: - init_value: 2004322440 - max_value: 2004322449 + max_value: 2004322485 min_value: 2004322440 name: ipv6_src op: inc @@ -502,7 +595,7 @@ TBD type: write_flow_var - init_value: 286331153 max_value: 286331153 - min_value: 286331004 + min_value: 286328620 name: ipv6_dst op: dec size: 4 @@ -513,7 +606,7 @@ TBD name: ipv6_dst pkt_offset: 50 type: write_flow_var - split_by_var: '' + split_by_var: ipv6_dst ''' diff --git a/scripts/automation/regression/unit_tests/trex_general_test.py b/scripts/automation/regression/unit_tests/trex_general_test.py index 14af4820..f367a397 100755 --- a/scripts/automation/regression/unit_tests/trex_general_test.py +++ b/scripts/automation/regression/unit_tests/trex_general_test.py @@ -243,9 +243,14 @@ class CTRexGeneral_Test(unittest.TestCase): m_total_alloc_error = trex_res.get_last_value("trex-global.data.m_total_alloc_error") m_total_queue_full = trex_res.get_last_value("trex-global.data.m_total_queue_full") m_total_queue_drop = trex_res.get_last_value("trex-global.data.m_total_queue_drop") - self.assert_gt( 999, m_total_alloc_error, 'Got allocation errors. (%s), please review multiplier and templates configuration.' % m_total_alloc_error) - self.assert_gt( max(9999, trex_tx_pckt / 1000 ), m_total_queue_full, 'Too much queue_full (%s), please review multiplier.' % m_total_queue_full) - self.assert_gt( 999, m_total_queue_drop, 'Too much queue_drop (%s), please review multiplier.' % m_total_queue_drop) + self.assert_gt(1000, m_total_alloc_error, 'Got allocation errors. (%s), please review multiplier and templates configuration.' % m_total_alloc_error) + self.assert_gt(1000, m_total_queue_drop, 'Too much queue_drop (%s), please review multiplier.' % m_total_queue_drop) + + if self.is_VM: + allowed_queue_full = 10000 + trex_tx_pckt / 100 + else: + allowed_queue_full = 1000 + trex_tx_pckt / 1000 + self.assert_gt(allowed_queue_full, m_total_queue_full, 'Too much queue_full (%s), please review multiplier.' % m_total_queue_full) # # check T-Rex expected counters #trex_exp_rate = trex_res.get_expected_tx_rate().get('m_tx_expected_bps') |