summaryrefslogtreecommitdiffstats
path: root/scripts/automation/regression/stateless_tests
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-05-22 17:06:25 +0300
committerYaroslav Brustinov <ybrustin@cisco.com>2016-05-22 17:06:25 +0300
commit8e230286998bfa7a1dfcefe2493d5bee66d2746a (patch)
treedea698ff60c4819a744802981a818d59d6011547 /scripts/automation/regression/stateless_tests
parent6b12595f08d7d655d398e73753f3dad67982e856 (diff)
regression: add disconnects + delay before running examples + at end of regression
revert profile udp_1ptk_simple.py and add new upd_for_benchmarks.py
Diffstat (limited to 'scripts/automation/regression/stateless_tests')
-rw-r--r--scripts/automation/regression/stateless_tests/stl_client_test.py6
-rwxr-xr-xscripts/automation/regression/stateless_tests/stl_examples_test.py26
-rw-r--r--scripts/automation/regression/stateless_tests/stl_general_test.py30
-rwxr-xr-xscripts/automation/regression/stateless_tests/trex_client_pkg_test.py22
4 files changed, 48 insertions, 36 deletions
diff --git a/scripts/automation/regression/stateless_tests/stl_client_test.py b/scripts/automation/regression/stateless_tests/stl_client_test.py
index 10f56b3f..c5e0c3c6 100644
--- a/scripts/automation/regression/stateless_tests/stl_client_test.py
+++ b/scripts/automation/regression/stateless_tests/stl_client_test.py
@@ -10,9 +10,9 @@ def get_error_in_percentage (golden, value):
def get_stl_profiles ():
profiles_path = os.path.join(CTRexScenario.scripts_path, 'stl/')
- profiles = glob.glob(profiles_path + "/*.py") + glob.glob(profiles_path + "yaml/*.yaml")
-
- return profiles
+ py_profiles = glob.glob(profiles_path + "/*.py")
+ yaml_profiles = glob.glob(profiles_path + "yaml/*.yaml")
+ return py_profiles + yaml_profiles
class STLClient_Test(CStlGeneral_Test):
diff --git a/scripts/automation/regression/stateless_tests/stl_examples_test.py b/scripts/automation/regression/stateless_tests/stl_examples_test.py
index 3f7d7b87..283635a7 100755
--- a/scripts/automation/regression/stateless_tests/stl_examples_test.py
+++ b/scripts/automation/regression/stateless_tests/stl_examples_test.py
@@ -2,22 +2,24 @@
from .stl_general_test import CStlGeneral_Test, CTRexScenario
import os, sys
from misc_methods import run_command
+from time import sleep
+
+
+def setUpModule(self):
+ # examples connect by their own
+ if CTRexScenario.stl_trex.is_connected():
+ CTRexScenario.stl_trex.disconnect()
+ sleep(3)
+
+def tearDownModule():
+ # connect back at end of tests
+ if not CTRexScenario.stl_trex.is_connected():
+ CTRexScenario.stl_trex.connect()
+
class STLExamples_Test(CStlGeneral_Test):
"""This class defines the IMIX testcase of the T-Rex traffic generator"""
- def setUp(self):
- CStlGeneral_Test.setUp(self)
- # examples connect by their own
- if self.is_connected():
- CTRexScenario.stl_trex.disconnect()
-
- @classmethod
- def tearDownClass(cls):
- # connect back at end of tests
- if not cls.is_connected():
- CTRexScenario.stl_trex.connect()
-
def test_stl_examples(self):
examples_dir = '../trex_control_plane/stl/examples'
examples_to_test = [
diff --git a/scripts/automation/regression/stateless_tests/stl_general_test.py b/scripts/automation/regression/stateless_tests/stl_general_test.py
index 54388121..0700e7c2 100644
--- a/scripts/automation/regression/stateless_tests/stl_general_test.py
+++ b/scripts/automation/regression/stateless_tests/stl_general_test.py
@@ -10,18 +10,15 @@ from nose.tools import nottest
class CStlGeneral_Test(CTRexGeneral_Test):
"""This class defines the general stateless testcase of the T-Rex traffic generator"""
- #once for all tests under CStlGeneral_Test
- @classmethod
- def setUpClass(cls):
- cls.stl_trex = CTRexScenario.stl_trex
-
def setUp(self):
+ self.stl_trex = CTRexScenario.stl_trex
CTRexGeneral_Test.setUp(self)
# check basic requirements, should be verified at test_connectivity, here only skip test
if CTRexScenario.stl_init_error:
self.skip(CTRexScenario.stl_init_error)
- def connect(self, timeout = 20):
+ def connect(self, timeout = 100):
+ # need delay and check only because TRex process might be still starting
sys.stdout.write('Connecting')
for i in range(timeout):
try:
@@ -31,20 +28,23 @@ class CStlGeneral_Test(CTRexGeneral_Test):
print('')
return True
except:
- time.sleep(1)
+ time.sleep(0.1)
print('')
return False
- def map_ports(self, timeout = 5):
+ def map_ports(self, timeout = 100):
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)
+ try:
+ 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(0.1)
+ except:
+ time.sleep()
print('')
return False
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 fe666ac3..e94468e2 100755
--- a/scripts/automation/regression/stateless_tests/trex_client_pkg_test.py
+++ b/scripts/automation/regression/stateless_tests/trex_client_pkg_test.py
@@ -2,16 +2,26 @@
from .stl_general_test import CStlGeneral_Test, CTRexScenario
from misc_methods import run_command
from nose.plugins.attrib import attr
+from time import sleep
+
+
+def setUpModule():
+ # examples connect by their own
+ CStlGeneral_Test.unzip_client_package()
+ if CTRexScenario.stl_trex.is_connected():
+ CTRexScenario.stl_trex.disconnect()
+ sleep(3)
+
+def tearDownModule():
+ # connect back at end of tests
+ if not CTRexScenario.stl_trex.is_connected():
+ CTRexScenario.stl_trex.connect()
@attr('client_package')
class CTRexClientPKG_Test(CStlGeneral_Test):
"""This class tests TRex client package"""
- def setUp(self):
- CStlGeneral_Test.setUp(self)
- self.unzip_client_package()
-
def run_client_package_stl_example(self, python_version):
commands = [
'cd %s' % CTRexScenario.scripts_path,
@@ -20,9 +30,9 @@ class CTRexClientPKG_Test(CStlGeneral_Test):
'cd trex_client/stl/examples',
'$PYTHON stl_imix.py -s %s' % self.configuration.trex['trex_name'],
]
- return_code, _, stderr = run_command("bash -ce '%s'" % '; '.join(commands))
+ return_code, stdout, stderr = run_command("bash -ce '%s'" % '; '.join(commands))
if return_code:
- self.fail('Error in running stf_example using %s: %s' % (python_version, stderr))
+ self.fail('Error in running stf_example using %s: %s' % (python_version, [return_code, stdout, stderr]))
def test_client_python2(self):
self.run_client_package_stl_example(python_version = 'python2')