From 8c3c982275c7aa19860e36f3af54c961a9f6e2a3 Mon Sep 17 00:00:00 2001 From: Yaroslav Brustinov Date: Tue, 31 Jan 2017 11:20:30 +0200 Subject: regression: fill-in some of ELK fields Change-Id: I0dced2fb88bcccabdfd8aef745d8408b389099a8 Signed-off-by: Yaroslav Brustinov --- .../regression/stateful_tests/trex_general_test.py | 40 ++++++++++------- .../regression/stateless_tests/stl_general_test.py | 10 +++++ scripts/automation/regression/trex_unit_test.py | 52 +++++++++++----------- 3 files changed, 61 insertions(+), 41 deletions(-) (limited to 'scripts') diff --git a/scripts/automation/regression/stateful_tests/trex_general_test.py b/scripts/automation/regression/stateful_tests/trex_general_test.py index dc3f9943..62243da7 100755 --- a/scripts/automation/regression/stateful_tests/trex_general_test.py +++ b/scripts/automation/regression/stateful_tests/trex_general_test.py @@ -39,6 +39,7 @@ from .tests_exceptions import * from platform_cmd_link import * import unittest from glob import glob +from datetime import datetime, timedelta def setUpModule(module): pass @@ -72,21 +73,6 @@ class CTRexGeneral_Test(unittest.TestCase): self.is_VM = True if 'VM' in self.modes else False if not CTRexScenario.is_init: - #update elk const object - if self.elk: - setup = CTRexScenario.elk_info['info']['setup'] - - if self.is_loopback : - setup['dut'] = 'loopback' - else: - setup['dut'] = 'router' - - if self.is_VM: - setup['baremetal'] = False - setup['hypervisor'] = 'ESXi' #TBD - else: - setup['baremetal'] = True - if self.trex and not self.no_daemon: # stateful CTRexScenario.trex_version = self.trex.get_trex_version() if not self.is_loopback: @@ -122,6 +108,30 @@ class CTRexGeneral_Test(unittest.TestCase): if self.modes: print(termstyle.green('\t!!!\tRunning with modes: %s, not suitable tests will be skipped.\t!!!' % list(self.modes))) + #update elk const object + if self.elk: + timediff = timedelta(hours=2) # workaround to get IL timezone + date_str = CTRexScenario.trex_version['Date'].strip() + timestamp = datetime.strptime(date_str, '%b %d %Y , %H:%M:%S') - timediff + + img = CTRexScenario.elk_info['info']['image'] + img['sha'] = CTRexScenario.trex_version['Git SHA'] + img['build_time'] = timestamp.strftime("%Y-%m-%d %H:%M:%S") + img['version'] = CTRexScenario.trex_version['Version'] + + setup = CTRexScenario.elk_info['info']['setup'] + if self.is_loopback : + setup['dut'] = 'loopback' + else: + setup['dut'] = 'router' + + if self.is_VM: + setup['baremetal'] = False + setup['hypervisor'] = 'ESXi' #TBD + else: + setup['baremetal'] = True + + CTRexScenario.is_init = True print(termstyle.green("Done instantiating TRex scenario!\n")) diff --git a/scripts/automation/regression/stateless_tests/stl_general_test.py b/scripts/automation/regression/stateless_tests/stl_general_test.py index 2a6b72fd..7d44d04a 100644 --- a/scripts/automation/regression/stateless_tests/stl_general_test.py +++ b/scripts/automation/regression/stateless_tests/stl_general_test.py @@ -115,3 +115,13 @@ class STLBasic_Test(CStlGeneral_Test): self.fail(CTRexScenario.stl_init_error) return print('Got ports mapping: %s' % CTRexScenario.stl_ports_map) + + #update elk const object + if self.elk: + stl_info = self.stl_trex.get_server_system_info() + setup = CTRexScenario.elk_info['info']['setup'] + setup['drv-name'] = stl_info['ports'][0]['driver'] + setup['nic-ports'] = stl_info['port_count'] + setup['nic-speed'] = str(self.stl_trex.get_port_info(0)) + + diff --git a/scripts/automation/regression/trex_unit_test.py b/scripts/automation/regression/trex_unit_test.py index 2a544711..de77385e 100755 --- a/scripts/automation/regression/trex_unit_test.py +++ b/scripts/automation/regression/trex_unit_test.py @@ -426,22 +426,22 @@ class CTRexTestConfiguringPlugin(Plugin): img['version'] = "v2.14" #TBD need to fix img['formal'] = False - setup={} - - setup['distro']='None' #TBD 'Ubunto14.03' - setup['kernel']='None' #TBD '2.6.12' - setup['baremetal']=True #TBD - setup['hypervisor']='None' #TBD - setup['name']=CTRexScenario.setup_name - - setup['cpu-sockets']=0 #TBD 2 - setup['cores']=0 #TBD 16 - setup['cpu-speed']=-1 #TBD 3.5 - - setup['dut'] ='None' #TBD 'loopback' - setup['drv-name']='None' #TBD 'mlx5' - setup['nic-ports']=0 #TBD 2 - setup['total-nic-ports']=0 #TBD 2 + setup = {} + + setup['distro'] = 'None' #TBD 'Ubunto14.03' + setup['kernel'] = 'None' #TBD '2.6.12' + setup['baremetal'] = True #TBD + setup['hypervisor'] = 'None' #TBD + setup['name'] = CTRexScenario.setup_name + + setup['cpu-sockets'] = 0 #TBD 2 + setup['cores'] = 0 #TBD 16 + setup['cpu-speed'] = -1 #TBD 3.5 + + setup['dut'] = 'None' #TBD 'loopback' + setup['drv-name'] = 'None' #TBD 'mlx5' + setup['nic-ports'] = 0 #TBD 2 + setup['total-nic-ports'] = 0 #TBD 2 setup['nic-speed'] = "None" #"40GbE" TBD @@ -451,9 +451,9 @@ class CTRexTestConfiguringPlugin(Plugin): elk_info['info'] =info; - elk_info['timestamp']=timestamp.strftime("%Y-%m-%d %H:%M:%S") # need to update it - elk_info['build_id']=os.environ.get('BUILD_ID') - elk_info['scenario']=os.environ.get('SCENARIO') + elk_info['timestamp'] = timestamp.strftime("%Y-%m-%d %H:%M:%S") # need to update it + elk_info['build_id'] = os.environ.get('BUILD_ID') + elk_info['scenario'] = os.environ.get('SCENARIO') CTRexScenario.elk_info = elk_info @@ -608,6 +608,13 @@ if __name__ == "__main__": if xml_arg: additional_args += ['--with-xunit', xml_arg.replace('.xml', '_functional.xml')] result = nose.run(argv = nose_argv + additional_args, addplugins = addplugins) + 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 not test_client_package: + additional_args.extend(['-a', '!client_package']) + if xml_arg: + additional_args += ['--with-xunit', xml_arg.replace('.xml', '_stateless.xml')] + result = nose.run(argv = nose_argv + additional_args, addplugins = addplugins) and result if len(CTRexScenario.test_types['stateful_tests']): additional_args = ['--stf'] if '--warmup' in sys.argv: @@ -618,13 +625,6 @@ if __name__ == "__main__": if xml_arg: additional_args += ['--with-xunit', xml_arg.replace('.xml', '_stateful.xml')] result = nose.run(argv = nose_argv + additional_args, addplugins = addplugins) 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 not test_client_package: - additional_args.extend(['-a', '!client_package']) - if xml_arg: - additional_args += ['--with-xunit', xml_arg.replace('.xml', '_stateless.xml')] - result = nose.run(argv = nose_argv + additional_args, addplugins = addplugins) and result #except Exception as e: # result = False # print(e) -- cgit 1.2.3-korg