diff options
author | 2017-01-15 17:09:53 +0200 | |
---|---|---|
committer | 2017-01-16 17:14:55 +0200 | |
commit | cb8b3426b97f9e0e527541b2ac3f28f89aaf7ab8 (patch) | |
tree | 4fd73c6037a9839f67ac2014f1ab60e8ef8ddf52 /scripts/automation/regression | |
parent | e1538ec8fac6b17b609cad66fe2662df1b6cd20b (diff) |
refactor regression tests so that nbar test will not run twice
Signed-off-by: Ido Barnea <ibarnea@cisco.com>
Diffstat (limited to 'scripts/automation/regression')
-rw-r--r-- | scripts/automation/regression/stateful_tests/trex_client_cfg_test.py | 35 | ||||
-rwxr-xr-x | scripts/automation/regression/stateful_tests/trex_nbar_test.py | 24 |
2 files changed, 28 insertions, 31 deletions
diff --git a/scripts/automation/regression/stateful_tests/trex_client_cfg_test.py b/scripts/automation/regression/stateful_tests/trex_client_cfg_test.py index 45113cab..158f59b9 100644 --- a/scripts/automation/regression/stateful_tests/trex_client_cfg_test.py +++ b/scripts/automation/regression/stateful_tests/trex_client_cfg_test.py @@ -1,6 +1,6 @@ #!/router/bin/python from .trex_general_test import CTRexGeneral_Test, CTRexScenario -from .trex_nbar_test import CTRexNbar_Test +from .trex_nbar_test import CTRexNbarBase from CPlatform import CStaticRouteConfig from .tests_exceptions import * #import sys @@ -9,26 +9,25 @@ from nose.tools import nottest # Testing client cfg ARP resolve. Actually, just need to check that TRex run finished with no errors. # If resolve will fail, TRex will exit with exit code != 0 -class CTRexClientCfg_Test(CTRexNbar_Test): +class CTRexClientCfg_Test(CTRexNbarBase): """This class defines the IMIX testcase of the TRex traffic generator""" def __init__(self, *args, **kwargs): - CTRexNbar_Test.__init__(self, *args, **kwargs) + CTRexNbarBase.__init__(self, *args, **kwargs) def setUp(self): if CTRexScenario.setup_name == 'kiwi02': self.skip("Can't run currently on kiwi02") + super(CTRexClientCfg_Test, self).setUp() # launch super test class setUp process - pass def test_client_cfg_nbar(self): - # test initializtion if self.is_loopback: - return - else: - self.router.configure_basic_interfaces() - self.router.config_pbr(mode = "config") - self.router.config_nbar_pd() - + self.skip('No NBAR on loopback') + + self.router.configure_basic_interfaces() + self.router.config_pbr(mode = "config") + self.router.config_nbar_pd() + mult = self.get_benchmark_param('multiplier') core = self.get_benchmark_param('cores') @@ -49,13 +48,11 @@ class CTRexClientCfg_Test(CTRexNbar_Test): self.match_classification() def test_client_cfg_vlan(self): - # test initializtion if self.is_loopback: - return - else: - self.router.configure_basic_interfaces(vlan = True) - self.router.config_pbr(mode = "config", vlan = True) - self.router.config_nbar_pd() + self.skip('Not relevant on loopback') + + self.router.configure_basic_interfaces(vlan = True) + self.router.config_pbr(mode = "config", vlan = True) mult = self.get_benchmark_param('multiplier') core = self.get_benchmark_param('cores') @@ -74,9 +71,9 @@ class CTRexClientCfg_Test(CTRexNbar_Test): print("\nLATEST RESULT OBJECT:") print(trex_res) self.check_general_scenario_results(trex_res, check_latency = False) # no latency with client config - + def tearDown(self): - CTRexGeneral_Test.tearDown(self) + CTRexNbarBase.tearDown(self) pass if __name__ == "__main__": diff --git a/scripts/automation/regression/stateful_tests/trex_nbar_test.py b/scripts/automation/regression/stateful_tests/trex_nbar_test.py index 6611ac96..a98da9ac 100755 --- a/scripts/automation/regression/stateful_tests/trex_nbar_test.py +++ b/scripts/automation/regression/stateful_tests/trex_nbar_test.py @@ -5,18 +5,7 @@ from interfaces_e import IFType from nose.tools import nottest from misc_methods import print_r -class CTRexNbar_Test(CTRexGeneral_Test): - """This class defines the NBAR testcase of the TRex traffic generator""" - def __init__(self, *args, **kwargs): - super(CTRexNbar_Test, self).__init__(*args, **kwargs) - self.unsupported_modes = ['loopback'] # obviously no NBar in loopback - - def setUp(self): - super(CTRexNbar_Test, self).setUp() # launch super test class setUp process -# self.router.kill_nbar_flows() - self.router.clear_cft_counters() - self.router.clear_nbar_stats() - +class CTRexNbarBase(CTRexGeneral_Test): def match_classification (self): nbar_benchmark = self.get_benchmark_param("nbar_classification") test_classification = self.router.get_nbar_stats() @@ -52,6 +41,17 @@ class CTRexNbar_Test(CTRexGeneral_Test): if missmatchFlag: self.fail(missmatchMsg) +class CTRexNbar_Test(CTRexNbarBase): + """This class defines the NBAR testcase of the TRex traffic generator""" + def __init__(self, *args, **kwargs): + super(CTRexNbar_Test, self).__init__(*args, **kwargs) + self.unsupported_modes = ['loopback'] # obviously no NBar in loopback + + def setUp(self): + super(CTRexNbar_Test, self).setUp() # launch super test class setUp process +# self.router.kill_nbar_flows() + self.router.clear_cft_counters() + self.router.clear_nbar_stats() def test_nbar_simple(self): # test initializtion |