diff options
author | 2016-03-08 10:28:20 +0200 | |
---|---|---|
committer | 2016-03-08 10:28:20 +0200 | |
commit | afefddfa387dad83bbcb15812bd279cf3197f583 (patch) | |
tree | a0da1554a09da985ff65e63bfee7b9e1c4a240f5 /scripts/automation/regression/unit_tests/functional_tests | |
parent | 29c78819b903a2933e8ba106faa5ba5745eb527e (diff) |
regression: add stateless support (WIP); Scapy builder: fix remove MACs from binary, do not build by default;
Diffstat (limited to 'scripts/automation/regression/unit_tests/functional_tests')
13 files changed, 0 insertions, 1702 deletions
diff --git a/scripts/automation/regression/unit_tests/functional_tests/config.yaml b/scripts/automation/regression/unit_tests/functional_tests/config.yaml deleted file mode 100644 index 4f4c7c40..00000000 --- a/scripts/automation/regression/unit_tests/functional_tests/config.yaml +++ /dev/null @@ -1,74 +0,0 @@ -################################################################ -#### T-Rex nightly test configuration file #### -################################################################ - - -### T-Rex configuration: -# hostname - can be DNS name or IP for the TRex machine for ssh to the box -# password - root password for TRex machine -# is_dual - should the TRex inject with -p ? -# version_path - path to the t-rex version and executable -# cores - how many cores should be used -# latency - rate of latency packets injected by the TRex - -### Router configuration: -# hostname - the router hostname as apears in ______# cli prefix -# ip_address - the router's ip that can be used to communicate with -# image - the desired imaged wished to be loaded as the router's running config -# line_password - router password when access via Telent -# en_password - router password when changing to "enable" mode -# interfaces - an array of client-server pairs, representing the interfaces configurations of the router -# configurations - an array of configurations that could possibly loaded into the router during the test. -# The "clean" configuration is a mandatory configuration the router will load with to run the basic test bench - -### TFTP configuration: -# hostname - the tftp hostname -# ip_address - the tftp's ip address -# images_path - the tftp's relative path in which the router's images are located - -### Test_misc configuration: -# expected_bw - the "golden" bandwidth (in Gbps) results planned on receiving from the test - -trex: - hostname : hostname - password : root password - version_path : not used - cores : 1 - -router: - model : device model - hostname : device hostname - ip_address : device ip - image : device image name - line_password : telnet pass - en_password : enable pass - mgmt_interface : GigabitEthernet0/0/0 - clean_config : path to clean_config file - intf_masking : 255.255.255.0 - ipv6_mask : 64 - interfaces : - - client : - name : GigabitEthernet0/0/1 - src_mac_addr : 0000.0001.0000 - dest_mac_addr : 0000.1000.0000 - server : - name : GigabitEthernet0/0/2 - src_mac_addr : 0000.0002.0000 - dest_mac_addr : 0000.2000.0000 - vrf_name : null - - client : - name : GigabitEthernet0/0/3 - src_mac_addr : 0000.0003.0000 - dest_mac_addr : 0000.3000.0000 - server : - name : GigabitEthernet0/0/4 - src_mac_addr : 0000.0004.0000 - dest_mac_addr : 0000.4000.0000 - vrf_name : dup - - -tftp: - hostname : tftp hostname - ip_address : tftp ip - root_dir : tftp root dir - images_path : path related to root dir diff --git a/scripts/automation/regression/unit_tests/functional_tests/functional_general_test.py b/scripts/automation/regression/unit_tests/functional_tests/functional_general_test.py deleted file mode 100755 index 525b58d2..00000000 --- a/scripts/automation/regression/unit_tests/functional_tests/functional_general_test.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/router/bin/python - -from nose.tools import assert_equal -from nose.tools import assert_not_equal -from nose.tools import assert_raises -from nose.tools import raises - - -class CGeneralFunctional_Test(object): - def __init__(self): - pass - - - def setUp(self): - pass - - - def tearDown(self): - pass - -if __name__ == "__main__": - pass 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 deleted file mode 100755 index c6b477aa..00000000 --- a/scripts/automation/regression/unit_tests/functional_tests/hltapi_stream_builder_test.py +++ /dev/null @@ -1,629 +0,0 @@ -#!/router/bin/python - -import os -import unittest -from trex_stl_lib.trex_stl_hltapi import STLHltStream -from trex_stl_lib.trex_stl_types import validate_type -from nose.plugins.attrib import attr -from nose.tools import nottest - -def compare_yamls(yaml1, yaml2): - validate_type('yaml1', yaml1, str) - validate_type('yaml2', yaml2, str) - i = 0 - for line1, line2 in zip(yaml1.strip().split('\n'), yaml2.strip().split('\n')): - i += 1 - assert line1 == line2, 'yamls are not equal starting from line %s:\n%s\n Golden <-> Generated\n%s' % (i, line1.strip(), line2.strip()) - -# TODO: move the tests to compare pcaps, not yamls -@nottest -class CTRexHltApi_Test(unittest.TestCase): - ''' Checks correct HLTAPI creation of packet/VM ''' - - def setUp(self): - self.golden_yaml = None - self.test_yaml = None - - def tearDown(self): - compare_yamls(self.golden_yaml, self.test_yaml) - - # Eth/IP/TCP, all values default, no VM instructions + test MACs correction - def test_hlt_basic(self): - STLHltStream(mac_src = 'a0:00:01:::01', mac_dst = '0d 00 01 00 00 01', - mac_src2 = '{00 b0 01 00 00 01}', mac_dst2 = 'd0.00.01.00.00.01') - with self.assertRaises(Exception): - STLHltStream(mac_src2 = '00:00:00:00:00:0k') - with self.assertRaises(Exception): - STLHltStream(mac_dst2 = '100:00:00:00:00:00') - # wrong encap - with self.assertRaises(Exception): - STLHltStream(l2_encap = 'ethernet_sdfgsdfg') - # all default values - test_stream = STLHltStream() - self.test_yaml = test_stream.dump_to_yaml(self.yaml_save_location()) - self.golden_yaml = ''' -- stream: - action_count: 0 - enabled: true - flags: 3 - isg: 0.0 - mode: - percentage: 10.0 - type: continuous - packet: - binary: AAAAAAAAAAABAAABCABFAAAyAAAAAEAGusUAAAAAwAAAAQQAAFAAAAABAAAAAVAAD+U1/QAAISEhISEhISEhIQ== - meta: '' - flow_stats: - enabled: false - self_start: true - vm: - instructions: [] - split_by_var: '' -''' - - # Eth/IP/TCP, test MAC fields VM, wait for masking of variables for MAC - @nottest - 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 -''' - - - # Eth/IP/TCP, ip src and dest is changed by VM - def test_ip_ranges(self): - # 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 = 'test_ip_ranges', - rate_pps = 1) - self.test_yaml = test_stream.dump_to_yaml(self.yaml_save_location()) - self.golden_yaml = ''' -- name: test_ip_ranges - stream: - action_count: 0 - enabled: true - flags: 3 - isg: 0.0 - mode: - pps: 1.0 - type: continuous - packet: - binary: AAAAAAAAAAABAAABCABFAAAyAAAAAEAGrxPAqAEBBQUFBQQAAFAAAAABAAAAAVAAD+UqSwAAISEhISEhISEhIQ== - meta: '' - flow_stats: - enabled: false - self_start: true - vm: - instructions: - - 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: 3232235777 - is_big_endian: true - name: inc_4_4_1 - pkt_offset: 26 - type: write_flow_var - - init_value: 0 - max_value: 4294967295 - min_value: 0 - name: ip_dst_random - op: random - size: 4 - step: 1 - type: flow_var - - add_value: 0 - is_big_endian: true - name: ip_dst_random - pkt_offset: 30 - type: write_flow_var - - pkt_offset: 14 - type: fix_checksum_ipv4 - split_by_var: '' -''' - - # Eth / IP / TCP, tcp ports are changed by VM - def test_tcp_ranges(self): - test_stream = STLHltStream(tcp_src_port_mode = 'decrement', - tcp_src_port_count = 10, - tcp_dst_port_mode = 'random', - tcp_dst_port_count = 10, - tcp_dst_port = 1234, - name = 'test_tcp_ranges', - rate_pps = '2') - self.test_yaml = test_stream.dump_to_yaml(self.yaml_save_location()) - self.golden_yaml = ''' -- name: test_tcp_ranges - stream: - action_count: 0 - enabled: true - flags: 3 - isg: 0.0 - mode: - pps: 2.0 - type: continuous - packet: - binary: AAAAAAAAAAABAAABCABFAAAyAAAAAEAGusUAAAAAwAAAAQQABNIAAAABAAAAAVAAD+UxewAAISEhISEhISEhIQ== - meta: '' - flow_stats: - enabled: false - self_start: true - vm: - instructions: - - 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: 1015 - is_big_endian: true - name: dec_2_9_1 - pkt_offset: 34 - type: write_flow_var - - init_value: 0 - max_value: 65535 - min_value: 0 - name: tcp_dst_random - op: random - size: 2 - step: 1 - type: flow_var - - add_value: 0 - is_big_endian: true - name: tcp_dst_random - pkt_offset: 36 - type: write_flow_var - - pkt_offset: 14 - type: fix_checksum_ipv4 - split_by_var: dec_2_9_1 -''' - - # Eth / IP / UDP, udp ports are changed by VM - def test_udp_ranges(self): - # UDP is not set, expecting ignore of wrong UDP arguments - STLHltStream(udp_src_port_mode = 'qwerqwer', - udp_src_port_count = 'weqwer', - udp_src_port = 'qwerqwer', - udp_dst_port_mode = 'qwerqwe', - udp_dst_port_count = 'sfgsdfg', - udp_dst_port = 'sdfgsdfg') - # UDP is set, expecting fail due to wrong UDP arguments - with self.assertRaises(Exception): - STLHltStream(l4_protocol = 'udp', - udp_src_port_mode = 'qwerqwer', - udp_src_port_count = 'weqwer', - udp_src_port = 'qwerqwer', - udp_dst_port_mode = 'qwerqwe', - udp_dst_port_count = 'sfgsdfg', - udp_dst_port = 'sdfgsdfg') - # generate it already with correct arguments - test_stream = STLHltStream(l4_protocol = 'udp', - udp_src_port_mode = 'decrement', - udp_src_port_count = 10, - udp_src_port = 1234, - udp_dst_port_mode = 'increment', - udp_dst_port_count = 10, - udp_dst_port = 1234, - name = 'test_udp_ranges', - rate_percent = 20,) - self.test_yaml = test_stream.dump_to_yaml(self.yaml_save_location()) - self.golden_yaml = ''' -- name: test_udp_ranges - stream: - action_count: 0 - enabled: true - flags: 3 - isg: 0.0 - mode: - percentage: 20.0 - type: continuous - packet: - binary: AAAAAAAAAAABAAABCABFAAAyAAAAAEARuroAAAAAwAAAAQTSBNIAHsmgISEhISEhISEhISEhISEhISEhISEhIQ== - meta: '' - flow_stats: - enabled: false - self_start: true - vm: - instructions: - - 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: 1225 - is_big_endian: true - name: dec_2_9_1 - pkt_offset: 34 - type: write_flow_var - - 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: 1234 - is_big_endian: true - name: inc_2_9_1 - pkt_offset: 36 - type: write_flow_var - - pkt_offset: 14 - type: fix_checksum_ipv4 - split_by_var: dec_2_9_1 -''' - - # Eth/IP/TCP, packet length is changed in VM by frame_size - def test_pkt_len_by_framesize(self): - # just check errors, no compare to golden - STLHltStream(length_mode = 'increment', - frame_size_min = 100, - frame_size_max = 3000) - test_stream = STLHltStream(length_mode = 'decrement', - frame_size_min = 100, - frame_size_max = 3000, - name = 'test_pkt_len_by_framesize', - rate_bps = 1000) - self.test_yaml = test_stream.dump_to_yaml(self.yaml_save_location()) - self.golden_yaml = ''' -- name: test_pkt_len_by_framesize - stream: - action_count: 0 - enabled: true - flags: 3 - isg: 0.0 - mode: - bps_L2: 1000.0 - type: continuous - packet: - binary: AAAAAAAAAAABAAABCABFAAuqAAAAAEAGr00AAAAAwAAAAQQAAFAAAAABAAAAAVAAD+UwiwAAISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEh - meta: '' - flow_stats: - enabled: false - self_start: true - vm: - instructions: - - init_value: 3000 - max_value: 3000 - min_value: 100 - name: pkt_len - op: dec - size: 2 - step: 1 - type: flow_var - - name: pkt_len - type: trim_pkt_size - - add_value: -14 - is_big_endian: true - name: pkt_len - pkt_offset: 16 - type: write_flow_var - - pkt_offset: 14 - type: fix_checksum_ipv4 - split_by_var: pkt_len -''' - - # Eth/IP/UDP, packet length is changed in VM by l3_length - def test_pkt_len_by_l3length(self): - test_stream = STLHltStream(l4_protocol = 'udp', - length_mode = 'random', - l3_length_min = 100, - l3_length_max = 400, - name = 'test_pkt_len_by_l3length') - self.test_yaml = test_stream.dump_to_yaml(self.yaml_save_location()) - self.golden_yaml = ''' -- name: test_pkt_len_by_l3length - stream: - action_count: 0 - enabled: true - flags: 3 - isg: 0.0 - mode: - percentage: 10.0 - type: continuous - packet: - binary: AAAAAAAAAAABAAABCABFAAGQAAAAAEARuVwAAAAAwAAAAQQAAFABfCaTISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEh - meta: '' - flow_stats: - enabled: false - self_start: true - vm: - instructions: - - init_value: 114 - max_value: 414 - min_value: 114 - name: pkt_len - op: random - size: 2 - step: 1 - type: flow_var - - name: pkt_len - type: trim_pkt_size - - add_value: -14 - is_big_endian: true - name: pkt_len - pkt_offset: 16 - type: write_flow_var - - add_value: -34 - is_big_endian: true - name: pkt_len - pkt_offset: 38 - type: write_flow_var - - pkt_offset: 14 - type: fix_checksum_ipv4 - split_by_var: '' -''' - - # Eth/IP/TCP, with vlan, no VM - def test_vlan_basic(self): - with self.assertRaises(Exception): - STLHltStream(l2_encap = 'ethernet_ii', - vlan_id = 'sdfgsdgf') - 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 = '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: test_vlan_basic - stream: - action_count: 0 - enabled: true - flags: 3 - isg: 0.0 - mode: - percentage: 10.0 - type: continuous - packet: - binary: AAAAAAAAAAABAAABgQAwAAgARQAALgAAAABABrrJAAAAAMAAAAEEAABQAAAAAQAAAAFQAA/leEMAACEhISEhIQ== - meta: '' - flow_stats: - enabled: false - self_start: true - vm: - instructions: [] - split_by_var: '' -''' - - # Eth/IP/TCP, with 4 vlan - def test_vlan_multiple(self): - # default frame size should be not enough - with self.assertRaises(Exception): - STLHltStream(vlan_id = [1, 2, 3, 4]) - 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:' * 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: test_vlan_multiple - stream: - action_count: 0 - enabled: true - flags: 3 - isg: 0.0 - mode: - percentage: 10.0 - type: continuous - packet: - binary: AAAAAAAAAAABAAABgQAwAYEAMAKBADADgQAwBAgARQAARgAAAABABrqxAAAAAMAAAAEEAABQAAAAAQAAAAFQAA/l6p0AACEhISEhISEhISEhISEhISEhISEhISEhISEhISEhIQ== - meta: '' - flow_stats: - enabled: false - self_start: true - vm: - instructions: [] - 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: - percentage: 10.0 - type: continuous - packet: - binary: AAAAAAAAAAABAAABgQAwAYEAMAKBADPogQAwBIEAMAUIAEUAAEIAAAAAQAa6tQAAAADAAAABBAAAUAAAAAEAAAABUAAP5SzkAAAhISEhISEhISEhISEhISEhISEhISEhISEhIQ== - meta: '' - flow_stats: - enabled: false - self_start: true - vm: - instructions: - - 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: 1 - is_big_endian: true - mask: 4095 - name: dec_2_3_2 - pkt_cast_size: 2 - pkt_offset: 14 - shift: 0 - type: write_mask_flow_var - - 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: 991 - is_big_endian: true - mask: 4095 - name: dec_2_9_1 - 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_id_random - op: random - size: 2 - step: 1 - type: flow_var - - add_value: 0 - is_big_endian: true - mask: 4095 - name: vlan_id_random - pkt_cast_size: 2 - pkt_offset: 26 - shift: 0 - type: write_mask_flow_var - split_by_var: dec_2_9_1 -''' - - - # Eth/IPv6/TCP, no VM - def test_ipv6_basic(self): - # default frame size should be not enough - with self.assertRaises(Exception): - STLHltStream(l3_protocol = 'ipv6') - # error should not affect - STLHltStream(ipv6_src_addr = 'asdfasdfasgasdf') - # error should affect - with self.assertRaises(Exception): - STLHltStream(l3_protocol = 'ipv6', ipv6_src_addr = 'asdfasdfasgasdf') - 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: test_ipv6_basic - stream: - action_count: 0 - enabled: true - flags: 3 - isg: 0.0 - mode: - percentage: 10.0 - type: continuous - packet: - binary: AAAAAAAAAAABAAABht1gAAAAAG4GQP6AAAAAAAAAAAAAAAAAABL+gAAAAAAAAAAAAAAAAAAiBAAAUAAAAAEAAAABUAAP5ctLAAAhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISE= - meta: '' - flow_stats: - enabled: false - self_start: true - vm: - instructions: [] - split_by_var: '' -''' - - # Eth/IPv6/UDP, VM on ipv6 fields - def test_ipv6_src_dst_ranges(self): - 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, - ipv6_dst_mode = 'decrement', ipv6_dst_step = '1111:1111:1111:1111:1111:1111:0000:0011', ipv6_dst_count = 150, - ) - self.test_yaml = test_stream.dump_to_yaml(self.yaml_save_location()) - self.golden_yaml = ''' -- name: test_ipv6_src_dst_ranges - stream: - action_count: 0 - enabled: true - flags: 3 - isg: 0.0 - mode: - percentage: 10.0 - type: continuous - packet: - binary: AAAAAAAAAAABAAABht1gAAAAAG4RQBERIiIzM0REVVVmZnd3iIgRERERERERERERERERERERBAAAUABucjohISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISE= - meta: '' - flow_stats: - enabled: false - self_start: true - vm: - instructions: - - 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: 2004322440 - is_big_endian: true - name: inc_4_9_5 - pkt_offset: 34 - type: write_flow_var - - 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: 286328620 - is_big_endian: true - name: dec_4_149_17 - pkt_offset: 50 - type: write_flow_var - split_by_var: dec_4_149_17 -''' - - - - - - def yaml_save_location(self): - #return os.devnull - # debug/deveopment, comment line above - return '/tmp/%s.yaml' % self._testMethodName - - diff --git a/scripts/automation/regression/unit_tests/functional_tests/misc_methods_test.py b/scripts/automation/regression/unit_tests/functional_tests/misc_methods_test.py deleted file mode 100755 index 096f86d8..00000000 --- a/scripts/automation/regression/unit_tests/functional_tests/misc_methods_test.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/router/bin/python - -import functional_general_test -import misc_methods -from nose.tools import assert_equal -from nose.tools import assert_not_equal -from nose.tools import assert_raises -from nose.tools import raises - - -class MiscMethods_Test(functional_general_test.CGeneralFunctional_Test): - - def setUp(self): - self.ipv4_gen = misc_methods.get_network_addr() - self.ipv6_gen = misc_methods.get_network_addr(ip_type = 'ipv6') - pass - - def test_ipv4_gen(self): - for i in range(1, 255): - assert_equal( next(self.ipv4_gen), [".".join( map(str, [1, 1, i, 0])), '255.255.255.0'] ) - - def test_ipv6_gen(self): - tmp_ipv6_addr = ['2001', 'DB8', 0, '2222', 0, 0, 0, 0] - for i in range(0, 255): - tmp_ipv6_addr[2] = hex(i)[2:] - assert_equal( next(self.ipv6_gen), ":".join( map(str, tmp_ipv6_addr)) ) - - def test_get_ipv4_client_addr(self): - tmp_ipv4_addr = next(self.ipv4_gen)[0] - assert_equal ( misc_methods.get_single_net_client_addr(tmp_ipv4_addr), '1.1.1.1') - assert_raises (ValueError, misc_methods.get_single_net_client_addr, tmp_ipv4_addr, {'3' : 255} ) - - def test_get_ipv6_client_addr(self): - tmp_ipv6_addr = next(self.ipv6_gen) - assert_equal ( misc_methods.get_single_net_client_addr(tmp_ipv6_addr, {'7' : 1}, ip_type = 'ipv6'), '2001:DB8:0:2222:0:0:0:1') - assert_equal ( misc_methods.get_single_net_client_addr(tmp_ipv6_addr, {'7' : 2}, ip_type = 'ipv6'), '2001:DB8:0:2222:0:0:0:2') - assert_raises (ValueError, misc_methods.get_single_net_client_addr, tmp_ipv6_addr, {'7' : 70000} ) - - - @raises(ValueError) - def test_ipv4_client_addr_exception(self): - tmp_ipv4_addr = next(self.ipv4_gen)[0] - misc_methods.get_single_net_client_addr(tmp_ipv4_addr, {'4' : 1}) - - @raises(ValueError) - def test_ipv6_client_addr_exception(self): - tmp_ipv6_addr = next(self.ipv6_gen) - misc_methods.get_single_net_client_addr(tmp_ipv6_addr, {'8' : 1}, ip_type = 'ipv6') - - @raises(StopIteration) - def test_gen_ipv4_to_limit (self): - while(True): - next(self.ipv4_gen) - - @raises(StopIteration) - def test_gen_ipv6_to_limit (self): - while(True): - next(self.ipv6_gen) - - def tearDown(self): - pass diff --git a/scripts/automation/regression/unit_tests/functional_tests/pkt_bld_general_test.py b/scripts/automation/regression/unit_tests/functional_tests/pkt_bld_general_test.py deleted file mode 100755 index 5f89eaff..00000000 --- a/scripts/automation/regression/unit_tests/functional_tests/pkt_bld_general_test.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/router/bin/python - -from nose.tools import assert_equal -from nose.tools import assert_not_equal -from nose.tools import assert_raises -from nose.tools import raises -import sys -import outer_packages - - -class CGeneralPktBld_Test(object): - def __init__(self): - pass - - @staticmethod - def print_packet(pkt_obj): - print "\nGenerated packet:\n{}".format(repr(pkt_obj)) - - - def setUp(self): - pass - - - def tearDown(self): - pass - -if __name__ == "__main__": - pass diff --git a/scripts/automation/regression/unit_tests/functional_tests/platform_cmd_cache_test.py b/scripts/automation/regression/unit_tests/functional_tests/platform_cmd_cache_test.py deleted file mode 100755 index 24ccf7a5..00000000 --- a/scripts/automation/regression/unit_tests/functional_tests/platform_cmd_cache_test.py +++ /dev/null @@ -1,60 +0,0 @@ -#!/router/bin/python - -from platform_cmd_link import * -import functional_general_test -from nose.tools import assert_equal -from nose.tools import assert_not_equal - - -class CCommandCache_Test(functional_general_test.CGeneralFunctional_Test): - - def setUp(self): - self.cache = CCommandCache() - self.cache.add('IF', "ip nbar protocol-discovery", 'GigabitEthernet0/0/1') - self.cache.add('IF', "ip nbar protocol-discovery", 'GigabitEthernet0/0/2') - self.cache.add('conf', "arp 1.1.1.1 0000.0001.0000 arpa") - self.cache.add('conf', "arp 1.1.2.1 0000.0002.0000 arpa") - self.cache.add('exec', "show ip nbar protocol-discovery stats packet-count") - - def test_add(self): - assert_equal(self.cache.cache['IF'], - {'GigabitEthernet0/0/1' : ['ip nbar protocol-discovery'], - 'GigabitEthernet0/0/2' : ['ip nbar protocol-discovery'] - }) - assert_equal(self.cache.cache['CONF'], - ["arp 1.1.1.1 0000.0001.0000 arpa", - "arp 1.1.2.1 0000.0002.0000 arpa"] - ) - assert_equal(self.cache.cache['EXEC'], - ["show ip nbar protocol-discovery stats packet-count"]) - - def test_dump_config (self): - import sys - from StringIO import StringIO - saved_stdout = sys.stdout - try: - out = StringIO() - sys.stdout = out - self.cache.dump_config() - output = out.getvalue().strip() - assert_equal(output, - "configure terminal\ninterface GigabitEthernet0/0/1\nip nbar protocol-discovery\ninterface GigabitEthernet0/0/2\nip nbar protocol-discovery\nexit\narp 1.1.1.1 0000.0001.0000 arpa\narp 1.1.2.1 0000.0002.0000 arpa\nexit\nshow ip nbar protocol-discovery stats packet-count" - ) - finally: - sys.stdout = saved_stdout - - def test_get_config_list (self): - assert_equal(self.cache.get_config_list(), - ["configure terminal", "interface GigabitEthernet0/0/1", "ip nbar protocol-discovery", "interface GigabitEthernet0/0/2", "ip nbar protocol-discovery", "exit", "arp 1.1.1.1 0000.0001.0000 arpa", "arp 1.1.2.1 0000.0002.0000 arpa", "exit", "show ip nbar protocol-discovery stats packet-count"] - ) - - def test_clear_cache (self): - self.cache.clear_cache() - assert_equal(self.cache.cache, - {"IF" : {}, - "CONF" : [], - "EXEC" : []} - ) - - def tearDown(self): - self.cache.clear_cache() diff --git a/scripts/automation/regression/unit_tests/functional_tests/platform_cmd_link_test.py b/scripts/automation/regression/unit_tests/functional_tests/platform_cmd_link_test.py deleted file mode 100755 index 7a31815b..00000000 --- a/scripts/automation/regression/unit_tests/functional_tests/platform_cmd_link_test.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/router/bin/python - -from platform_cmd_link import * -import functional_general_test -from nose.tools import assert_equal -from nose.tools import assert_not_equal - - -class CCommandLink_Test(functional_general_test.CGeneralFunctional_Test): - - def setUp(self): - self.cache = CCommandCache() - self.cache.add('IF', "ip nbar protocol-discovery", 'GigabitEthernet0/0/1') - self.cache.add('IF', "ip nbar protocol-discovery", 'GigabitEthernet0/0/2') - self.cache.add('conf', "arp 1.1.1.1 0000.0001.0000 arpa") - self.cache.add('conf', "arp 1.1.2.1 0000.0002.0000 arpa") - self.cache.add('exec', "show ip nbar protocol-discovery stats packet-count") - self.com_link = CCommandLink() - - def test_transmit(self): - # test here future implemntatin of platform physical link - pass - - def test_run_cached_command (self): - self.com_link.run_command([self.cache]) - - assert_equal (self.com_link.get_history(), - ["configure terminal", "interface GigabitEthernet0/0/1", "ip nbar protocol-discovery", "interface GigabitEthernet0/0/2", "ip nbar protocol-discovery", "exit", "arp 1.1.1.1 0000.0001.0000 arpa", "arp 1.1.2.1 0000.0002.0000 arpa", "exit", "show ip nbar protocol-discovery stats packet-count"] - ) - - self.com_link.clear_history() - self.com_link.run_single_command(self.cache) - assert_equal (self.com_link.get_history(), - ["configure terminal", "interface GigabitEthernet0/0/1", "ip nbar protocol-discovery", "interface GigabitEthernet0/0/2", "ip nbar protocol-discovery", "exit", "arp 1.1.1.1 0000.0001.0000 arpa", "arp 1.1.2.1 0000.0002.0000 arpa", "exit", "show ip nbar protocol-discovery stats packet-count"] - ) - - def test_run_single_command(self): - self.com_link.run_single_command("show ip nbar protocol-discovery stats packet-count") - assert_equal (self.com_link.get_history(), - ["show ip nbar protocol-discovery stats packet-count"] - ) - - def test_run_mixed_commands (self): - self.com_link.run_single_command("show ip nbar protocol-discovery stats packet-count") - self.com_link.run_command([self.cache]) - self.com_link.run_command(["show ip interface brief"]) - - assert_equal (self.com_link.get_history(), - ["show ip nbar protocol-discovery stats packet-count", - "configure terminal", "interface GigabitEthernet0/0/1", "ip nbar protocol-discovery", "interface GigabitEthernet0/0/2", "ip nbar protocol-discovery", "exit", "arp 1.1.1.1 0000.0001.0000 arpa", "arp 1.1.2.1 0000.0002.0000 arpa", "exit", "show ip nbar protocol-discovery stats packet-count", - "show ip interface brief"] - ) - - def test_clear_history (self): - self.com_link.run_command(["show ip interface brief"]) - self.com_link.clear_history() - assert_equal (self.com_link.get_history(), []) - - def tearDown(self): - self.cache.clear_cache() - - diff --git a/scripts/automation/regression/unit_tests/functional_tests/platform_device_cfg_test.py b/scripts/automation/regression/unit_tests/functional_tests/platform_device_cfg_test.py deleted file mode 100755 index 890d0cb9..00000000 --- a/scripts/automation/regression/unit_tests/functional_tests/platform_device_cfg_test.py +++ /dev/null @@ -1,20 +0,0 @@ -#!/router/bin/python - -from platform_cmd_link import * -import functional_general_test -from nose.tools import assert_equal -from nose.tools import assert_not_equal - - -class CDeviceCfg_Test(functional_general_test.CGeneralFunctional_Test): - - def setUp(self): - self.dev_cfg = CDeviceCfg('./unit_tests/functional_tests/config.yaml') - - def test_get_interfaces_cfg(self): - assert_equal (self.dev_cfg.get_interfaces_cfg(), - [{'client': {'src_mac_addr': '0000.0001.0000', 'name': 'GigabitEthernet0/0/1', 'dest_mac_addr': '0000.1000.0000'}, 'vrf_name': None, 'server': {'src_mac_addr': '0000.0002.0000', 'name': 'GigabitEthernet0/0/2', 'dest_mac_addr': '0000.2000.0000'}}, {'client': {'src_mac_addr': '0000.0003.0000', 'name': 'GigabitEthernet0/0/3', 'dest_mac_addr': '0000.3000.0000'}, 'vrf_name': 'dup', 'server': {'src_mac_addr': '0000.0004.0000', 'name': 'GigabitEthernet0/0/4', 'dest_mac_addr': '0000.4000.0000'}}] - ) - - def tearDown(self): - pass diff --git a/scripts/automation/regression/unit_tests/functional_tests/platform_dual_if_obj_test.py b/scripts/automation/regression/unit_tests/functional_tests/platform_dual_if_obj_test.py deleted file mode 100755 index ff54b9ee..00000000 --- a/scripts/automation/regression/unit_tests/functional_tests/platform_dual_if_obj_test.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/router/bin/python - -from platform_cmd_link import * -import functional_general_test -from nose.tools import assert_equal -from nose.tools import assert_not_equal - - -class CDualIfObj_Test(functional_general_test.CGeneralFunctional_Test): - - def setUp(self): - self.if_1 = CIfObj('gig0/0/1', '1.1.1.1', '2001:DB8:0:2222:0:0:0:1', '0000.0001.0000', '0000.0001.0000', IFType.Client) - self.if_2 = CIfObj('gig0/0/2', '1.1.2.1', '2001:DB8:1:2222:0:0:0:1', '0000.0002.0000', '0000.0002.0000', IFType.Server) - self.if_3 = CIfObj('gig0/0/3', '1.1.3.1', '2001:DB8:2:2222:0:0:0:1', '0000.0003.0000', '0000.0003.0000', IFType.Client) - self.if_4 = CIfObj('gig0/0/4', '1.1.4.1', '2001:DB8:3:2222:0:0:0:1', '0000.0004.0000', '0000.0004.0000', IFType.Server) - self.dual_1 = CDualIfObj(None, self.if_1, self.if_2) - self.dual_2 = CDualIfObj('dup', self.if_3, self.if_4) - - def test_id_allocation(self): - assert (self.dual_1.get_id() < self.dual_2.get_id() < CDualIfObj._obj_id) - - def test_get_vrf_name (self): - assert_equal ( self.dual_1.get_vrf_name() , None ) - assert_equal ( self.dual_2.get_vrf_name() , 'dup' ) - - def test_is_duplicated (self): - assert_equal ( self.dual_1.is_duplicated() , False ) - assert_equal ( self.dual_2.is_duplicated() , True ) - - def tearDown(self): - pass
\ No newline at end of file diff --git a/scripts/automation/regression/unit_tests/functional_tests/platform_if_manager_test.py b/scripts/automation/regression/unit_tests/functional_tests/platform_if_manager_test.py deleted file mode 100755 index 7ba6e66e..00000000 --- a/scripts/automation/regression/unit_tests/functional_tests/platform_if_manager_test.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/router/bin/python - -from platform_cmd_link import * -import functional_general_test -from nose.tools import assert_equal -from nose.tools import assert_not_equal - - -class CIfManager_Test(functional_general_test.CGeneralFunctional_Test): - - def setUp(self): - self.dev_cfg = CDeviceCfg('./unit_tests/functional_tests/config.yaml') - self.if_mng = CIfManager() - - # main testing method to check the entire class - def test_load_config (self): - self.if_mng.load_config(self.dev_cfg) - - # check the number of items in each qeury - assert_equal( len(self.if_mng.get_if_list()), 4 ) - assert_equal( len(self.if_mng.get_if_list(if_type = IFType.Client)), 2 ) - assert_equal( len(self.if_mng.get_if_list(if_type = IFType.Client, is_duplicated = True)), 1 ) - assert_equal( len(self.if_mng.get_if_list(if_type = IFType.Client, is_duplicated = False)), 1 ) - assert_equal( len(self.if_mng.get_if_list(if_type = IFType.Server)), 2 ) - assert_equal( len(self.if_mng.get_if_list(if_type = IFType.Server, is_duplicated = True)), 1 ) - assert_equal( len(self.if_mng.get_if_list(if_type = IFType.Server, is_duplicated = False)), 1 ) - assert_equal( len(self.if_mng.get_duplicated_if()), 2 ) - assert_equal( len(self.if_mng.get_dual_if_list()), 2 ) - - # check the classification with intf name - assert_equal( map(CIfObj.get_name, self.if_mng.get_if_list() ), ['GigabitEthernet0/0/1','GigabitEthernet0/0/2','GigabitEthernet0/0/3','GigabitEthernet0/0/4'] ) - assert_equal( map(CIfObj.get_name, self.if_mng.get_if_list(is_duplicated = True) ), ['GigabitEthernet0/0/3','GigabitEthernet0/0/4'] ) - assert_equal( map(CIfObj.get_name, self.if_mng.get_if_list(is_duplicated = False) ), ['GigabitEthernet0/0/1','GigabitEthernet0/0/2'] ) - assert_equal( map(CIfObj.get_name, self.if_mng.get_duplicated_if() ), ['GigabitEthernet0/0/3', 'GigabitEthernet0/0/4'] ) - - # check the classification with vrf name - assert_equal( map(CDualIfObj.get_vrf_name, self.if_mng.get_dual_if_list() ), [None, 'dup'] ) - - def tearDown(self): - pass diff --git a/scripts/automation/regression/unit_tests/functional_tests/platform_if_obj_test.py b/scripts/automation/regression/unit_tests/functional_tests/platform_if_obj_test.py deleted file mode 100755 index 534d4170..00000000 --- a/scripts/automation/regression/unit_tests/functional_tests/platform_if_obj_test.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/router/bin/python - -from platform_cmd_link import * -import functional_general_test -from nose.tools import assert_equal -from nose.tools import assert_not_equal - - -class CIfObj_Test(functional_general_test.CGeneralFunctional_Test): - test_idx = 1 - - def setUp(self): - self.if_1 = CIfObj('gig0/0/1', '1.1.1.1', '2001:DB8:0:2222:0:0:0:1', '0000.0001.0000', '0000.0001.0000', IFType.Client) - self.if_2 = CIfObj('TenGig0/0/0', '1.1.2.1', '2001:DB8:1:2222:0:0:0:1', '0000.0002.0000', '0000.0002.0000', IFType.Server) - CIfObj_Test.test_idx += 1 - - def test_id_allocation(self): - assert (self.if_1.get_id() < self.if_2.get_id() < CIfObj._obj_id) - - def test_isClient(self): - assert_equal (self.if_1.is_client(), True) - - def test_isServer(self): - assert_equal (self.if_2.is_server(), True) - - def test_get_name (self): - assert_equal (self.if_1.get_name(), 'gig0/0/1') - assert_equal (self.if_2.get_name(), 'TenGig0/0/0') - - def test_get_src_mac_addr (self): - assert_equal (self.if_1.get_src_mac_addr(), '0000.0001.0000') - - def test_get_dest_mac (self): - assert_equal (self.if_2.get_dest_mac(), '0000.0002.0000') - - def test_get_ipv4_addr (self): - assert_equal (self.if_1.get_ipv4_addr(), '1.1.1.1' ) - assert_equal (self.if_2.get_ipv4_addr(), '1.1.2.1' ) - - def test_get_ipv6_addr (self): - assert_equal (self.if_1.get_ipv6_addr(), '2001:DB8:0:2222:0:0:0:1' ) - assert_equal (self.if_2.get_ipv6_addr(), '2001:DB8:1:2222:0:0:0:1' ) - - def test_get_type (self): - assert_equal (self.if_1.get_if_type(), IFType.Client) - assert_equal (self.if_2.get_if_type(), IFType.Server) - - def tearDown(self): - pass diff --git a/scripts/automation/regression/unit_tests/functional_tests/scapy_pkt_builder_test.py b/scripts/automation/regression/unit_tests/functional_tests/scapy_pkt_builder_test.py deleted file mode 100644 index 7e2f6271..00000000 --- a/scripts/automation/regression/unit_tests/functional_tests/scapy_pkt_builder_test.py +++ /dev/null @@ -1,368 +0,0 @@ -#!/router/bin/python - -import pkt_bld_general_test - -#HACK FIX ME START -import sys -import os - -CURRENT_PATH = os.path.dirname(os.path.realpath(__file__)) -sys.path.append(os.path.join(CURRENT_PATH, '../../../trex_control_plane/stl/')) -#HACK FIX ME END -from trex_stl_lib.trex_stl_packet_builder_scapy import * - -from scapy.all import * -from nose.tools import assert_equal -from nose.tools import assert_not_equal -from nose.tools import assert_raises -from nose.tools import raises -import os -import random -import pprint - -class CTRexPktBuilderSanitySCapy_Test(pkt_bld_general_test.CGeneralPktBld_Test): - - def setUp(self): - pass - - def test_simple_vm1(self): - raw1 = CTRexScRaw( [ CTRexVmDescFlowVar(name="a",min_value="16.0.0.1",max_value="16.0.0.10",init_value="16.0.0.1",size=4,op="inc"), - CTRexVmDescWrFlowVar (fv_name="a",pkt_offset= "IP.src"), - CTRexVmDescFixIpv4(offset = "IP")] - ); - - pkt_builder = CScapyTRexPktBuilder(); - - py='5'*128 - pkt=Ether()/ \ - IP(src="16.0.0.1",dst="48.0.0.1")/ \ - UDP(dport=12,sport=1025)/IP()/py - - # set packet - pkt_builder.set_packet(pkt); - pkt_builder.add_command ( raw1 ) - pkt_builder.compile(); - - pkt_builder.dump_scripts () - - print pkt_builder.get_vm_data() - - assert_equal( pkt_builder.get_vm_data(), {'split_by_var': '', 'instructions': [{'name': 'a', 'max_value': 268435466, 'min_value': 268435457, 'init_value': 268435457, 'size': 4, 'type': 'flow_var', 'step':1,'op': 'inc'}, {'is_big_endian': True, 'pkt_offset': 26, 'type': 'write_flow_var', 'name': 'a', 'add_value': 0}, {'pkt_offset': 14, 'type': 'fix_checksum_ipv4'}]} ) - - - - def test_simple_no_vm1(self): - - pkt_builder = CScapyTRexPktBuilder(); - - py='5'*128 - pkt=Ether()/ \ - IP(src="16.0.0.1",dst="48.0.0.1")/ \ - UDP(dport=12,sport=1025)/IP()/py - - # set packet - pkt_builder.set_packet(pkt); - - pkt_builder.compile(); - - pkt_builder.dump_scripts () - - assert_equal( pkt_builder.get_vm_data(), - { 'instructions': [ ], - 'split_by_var': ''} - ) - - - def test_simple_mac_default(self): - - pkt = Ether()/IP()/UDP() - - - pkt_builder = CScapyTRexPktBuilder(pkt = pkt); - - assert_equal( pkt_builder.is_def_src_mac () ,True) - assert_equal( pkt_builder.is_def_dst_mac () ,True) - - pkt = Ether(src="00:00:00:00:00:01")/IP()/UDP() - - pkt_builder = CScapyTRexPktBuilder(pkt = pkt); - - assert_equal( pkt_builder.is_def_src_mac (), False) - assert_equal( pkt_builder.is_def_dst_mac (), True) - - pkt = Ether(dst="00:00:00:00:00:01")/IP()/UDP() - - pkt_builder = CScapyTRexPktBuilder(pkt = pkt); - - assert_equal( pkt_builder.is_def_src_mac (),True) - assert_equal( pkt_builder.is_def_dst_mac (),False) - - - - - def test_simple_teredo(self): - - pkt = Ether()/IP(src="16.0.0.1",dst="48.0.0.1")/UDP(dport=3797,sport=3544)/IPv6(src="2001:0:4137:9350:8000:f12a:b9c8:2815",dst="2001:4860:0:2001::68")/UDP(dport=12,sport=1025)/ICMPv6Unknown() - - pkt.build(); - p_utl=CTRexScapyPktUtl(pkt); - - assert_equal( p_utl.get_field_offet_by_str("IPv6.src"), (50,16) ) - assert_equal( p_utl.get_field_offet_by_str("IPv6.dst"), (66,16) ) - - - - - def test_simple_scapy_vlan(self): - - py='5'*(9) - p1=Ether(src="00:00:00:01:00:00",dst="00:00:00:01:00:00")/ \ - Dot1Q(vlan=12)/ \ - Dot1Q(vlan=17)/ \ - IP(src="10.0.0.10",dst="48.0.0.1")/ \ - UDP(dport=12,sport=1025)/py - - p1.build(); - p1.dump_layers_offset() - p1.show2(); - hexdump(p1); - #wrpcap("ipv4_udp_9k.pcap", p1); - - p_utl=CTRexScapyPktUtl(p1); - - assert_equal(p_utl.get_pkt_layers(),"Ethernet:802.1Q:802.1Q:IP:UDP:Raw") - assert_equal(p_utl.layer_offset("802.1Q",0),14); - assert_equal(p_utl.layer_offset("802.1Q",1),18); - assert_equal(p_utl.get_field_offet_by_str("802|1Q.vlan"),(14,0)); - assert_equal(p_utl.get_field_offet_by_str("802|1Q:1.vlan"),(18,0)); - assert_equal(p_utl.get_field_offet_by_str("IP.src"),(34,4)); - - def test_simple_scapy_128_udp(self): - """ - build 128 byte packet with 0x35 as pyld - """ - - - pkt_size =128 - p1=Ether(src="00:00:00:01:00:00",dst="00:00:00:01:00:00")/ \ - IP(src="16.0.0.1",dst="48.0.0.1")/ \ - UDP(dport=12,sport=1025) - pyld_size=pkt_size-len(p1); - - pkt=p1/('5'*(pyld_size)) - - pkt.show2(); - hexdump(pkt); - assert_equal(len(pkt),128) - - def test_simple_scapy_9k_ip_len(self): - """ - build 9k ipv4 len packet - """ - - - ip_pkt_size =9*1024 - p_l2=Ether(src="00:00:00:01:00:00",dst="00:00:00:01:00:00"); - p_l3= IP(src="16.0.0.1",dst="48.0.0.1")/ \ - UDP(dport=12,sport=1025) - pyld_size = ip_pkt_size-len(p_l3); - - pkt=p_l2/p_l3/('\x55'*(pyld_size)) - - #pkt.show2(); - #hexdump(pkt); - assert_equal(len(pkt),9*1024+14) - - def test_simple_scapy_ipv6_1(self): - """ - build ipv6 packet - """ - - print "start " - py='\x55'*(64) - - p=Ether()/IPv6()/UDP(dport=12,sport=1025)/py - #p.build(); - #p.dump_layers_offset() - hexdump(p); - p.show2(); - - p_utl=CTRexScapyPktUtl(p); - - assert_equal(p_utl.get_field_offet_by_str("IPv6.src"),(22,16)); - - - def test_simple_vm2(self): - raw1 = CTRexScRaw( [ CTRexVmDescFlowVar(name="my_valn",min_value=0,max_value=10,init_value=2,size=1,op="inc"), - CTRexVmDescWrFlowVar (fv_name="my_valn",pkt_offset= "802|1Q.vlan" ,offset_fixup=3) # fix the offset as valn is bitfield and not supported right now - ] - ); - - pkt_builder = CScapyTRexPktBuilder(); - - py='5'*128 - pkt=Ether()/ \ - Dot1Q(vlan=12)/ \ - IP(src="16.0.0.1",dst="48.0.0.1")/ \ - UDP(dport=12,sport=1025)/IP()/py - - # set packet - pkt_builder.set_packet(pkt); - pkt_builder.add_command ( raw1 ) - pkt_builder.compile(); - - - d= pkt_builder.get_vm_data() - assert_equal(d['instructions'][1]['pkt_offset'],17) - - def test_simple_vm3(self): - try: - raw1 = CTRexScRaw( [ CTRexVmDescFlowVar(name="my_valn",min_value=0,max_value=10,init_value=2,size=1,op="inc"), - CTRexVmDescWrFlowVar (fv_name="my_valn_err",pkt_offset= "802|1Q.vlan" ,offset_fixup=3) # fix the offset as valn is bitfield and not supported right now - ] - ); - - pkt_builder = CScapyTRexPktBuilder(); - - py='5'*128 - pkt=Ether()/ \ - Dot1Q(vlan=12)/ \ - IP(src="16.0.0.1",dst="48.0.0.1")/ \ - UDP(dport=12,sport=1025)/IP()/py - - # set packet - pkt_builder.set_packet(pkt); - pkt_builder.add_command ( raw1 ) - pkt_builder.compile(); - - - d= pkt_builder.get_vm_data() - except CTRexPacketBuildException as e: - assert_equal(str(e), "[errcode:-11] 'variable my_valn_err does not exists '") - - def test_simple_tuple_gen(self): - vm = CTRexScRaw( [ CTRexVmDescTupleGen (name="tuple"), # define tuple gen - CTRexVmDescWrFlowVar (fv_name="tuple.ip", pkt_offset= "IP.src" ), # write ip to packet IP.src - CTRexVmDescFixIpv4(offset = "IP"), # fix checksum - CTRexVmDescWrFlowVar (fv_name="tuple.port", pkt_offset= "UDP.sport" ) #write udp.port - ] - ); - pkt_builder = CScapyTRexPktBuilder(); - - py='5'*128 - pkt=Ether()/ \ - Dot1Q(vlan=12)/ \ - IP(src="16.0.0.1",dst="48.0.0.1")/ \ - UDP(dport=12,sport=1025)/IP()/py - - # set packet - pkt_builder.set_packet(pkt); - pkt_builder.add_command ( vm ) - pkt_builder.compile(); - d= pkt_builder.get_vm_data() - pkt_builder.dump_vm_data_as_yaml() - - assert_equal(d['instructions'][1]['pkt_offset'],30) - assert_equal(d['instructions'][3]['pkt_offset'],38) - - def test_simple_random_pkt_size(self): - - ip_pkt_size = 9*1024 - p_l2 = Ether(); - p_l3 = IP(src="16.0.0.1",dst="48.0.0.1") - p_l4 = UDP(dport=12,sport=1025) - pyld_size = ip_pkt_size-len(p_l3/p_l4); - - pkt =p_l2/p_l3/p_l4/('\x55'*(pyld_size)) - - l3_len_fix =-(len(p_l2)); - l4_len_fix =-(len(p_l2/p_l3)); - - vm = CTRexScRaw( [ CTRexVmDescFlowVar(name="fv_rand", min_value=64, max_value=len(pkt), size=2, op="random"), - CTRexVmDescTrimPktSize("fv_rand"), # total packet size - CTRexVmDescWrFlowVar(fv_name="fv_rand", pkt_offset= "IP.len", add_val=l3_len_fix), - CTRexVmDescFixIpv4(offset = "IP"), # fix checksum - CTRexVmDescWrFlowVar(fv_name="fv_rand", pkt_offset= "UDP.len", add_val=l4_len_fix) - ] - ) - pkt_builder = CScapyTRexPktBuilder(); - - # set packet - pkt_builder.set_packet(pkt); - pkt_builder.add_command ( vm ) - pkt_builder.compile(); - d= pkt_builder.get_vm_data() - pkt_builder.dump_vm_data_as_yaml() - - assert_equal(d['instructions'][0]['max_value'],9230) - assert_equal(d['instructions'][2]['pkt_offset'],16) - assert_equal(d['instructions'][4]['pkt_offset'],38) - - def test_simple_pkt_loader(self): - p=RawPcapReader("stl/golden/basic_imix_golden.cap") - print "" - for pkt in p: - print pkt[1] - print hexdump(str(pkt[0])) - break; - - def test_simple_pkt_loader1(self): - - pkt_builder = CScapyTRexPktBuilder(pkt = "stl/golden/udp_590.cap", build_raw = False); - print "" - pkt_builder.dump_as_hex() - r = pkt_builder.pkt_raw - assert_equal(ord(r[1]),0x50) - assert_equal(ord(r[0]),0x00) - assert_equal(ord(r[0x240]),0x16) - assert_equal(ord(r[0x24d]),0x79) - assert_equal(len(r),590) - - print len(r) - - def test_simple_pkt_loader2(self): - - pkt_builder = CScapyTRexPktBuilder(pkt = "stl/golden/basic_imix_golden.cap"); - assert_equal(pkt_builder.pkt_layers_desc (), "Ethernet:IP:UDP:Raw"); - - def test_simple_pkt_loader3(self): - - #pkt_builder = CScapyTRexPktBuilder(pkt = "stl/golden/basic_imix_golden.cap"); - #r = pkt_builder.pkt_raw - #print "" - #hexdump(str(r)) - - - #print pkt_builder.pkt_layers_desc () - - - #pkt_builder.set_packet(pkt); - - py='\x55'*(64) - - p=Ether()/IP()/UDP(dport=12,sport=1025)/py - pkt_str = str(p); - print "" - hexdump(pkt_str); - scapy_pkt = Ether(pkt_str); - scapy_pkt.show2(); - - def tearDown(self): - pass - - -class CTRexPktBuilderScapy_Test(pkt_bld_general_test.CGeneralPktBld_Test): - - def setUp(self): - pass; - #self.pkt_bld = CTRexPktBuilder() - #self.pkt_bld.add_pkt_layer("l2", dpkt.ethernet.Ethernet()) - #self.pp = pprint.PrettyPrinter(indent=4) - - def tearDown(self): - pass - - -if __name__ == "__main__": - pass - 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 deleted file mode 100644 index cd653895..00000000 --- a/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py +++ /dev/null @@ -1,258 +0,0 @@ - -import outer_packages -from platform_cmd_link import * -import functional_general_test -from nose.tools import assert_equal -from nose.tools import assert_not_equal -from nose.tools import nottest -from nose.plugins.attrib import attr -from unit_tests.trex_general_test import CTRexScenario -from dpkt import pcap -from trex_stl_lib import trex_stl_sim -import sys -import os -import subprocess -import shlex -from threading import Thread - -@attr('run_on_trex') -class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test): - def setUp (self): - self.test_path = os.path.abspath(os.getcwd()) - self.scripts_path = CTRexScenario.scripts_path - - self.verify_exists(os.path.join(self.scripts_path, "bp-sim-64-debug")) - - self.stl_sim = os.path.join(self.scripts_path, "stl-sim") - - self.verify_exists(self.stl_sim) - - self.profiles_path = os.path.join(self.scripts_path, "stl/yaml/") - - self.profiles = {} - self.profiles['imix_3pkt'] = os.path.join(self.profiles_path, "imix_3pkt.yaml") - self.profiles['imix_3pkt_vm'] = os.path.join(self.profiles_path, "imix_3pkt_vm.yaml") - self.profiles['random_size_9k'] = os.path.join(self.profiles_path, "../udp_rand_len_9k.py") - self.profiles['imix_tuple_gen'] = os.path.join(self.profiles_path, "imix_1pkt_tuple_gen.yaml") - - for k, v in self.profiles.iteritems(): - self.verify_exists(v) - - self.valgrind_profiles = [ self.profiles['imix_3pkt_vm'], - self.profiles['random_size_9k'], - self.profiles['imix_tuple_gen'] ] - - self.golden_path = os.path.join(self.test_path,"stl/golden/") - - os.chdir(self.scripts_path) - - - def tearDown (self): - os.chdir(self.test_path) - - - - def get_golden (self, name): - golden = os.path.join(self.golden_path, name) - self.verify_exists(golden) - return golden - - - def verify_exists (self, name): - if not os.path.exists(name): - raise Exception("cannot find '{0}'".format(name)) - - - def compare_caps (self, cap1, cap2, max_diff_sec = 0.01): - with open(cap1, 'r') as f1: - reader1 = pcap.Reader(f1) - pkts1 = reader1.readpkts() - - with open(cap2, 'r') as f2: - reader2 = pcap.Reader(f2) - pkts2 = reader2.readpkts() - - assert_equal(len(pkts1), len(pkts2)) - - for pkt1, pkt2, i in zip(pkts1, pkts2, xrange(1, len(pkts1))): - ts1 = pkt1[0] - ts2 = pkt2[0] - if abs(ts1-ts2) > 0.000005: # 5 nsec - raise AssertionError("TS error: cap files '{0}', '{1}' differ in cap #{2} - '{3}' vs. '{4}'".format(cap1, cap2, i, ts1, ts2)) - - if pkt1[1] != pkt2[1]: - raise AssertionError("RAW error: cap files '{0}', '{1}' differ in cap #{2}".format(cap1, cap2, i)) - - - - def run_sim (self, yaml, output, options = "", silent = False, obj = None): - if output: - user_cmd = "-f {0} -o {1} {2}".format(yaml, output, options) - else: - user_cmd = "-f {0} {1}".format(yaml, options) - - if silent: - user_cmd += " --silent" - - rc = trex_stl_sim.main(args = shlex.split(user_cmd)) - if obj: - obj['rc'] = (rc == 0) - - return (rc == 0) - - - - def run_py_profile_path (self, profile, options,silent = False, do_no_remove=False,compare =True, test_generated=True): - output_cap = "a.pcap" - input_file = os.path.join('stl/', profile) - golden_file = os.path.join('exp',os.path.basename(profile).split('.')[0]+'.pcap'); - if os.path.exists(output_cap): - os.unlink(output_cap) - try: - rc = self.run_sim(input_file, output_cap, options, silent) - assert_equal(rc, True) - #s='cp '+output_cap+' '+golden_file; - #print s - #os.system(s) - - if compare: - self.compare_caps(output_cap, golden_file) - finally: - if not do_no_remove: - os.unlink(output_cap) - if test_generated: - try: - from trex_stl_lib.api import STLProfile # if test is skipped, don't load it - generated_filename = input_file.replace('.py', '_GENERATED.py').replace('.yaml', '_GENERATED.py') - if input_file.endswith('.py'): - profile = STLProfile.load_py(input_file) - elif input_file.endswith('.yaml'): - profile = STLProfile.load_yaml(input_file) - profile.dump_to_code(generated_filename) - rc = self.run_sim(generated_filename, output_cap, options, silent) - assert_equal(rc, True) - - if compare: - self.compare_caps(output_cap, golden_file) - finally: - if not do_no_remove: - os.unlink(generated_filename) - os.unlink(output_cap) - - - def test_stl_profiles (self): - - p = [ - ["udp_1pkt_1mac_override.py","-m 1 -l 50",True], - ["syn_attack.py","-m 1 -l 50",True], # can't compare random now - ["udp_1pkt_1mac.py","-m 1 -l 50",True], - ["udp_1pkt_mac.py","-m 1 -l 50",True], - ["udp_1pkt.py","-m 1 -l 50",True], - ["udp_1pkt_tuple_gen.py","-m 1 -l 50",True], - ["udp_rand_len_9k.py","-m 1 -l 50",True], # can't do the compare - ["udp_1pkt_mpls.py","-m 1 -l 50",True], - ["udp_1pkt_mpls_vm.py","-m 1 ",True], - ["imix.py","-m 1 -l 100",True], - ["udp_inc_len_9k.py","-m 1 -l 100",True], - ["udp_1pkt_range_clients.py","-m 1 -l 100",True], - ["multi_burst_2st_1000pkt.py","-m 1 -l 100",True], - ["pcap.py", "-m 1", True], - ["pcap_with_vm.py", "-m 1", True], - - # YAML test - ["yaml/burst_1000_pkt.yaml","-m 1 -l 100",True], - ["yaml/burst_1pkt_1burst.yaml","-m 1 -l 100",True], - ["yaml/burst_1pkt_vm.yaml","-m 1 -l 100",True], - ["yaml/imix_1pkt.yaml","-m 1 -l 100",True], - ["yaml/imix_1pkt_2.yaml","-m 1 -l 100",True], - ["yaml/imix_1pkt_tuple_gen.yaml","-m 1 -l 100",True], - ["yaml/imix_1pkt_vm.yaml","-m 1 -l 100",True], - ["udp_1pkt_pcap.py","-m 1 -l 10",True], - ["udp_3pkt_pcap.py","-m 1 -l 10",True], - #["udp_1pkt_simple.py","-m 1 -l 3",True], - ["udp_1pkt_pcap_relative_path.py","-m 1 -l 3",True], - ["udp_1pkt_tuple_gen_split.py","-m 1 -c 2 -l 100",True], - ["udp_1pkt_range_clients_split.py","-m 1 -c 2 -l 100",True], - ["udp_1pkt_vxlan.py","-m 1 -c 1 -l 17",True, False], # can't generate: no VXLAN in Scapy, only in profile - ["udp_1pkt_ipv6_in_ipv4.py","-m 1 -c 1 -l 17",True], - ["yaml/imix_3pkt.yaml","-m 50kpps --limit 20 --cores 2",True], - ["yaml/imix_3pkt_vm.yaml","-m 50kpps --limit 20 --cores 2",True], - ["udp_1pkt_simple_mac_dst.py","-m 1 -l 1 ",True], - ["udp_1pkt_simple_mac_src.py","-m 1 -l 1 ",True], - ["udp_1pkt_simple_mac_dst_src.py","-m 1 -l 1 ",True], - ["burst_3st_loop_x_times.py","-m 1 -l 20 ",True], - ["udp_1pkt_mac_step.py","-m 1 -l 20 ",True], - ["udp_1pkt_mac_mask1.py","-m 1 -l 20 ",True] , - ["udp_1pkt_mac_mask2.py","-m 1 -l 20 ",True], - ["udp_1pkt_mac_mask3.py","-m 1 -l 20 ",True], - ["udp_1pkt_simple_test2.py","-m 1 -l 10 ",True], # test split of packet with ip option - ["udp_1pkt_simple_test.py","-m 1 -l 10 ",True], - ["udp_1pkt_mac_mask5.py","-m 1 -l 30 ",True], - ["udp_1pkt_range_clients_split_garp.py","-m 1 -l 50",True] - - - ]; - - - p1 = [ ["udp_1pkt_range_clients_split_garp.py","-m 1 -l 50",True] ] - - - for obj in p: - try: - test_generated = obj[3] - except: # check generated if not said otherwise - test_generated = True - self.run_py_profile_path (obj[0],obj[1],compare =obj[2], test_generated = test_generated, do_no_remove=True) - - - 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 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_wentong1.py', '-m 1 -l 20', True], - ['hlt/hlt_wentong2.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], - ['hlt/hlt_ip_ranges.py', '-m 1 -l 20', True], - ['hlt/hlt_framesize_vm.py', '-m 1 -l 20', True], - ['hlt/hlt_l3_length_vm.py', '-m 1 -l 20', True], - ['hlt/hlt_vlan_default.py', '-m 1 -l 20', True], - ['hlt/hlt_4vlans.py', '-m 1 -l 20', True], - ['hlt/hlt_vlans_vm.py', '-m 1 -l 20', True], - ['hlt/hlt_ipv6_default.py', '-m 1 -l 20', True], - ['hlt/hlt_ipv6_ranges.py', '-m 1 -l 20', True], - ['hlt/hlt_mac_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) - - # valgrind tests - this runs in multi thread as it safe (no output) - def test_valgrind_various_profiles (self): - - print "\n" - threads = [] - for profile in self.valgrind_profiles: - print "\n*** VALGRIND: testing profile '{0}' ***\n".format(profile) - obj = {'t': None, 'rc': None} - t = Thread(target = self.run_sim, - kwargs = {'obj': obj, 'yaml': profile, 'output':None, 'options': "--cores 8 --limit 20 --valgrind", 'silent': True}) - obj['t'] = t - - threads.append(obj) - t.start() - - for obj in threads: - obj['t'].join() - - for obj in threads: - assert_equal(obj['rc'], True) - - - |