summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/automation/regression/CPlatform.py6
-rwxr-xr-xscripts/automation/regression/stateful_tests/trex_general_test.py3
-rwxr-xr-xscripts/automation/regression/stateless_tests/trex_client_pkg_test.py6
-rwxr-xr-xscripts/automation/regression/trex_unit_test.py28
-rwxr-xr-xscripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py24
5 files changed, 43 insertions, 24 deletions
diff --git a/scripts/automation/regression/CPlatform.py b/scripts/automation/regression/CPlatform.py
index 36e87821..f69e93ab 100755
--- a/scripts/automation/regression/CPlatform.py
+++ b/scripts/automation/regression/CPlatform.py
@@ -174,7 +174,8 @@ class CPlatform(object):
# finish handling pre-config cache
pre_commit_set = list(pre_commit_set)
-# pre_commit_set.append('exit')
+ if len(pre_commit_set):
+ pre_commit_set.append('exit')
pre_commit_cache.add('CONF', pre_commit_set )
# deploy the configs (order is important!)
self.cmd_link.run_command( [pre_commit_cache, cache] )
@@ -290,7 +291,8 @@ class CPlatform(object):
# finish handling pre-config cache
pre_commit_set = list(pre_commit_set)
-# pre_commit_set.append('exit')
+ if len(pre_commit_set):
+ pre_commit_set.append('exit')
pre_commit_cache.add('CONF', pre_commit_set )
# assign generated config list to cache
cache.add('CONF', conf_t_command_set)
diff --git a/scripts/automation/regression/stateful_tests/trex_general_test.py b/scripts/automation/regression/stateful_tests/trex_general_test.py
index 12c822f2..7ac49728 100755
--- a/scripts/automation/regression/stateful_tests/trex_general_test.py
+++ b/scripts/automation/regression/stateful_tests/trex_general_test.py
@@ -149,8 +149,9 @@ class CTRexGeneral_Test(unittest.TestCase):
self.fail("CPU is too low (%s%%), can't verify performance in such low CPU%%." % cpu_util )
cores = self.get_benchmark_param('cores')
+ ports_count = trex_res.get_ports_count()
trex_tx_bps = sum(trex_res.get_value_list("trex-global.data.m_tx_bps")[-4:-1]) / 3.0
- test_norm_cpu = 200.0 * trex_tx_bps / (cores * cpu_util * 1e6)
+ test_norm_cpu = 200.0 * trex_tx_bps / (ports_count * cores * cpu_util * 1e6)
print("TRex CPU utilization: %g%%, norm_cpu is : %d Mb/core" % (round(cpu_util), int(test_norm_cpu)))
diff --git a/scripts/automation/regression/stateless_tests/trex_client_pkg_test.py b/scripts/automation/regression/stateless_tests/trex_client_pkg_test.py
index 64d5000e..fe666ac3 100755
--- a/scripts/automation/regression/stateless_tests/trex_client_pkg_test.py
+++ b/scripts/automation/regression/stateless_tests/trex_client_pkg_test.py
@@ -12,7 +12,7 @@ class CTRexClientPKG_Test(CStlGeneral_Test):
CStlGeneral_Test.setUp(self)
self.unzip_client_package()
- def run_client_package_stf_example(self, python_version):
+ def run_client_package_stl_example(self, python_version):
commands = [
'cd %s' % CTRexScenario.scripts_path,
'source find_python.sh --%s' % python_version,
@@ -25,7 +25,7 @@ class CTRexClientPKG_Test(CStlGeneral_Test):
self.fail('Error in running stf_example using %s: %s' % (python_version, stderr))
def test_client_python2(self):
- self.run_client_package_stf_example(python_version = 'python2')
+ self.run_client_package_stl_example(python_version = 'python2')
def test_client_python3(self):
- self.run_client_package_stf_example(python_version = 'python3')
+ self.run_client_package_stl_example(python_version = 'python3')
diff --git a/scripts/automation/regression/trex_unit_test.py b/scripts/automation/regression/trex_unit_test.py
index 5d29ff31..65126b04 100755
--- a/scripts/automation/regression/trex_unit_test.py
+++ b/scripts/automation/regression/trex_unit_test.py
@@ -117,9 +117,12 @@ class CTRexTestConfiguringPlugin(Plugin):
parser.add_option('--log-path', '--log_path', action='store',
dest='log_path',
help='Specify path for the tests` log to be saved at. Once applied, logs capturing by nose will be disabled.') # Default is CURRENT/WORKING/PATH/trex_log/trex_log.log')
- parser.add_option('--verbose-mode', '--verbose_mode', action="store_true", default = False,
- dest="verbose_mode",
- help="Print RPC command and router commands.")
+ parser.add_option('--json-verbose', '--json_verbose', action="store_true", default = False,
+ dest="json_verbose",
+ help="Print JSON-RPC commands.")
+ parser.add_option('--telnet-verbose', '--telnet_verbose', action="store_true", default = False,
+ dest="telnet_verbose",
+ help="Print telnet commands and responces.")
parser.add_option('--server-logs', '--server_logs', action="store_true", default = False,
dest="server_logs",
help="Print server side (TRex and trex_daemon) logs per test.")
@@ -155,12 +158,13 @@ class CTRexTestConfiguringPlugin(Plugin):
self.collect_only = options.collect_only
if self.collect_only:
return
- self.functional = options.functional
- self.stateless = options.stateless
- self.stateful = options.stateful
- self.pkg = options.pkg
- self.no_ssh = options.no_ssh
- self.verbose_mode = options.verbose_mode
+ self.functional = options.functional
+ self.stateless = options.stateless
+ self.stateful = options.stateful
+ self.pkg = options.pkg
+ self.no_ssh = options.no_ssh
+ self.json_verbose = options.json_verbose
+ self.telnet_verbose = options.telnet_verbose
if self.functional and (not self.pkg or self.no_ssh):
return
if CTRexScenario.setup_dir and options.config_path:
@@ -215,7 +219,7 @@ class CTRexTestConfiguringPlugin(Plugin):
if self.stateful:
if not self.no_ssh:
trex_remote_command(self.configuration.trex, STATEFUL_RUN_COMMAND)
- CTRexScenario.trex = CTRexClient(trex_host = self.configuration.trex['trex_name'], verbose = self.verbose_mode)
+ CTRexScenario.trex = CTRexClient(trex_host = self.configuration.trex['trex_name'], verbose = self.json_verbose)
elif self.stateless:
if not self.no_ssh:
cores = self.configuration.trex.get('trex_cores', 1)
@@ -224,11 +228,11 @@ class CTRexTestConfiguringPlugin(Plugin):
trex_remote_command(self.configuration.trex, './t-rex-64 -i -c %s' % cores, background = True)
CTRexScenario.stl_trex = STLClient(username = 'TRexRegression',
server = self.configuration.trex['trex_name'],
- verbose_level = self.verbose_mode)
+ verbose_level = self.json_verbose)
if 'loopback' not in self.modes:
CTRexScenario.router_cfg = dict(config_dict = self.configuration.router,
forceImageReload = self.load_image,
- silent_mode = not self.verbose_mode,
+ silent_mode = not self.telnet_verbose,
forceCleanConfig = self.clean_config,
tftp_config_dict = self.configuration.tftp)
try:
diff --git a/scripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py b/scripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py
index 27428e69..f5887120 100755
--- a/scripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py
+++ b/scripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py
@@ -1094,7 +1094,7 @@ class CTRexResult(object):
if not self.is_valid_hist():
return None
else:
- return CTRexResult.__get_value_by_path(self._history[len(self._history)-1], tree_path_to_key, regex)
+ return CTRexResult.__get_value_by_path(self._history[-1], tree_path_to_key, regex)
def get_value_list (self, tree_path_to_key, regex = None, filter_none = True):
"""
@@ -1145,11 +1145,23 @@ class CTRexResult(object):
+ an empty dictionary if history is empty.
"""
- history_size = len(self._history)
- if history_size != 0:
- return self._history[len(self._history) - 1]
- else:
- return {}
+ if len(self._history):
+ return self._history[-1]
+ return {}
+
+ def get_ports_count(self):
+ """
+ Returns number of ports based on TRex result
+
+ :return:
+ + number of ports in TRex result
+ + -1 if history is empty.
+ """
+
+ if not len(self._history):
+ return -1
+ return len(self.__get_value_by_path(self._history[-1], 'trex-global.data', 'opackets-\d+'))
+
def update_result_data (self, latest_dump):
"""