diff options
author | 2016-10-30 22:16:49 +0200 | |
---|---|---|
committer | 2016-10-30 22:16:49 +0200 | |
commit | 0d42a434e92f69ea8856998e3135e6b5e6adbd71 (patch) | |
tree | 28254c7df9f824dd2b900a60e1ad1573d1312fe0 /scripts/automation/regression | |
parent | ed97c1b54740471a5294f7a0d7eb05c8cbce4c6c (diff) |
regression STL: first configure router, then start TRex for IP resolve to work.
Signed-off-by: Yaroslav Brustinov <ybrustin@cisco.com>
Diffstat (limited to 'scripts/automation/regression')
-rw-r--r-- | scripts/automation/regression/stateless_tests/stl_general_test.py | 27 | ||||
-rw-r--r-- | scripts/automation/regression/trex.py | 1 | ||||
-rwxr-xr-x | scripts/automation/regression/trex_unit_test.py | 10 |
3 files changed, 28 insertions, 10 deletions
diff --git a/scripts/automation/regression/stateless_tests/stl_general_test.py b/scripts/automation/regression/stateless_tests/stl_general_test.py index a5fb905e..590733ba 100644 --- a/scripts/automation/regression/stateless_tests/stl_general_test.py +++ b/scripts/automation/regression/stateless_tests/stl_general_test.py @@ -10,7 +10,7 @@ class CStlGeneral_Test(CTRexGeneral_Test): """This class defines the general stateless testcase of the TRex traffic generator""" def setUp(self): - self.stl_trex = CTRexScenario.stl_trex + self.stl_trex = CTRexScenario.stl_trex if CTRexScenario.stl_trex else 'mock' CTRexGeneral_Test.setUp(self) # check basic requirements, should be verified at test_connectivity, here only skip test if CTRexScenario.stl_init_error: @@ -67,15 +67,40 @@ class STLBasic_Test(CStlGeneral_Test): def test_connectivity(self): if not self.is_loopback: try: + sys.stdout.flush() + sys.stdout.write('Configuring DUT... ') + start_time = time.time() if CTRexScenario.router_cfg['forceCleanConfig']: CTRexScenario.router.load_clean_config() CTRexScenario.router.configure_basic_interfaces() CTRexScenario.router.config_pbr(mode = "config") CTRexScenario.router.config_ipv6_pbr(mode = "config") + sys.stdout.write('done. (%ss)\n' % int(time.time() - start_time)) except Exception as e: + print('') CTRexScenario.stl_init_error = 'Could not configure device, err: %s' % e self.fail(CTRexScenario.stl_init_error) return + + try: + sys.stdout.write('Starting TRex... ') + start_time = time.time() + cores = self.configuration.trex.get('trex_cores', 1) + if self.is_virt_nics and cores > 1: + raise Exception('Number of cores should be 1 with virtual NICs') + if not CTRexScenario.no_daemon: + self.trex.start_stateless(c = cores) + self.stl_trex = STLClient(username = 'TRexRegression', + server = self.configuration.trex['trex_name'], + verbose_level = CTRexScenario.json_verbose) + CTRexScenario.stl_trex = self.stl_trex + sys.stdout.write('done. (%ss)\n' % int(time.time() - start_time)) + except Exception as e: + print('') + CTRexScenario.stl_init_error = 'Could not start stateless TRex, err: %s' % e + self.fail(CTRexScenario.stl_init_error) + return + if not self.connect(): CTRexScenario.stl_init_error = 'Client could not connect' self.fail(CTRexScenario.stl_init_error) diff --git a/scripts/automation/regression/trex.py b/scripts/automation/regression/trex.py index aad8f041..7b96f2f8 100644 --- a/scripts/automation/regression/trex.py +++ b/scripts/automation/regression/trex.py @@ -40,6 +40,7 @@ class CTRexScenario: no_daemon = False debug_image = False test = None + json_verbose = False class CTRexRunner: """This is an instance for generating a CTRexRunner""" diff --git a/scripts/automation/regression/trex_unit_test.py b/scripts/automation/regression/trex_unit_test.py index cd19c790..7a6c4260 100755 --- a/scripts/automation/regression/trex_unit_test.py +++ b/scripts/automation/regression/trex_unit_test.py @@ -206,6 +206,7 @@ class CTRexTestConfiguringPlugin(Plugin): CTRexScenario.modes = set(self.modes) CTRexScenario.server_logs = self.server_logs CTRexScenario.debug_image = options.debug_image + CTRexScenario.json_verbose = self.json_verbose if not self.no_daemon: CTRexScenario.trex = CTRexClient(trex_host = self.configuration.trex['trex_name'], verbose = self.json_verbose, @@ -255,15 +256,6 @@ class CTRexTestConfiguringPlugin(Plugin): print('TRex is already running') sys.exit(-1) - if self.stateless: - cores = self.configuration.trex.get('trex_cores', 1) - if 'virt_nics' in self.modes and cores > 1: - raise Exception('Number of cores should be 1 with virtual NICs') - if not self.no_daemon: - client.start_stateless(c = cores) - CTRexScenario.stl_trex = STLClient(username = 'TRexRegression', - server = self.configuration.trex['trex_name'], - verbose_level = self.json_verbose) if 'loopback' not in self.modes: CTRexScenario.router_cfg = dict(config_dict = self.configuration.router, forceImageReload = self.load_image, |