diff options
author | 2016-03-14 13:48:40 +0200 | |
---|---|---|
committer | 2016-03-14 13:48:40 +0200 | |
commit | 22f33006471cfed556e6987f88d3d9f7e532687a (patch) | |
tree | d82c114419afa32076cb2edb687a1137aa3967f7 /scripts/automation/regression | |
parent | d82201e2da3beb0e81e0c8ba30600d87f1b8276f (diff) | |
parent | 22e06f3c3532890ad336341c279012afc0710a9d (diff) |
merge cleanup
Diffstat (limited to 'scripts/automation/regression')
-rwxr-xr-x | scripts/automation/regression/hltapi_playground.py | 34 | ||||
-rw-r--r-- | scripts/automation/regression/stateless_tests/stl_general_test.py | 56 | ||||
-rwxr-xr-x | scripts/automation/regression/trex_unit_test.py | 5 |
3 files changed, 68 insertions, 27 deletions
diff --git a/scripts/automation/regression/hltapi_playground.py b/scripts/automation/regression/hltapi_playground.py index 793b0282..b790fe25 100755 --- a/scripts/automation/regression/hltapi_playground.py +++ b/scripts/automation/regression/hltapi_playground.py @@ -55,12 +55,34 @@ if __name__ == "__main__": port_handle = res['port_handle'] print('Connected, got port handles %s' % port_handle) 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 hlt_client.traffic_control(action = 'poll') + + print 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', + #stream_id = 1, + ) + print hlt_client.traffic_control(action = 'poll') + print hlt_client.traffic_control(action = 'run') + print hlt_client.traffic_control(action = 'poll') + wait_with_progress(2) + print hlt_client.traffic_control(action = 'poll') + print hlt_client.traffic_control(action = 'stop') + print hlt_client.traffic_control(action = 'poll') + print hlt_client.traffic_stats(mode = 'aggregate') + print hlt_client.traffic_control(action = 'clear_stats') + wait_with_progress(1) + print hlt_client.traffic_stats(mode = 'aggregate') + + wait_with_progress(1) + print hlt_client.traffic_stats(mode = 'aggregate') + wait_with_progress(1) + print hlt_client.traffic_stats(mode = 'aggregate') + wait_with_progress(1) + print hlt_client.traffic_stats(mode = 'aggregate') #print res #print hlt_client._streams_history #print hlt_client.trex_client._STLClient__get_all_streams(port_id = port_handle[0]) diff --git a/scripts/automation/regression/stateless_tests/stl_general_test.py b/scripts/automation/regression/stateless_tests/stl_general_test.py index 435c7eea..64e93510 100644 --- a/scripts/automation/regression/stateless_tests/stl_general_test.py +++ b/scripts/automation/regression/stateless_tests/stl_general_test.py @@ -21,18 +21,41 @@ class CStlGeneral_Test(CTRexGeneral_Test): if CTRexScenario.stl_init_error: self.skip(CTRexScenario.stl_init_error) - @staticmethod - def connect(timeout = 20): + def connect(self, timeout = 20): sys.stdout.write('Connecting') for i in range(timeout): try: sys.stdout.write('.') sys.stdout.flush() - CTRexScenario.stl_trex.connect() - return + self.stl_trex.connect() + print '' + return True except: time.sleep(1) - CTRexScenario.stl_trex.connect() + print '' + return False + + def map_ports(self, timeout = 5): + sys.stdout.write('Mapping ports') + for i in range(timeout): + sys.stdout.write('.') + sys.stdout.flush() + CTRexScenario.stl_ports_map = stl_map_ports(self.stl_trex) + if self.verify_bidirectional(CTRexScenario.stl_ports_map): + print '' + return True + time.sleep(1) + print '' + return False + + # verify all the ports are bidirectional + @staticmethod + def verify_bidirectional(mapping_dict): + if len(mapping_dict['unknown']): + return False + if len(mapping_dict['bi']) * 2 == len(mapping_dict['map']): + return True + return False @staticmethod def get_port_count(): @@ -51,18 +74,13 @@ class STLBasic_Test(CStlGeneral_Test): CTRexScenario.router.configure_basic_interfaces() CTRexScenario.router.config_pbr(mode = "config") - CTRexScenario.stl_init_error = 'Client could not connect' - self.connect() - print '' - try: - stl_map_ports(CTRexScenario.stl_trex) - except: - pass - time.sleep(5) - CTRexScenario.stl_init_error = 'Client could not map ports' - CTRexScenario.stl_ports_map = stl_map_ports(CTRexScenario.stl_trex) - CTRexScenario.stl_init_error = 'Could not determine bidirectional ports' - print 'Ports mapping: %s' % CTRexScenario.stl_ports_map - if not len(CTRexScenario.stl_ports_map['bi']): - raise STLError('No bidirectional ports') + err = 'Client could not connect' + CTRexScenario.stl_init_error = err + if not self.connect(): + self.fail(err) + err = 'Client could not map ports' + CTRexScenario.stl_init_error = err + if not self.map_ports(): + self.fail(err) + print 'Got ports mapping: %s' % CTRexScenario.stl_ports_map CTRexScenario.stl_init_error = None diff --git a/scripts/automation/regression/trex_unit_test.py b/scripts/automation/regression/trex_unit_test.py index 67b74fea..c8565c19 100755 --- a/scripts/automation/regression/trex_unit_test.py +++ b/scripts/automation/regression/trex_unit_test.py @@ -326,13 +326,14 @@ if __name__ == "__main__": additional_args = ['--stf'] + CTRexScenario.test_types['stateful_tests'] if xml_arg: additional_args += ['--with-xunit', xml_arg.replace('.xml', '_stateful.xml')] - result = result and nose.run(argv = nose_argv + additional_args, addplugins = [red_nose, config_plugin]) + result = nose.run(argv = nose_argv + additional_args, addplugins = [red_nose, config_plugin]) and result if len(CTRexScenario.test_types['stateless_tests']): additional_args = ['--stl', 'stateless_tests/stl_general_test.py:STLBasic_Test.test_connectivity'] + CTRexScenario.test_types['stateless_tests'] if xml_arg: additional_args += ['--with-xunit', xml_arg.replace('.xml', '_stateless.xml')] - result = result and nose.run(argv = nose_argv + additional_args, addplugins = [red_nose, config_plugin]) + result = nose.run(argv = nose_argv + additional_args, addplugins = [red_nose, config_plugin]) and result except Exception as e: + result = False print e finally: save_setup_info() |