trex_client_cfg_test.py revision 32366ab4
1#!/router/bin/python
2from .trex_general_test import CTRexGeneral_Test, CTRexScenario
3from .trex_nbar_test import CTRexNbar_Test
4from CPlatform import CStaticRouteConfig
5from .tests_exceptions import *
6#import sys
7import time
8from nose.tools import nottest
9
10# Testing client cfg ARP resolve. Actually, just need to check that TRex run finished with no errors.
11# If resolve will fail, TRex will exit with exit code != 0
12class CTRexClientCfg_Test(CTRexNbar_Test):
13    """This class defines the IMIX testcase of the TRex traffic generator"""
14    def __init__(self, *args, **kwargs):
15        CTRexNbar_Test.__init__(self, *args, **kwargs)
16
17    def setUp(self):
18        if CTRexScenario.setup_name == 'kiwi02':
19            self.skip("Can't run currently on kiwi02")
20        super(CTRexClientCfg_Test, self).setUp() # launch super test class setUp process
21        pass
22
23    def test_client_cfg_nbar(self):
24        # test initializtion
25        if self.is_loopback:
26            return
27        else:
28            self.router.configure_basic_interfaces()
29            self.router.config_pbr(mode = "config")
30            self.router.config_nbar_pd()
31
32        mult = self.get_benchmark_param('multiplier')
33        core = self.get_benchmark_param('cores')
34
35        ret = self.trex.start_trex (
36            c = core,
37            m = mult,
38            nc  = True,
39            p = True,
40            d = 100,
41            f = 'avl/sfr_delay_10_1g.yaml',
42            client_cfg = 'automation/regression/cfg/client_cfg.yaml',
43            l = 1000)
44
45        trex_res = self.trex.sample_to_run_finish()
46        print("\nLATEST RESULT OBJECT:")
47        print(trex_res)
48        self.check_general_scenario_results(trex_res, check_latency = False) # no latency with client config
49        self.match_classification()
50
51    def test_client_cfg_vlan(self):
52        # test initializtion
53        if self.is_loopback:
54            return
55        else:
56            self.router.configure_basic_interfaces(vlan = True)
57            self.router.config_pbr(mode = "config", vlan = True)
58            self.router.config_nbar_pd()
59
60        mult = self.get_benchmark_param('multiplier')
61        core = self.get_benchmark_param('cores')
62
63        ret = self.trex.start_trex (
64            c = core,
65            m = mult,
66            nc  = True,
67            p = True,
68            d = 60,
69            f = 'cap2/dns.yaml',
70            limit_ports = 4,
71            client_cfg = 'automation/regression/cfg/client_cfg_vlan.yaml')
72
73        trex_res = self.trex.sample_to_run_finish()
74        print("\nLATEST RESULT OBJECT:")
75        print(trex_res)
76        self.check_general_scenario_results(trex_res, check_latency = False) # no latency with client config
77
78    def tearDown(self):
79        CTRexGeneral_Test.tearDown(self)
80        pass
81
82if __name__ == "__main__":
83    pass
84