def test_client_cfg_nbar(self):
if self.is_loopback:
self.skip('No NBAR on loopback')
-
- self.router.configure_basic_interfaces()
- self.router.config_pbr(mode = "config")
- self.router.config_nbar_pd()
+ if not CTRexScenario.router_cfg['no_dut_config']:
+ 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')
if self.is_loopback:
self.skip('Not relevant on loopback')
- self.router.configure_basic_interfaces(vlan = True)
- self.router.config_pbr(mode = "config", vlan = True)
+ if not CTRexScenario.router_cfg['no_dut_config']:
+ 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')
def setUp(self):
CTRexGeneral_Test.setUp(self)
- if not self.is_loopback:
+ if not self.is_loopback and not CTRexScenario.router_cfg['no_dut_config']:
self.router.configure_basic_interfaces()
self.router.config_pbr(mode = 'config')
self.unzip_client_package()
self.trex.force_kill(confirm = False)
if not self.is_loopback:
print('')
- if not self.stl_trex: # stateful
+ if not self.stl_trex and CTRexScenario.router_cfg['forceCleanConfig']:
self.router.load_clean_config()
self.router.clear_counters()
self.router.clear_packet_drop_stats()
#!/router/bin/python
-from .trex_general_test import CTRexGeneral_Test
+from .trex_general_test import CTRexGeneral_Test, CTRexScenario
from CPlatform import CStaticRouteConfig
from .tests_exceptions import *
#import sys
def test_short_flow(self):
""" short UDP flow with 64B packets, this test with small number of active flows """
# test initializtion
- if not self.is_loopback:
+ if not self.is_loopback and not CTRexScenario.router_cfg['no_dut_config']:
self.router.configure_basic_interfaces()
self.router.config_pbr(mode = "config")
def test_short_flow_high_active(self):
""" short UDP flow with 64B packets, this test with 8M active flows """
# test initializtion
- if not self.is_loopback:
+ if not self.is_loopback and not CTRexScenario.router_cfg['no_dut_config']:
self.router.configure_basic_interfaces()
self.router.config_pbr(mode = "config")
def test_short_flow_high_active2(self):
""" short UDP flow with 64B packets, this test with 8M active flows """
# test initializtion
- if not self.is_loopback:
+ if not self.is_loopback and not CTRexScenario.router_cfg['no_dut_config']:
self.router.configure_basic_interfaces()
self.router.config_pbr(mode = "config")
def test_routing_imix_64(self):
# test initializtion
- if not self.is_loopback:
+ if not self.is_loopback and not CTRexScenario.router_cfg['no_dut_config']:
self.router.configure_basic_interfaces()
self.router.config_pbr(mode = "config")
def test_routing_imix (self):
# test initializtion
- if not self.is_loopback:
+ if not self.is_loopback and not CTRexScenario.router_cfg['no_dut_config']:
self.router.configure_basic_interfaces()
self.router.config_pbr(mode = "config")
if self.is_loopback:
self.skip('In loopback mode the test is same as test_routing_imix')
# test initializtion
- if not self.is_loopback:
+ if not self.is_loopback and not CTRexScenario.router_cfg['no_dut_config']:
self.router.configure_basic_interfaces()
# Configure static routing based on benchmark data input
def test_static_routing_imix_asymmetric (self):
# test initializtion
- if not self.is_loopback:
+ if not self.is_loopback and not CTRexScenario.router_cfg['no_dut_config']:
self.router.configure_basic_interfaces()
# Configure static routing based on benchmark data input
def test_jumbo(self, duration = 100, **kwargs):
- if not self.is_loopback:
+ if not self.is_loopback and not CTRexScenario.router_cfg['no_dut_config']:
self.router.configure_basic_interfaces(mtu = 9216)
self.router.config_pbr(mode = "config")
#!/router/bin/python
-from .trex_general_test import CTRexGeneral_Test
+from .trex_general_test import CTRexGeneral_Test, CTRexScenario
from .tests_exceptions import *
import time
from nose.tools import assert_equal
if self.is_virt_nics:
self.skip('--ipv6 flag does not work correctly in with virtual NICs') # TODO: fix
# test initializtion
- if not self.is_loopback:
+ if not self.is_loopback and not CTRexScenario.router_cfg['no_dut_config']:
self.router.configure_basic_interfaces()
self.router.config_pbr(mode = "config")
if self.is_loopback:
self.skip('The test checks ipv6 drops by device and we are in loopback setup')
# test initializtion
- self.router.configure_basic_interfaces()
-
- # NOT CONFIGURING IPv6 INTENTIONALLY TO GET DROPS!
- self.router.config_pbr(mode = "config")
+ if not CTRexScenario.router_cfg['no_dut_config']:
+ self.router.configure_basic_interfaces()
+ # NOT CONFIGURING IPv6 INTENTIONALLY TO GET DROPS!
+ self.router.config_pbr(mode = "config")
# same params as test_ipv6_simple
mult = self.get_benchmark_param('multiplier', test_name = 'test_ipv6_simple')
#!/router/bin/python
-from .trex_general_test import CTRexGeneral_Test
+from .trex_general_test import CTRexGeneral_Test, CTRexScenario
from .tests_exceptions import *
import time
from CPlatform import CStaticRouteConfig, CNatConfig
def test_nat_learning(self):
# test initializtion
- self.router.configure_basic_interfaces()
-
- stat_route_dict = self.get_benchmark_param('stat_route_dict')
- stat_route_obj = CStaticRouteConfig(stat_route_dict)
- self.router.config_static_routing(stat_route_obj, mode = "config")
-
- self.router.config_nat_verify() # shutdown duplicate interfaces
+ if not CTRexScenario.router_cfg['no_dut_config']:
+ self.router.configure_basic_interfaces()
+ stat_route_dict = self.get_benchmark_param('stat_route_dict')
+ stat_route_obj = CStaticRouteConfig(stat_route_dict)
+ self.router.config_static_routing(stat_route_obj, mode = "config")
+ self.router.config_nat_verify() # shutdown duplicate interfaces
# self.trex.set_yaml_file('cap2/http_simple.yaml')
mult = self.get_benchmark_param('multiplier')
def nat_simple_helper(self, learn_mode=1, traffic_file='cap2/http_simple.yaml'):
# test initializtion
- self.router.configure_basic_interfaces()
-
-
- stat_route_dict = self.get_benchmark_param('stat_route_dict')
- stat_route_obj = CStaticRouteConfig(stat_route_dict)
- self.router.config_static_routing(stat_route_obj, mode = "config")
-
- nat_dict = self.get_benchmark_param('nat_dict')
- nat_obj = CNatConfig(nat_dict)
- self.router.config_nat(nat_obj)
+ if not CTRexScenario.router_cfg['no_dut_config']:
+ self.router.configure_basic_interfaces()
+ stat_route_dict = self.get_benchmark_param('stat_route_dict')
+ stat_route_obj = CStaticRouteConfig(stat_route_dict)
+ self.router.config_static_routing(stat_route_obj, mode = "config")
+ nat_dict = self.get_benchmark_param('nat_dict')
+ nat_obj = CNatConfig(nat_dict)
+ self.router.config_nat(nat_obj)
# self.trex.set_yaml_file('cap2/http_simple.yaml')
mult = self.get_benchmark_param('multiplier')
#!/router/bin/python
-from .trex_general_test import CTRexGeneral_Test
+from .trex_general_test import CTRexGeneral_Test, CTRexScenario
from .tests_exceptions import *
from interfaces_e import IFType
from nose.tools import nottest
def test_nbar_simple(self):
# test initializtion
deviation_compare_value = 0.03 # default value of deviation - 3%
- self.router.configure_basic_interfaces()
- self.router.config_pbr(mode = "config")
- self.router.config_nbar_pd()
+ if not CTRexScenario.router_cfg['no_dut_config']:
+ 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')
# the name intentionally not matches nose default pattern, including the test should be specified explicitly
def NBarLong(self):
- self.router.configure_basic_interfaces()
- self.router.config_pbr(mode = "config")
- self.router.config_nbar_pd()
+ if not CTRexScenario.router_cfg['no_dut_config']:
+ 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')
#!/router/bin/python
-from .trex_general_test import CTRexGeneral_Test
+from .trex_general_test import CTRexGeneral_Test, CTRexScenario
from CPlatform import CStaticRouteConfig, CNatConfig
from .tests_exceptions import *
#import sys
self.fail('Errors in rx_check: %s' % e)
def test_rx_check_sfr(self):
- if not self.is_loopback:
+ if not self.is_loopback and not CTRexScenario.router_cfg['no_dut_config']:
self.router.configure_basic_interfaces()
self.router.config_pbr(mode = 'config')
def test_rx_check_http(self):
- if not self.is_loopback:
+ if not self.is_loopback and not CTRexScenario.router_cfg['no_dut_config']:
# TODO: skip as test_rx_check_http_negative will cover it
#self.skip('This test is covered by test_rx_check_http_negative')
self.router.configure_basic_interfaces()
def test_rx_check_sfr_ipv6(self):
- if not self.is_loopback:
+ if not self.is_loopback and not CTRexScenario.router_cfg['no_dut_config']:
self.router.configure_basic_interfaces()
self.router.config_pbr(mode = 'config')
self.router.config_ipv6_pbr(mode = "config")
def test_rx_check_http_ipv6(self):
- if not self.is_loopback:
+ if not self.is_loopback and not CTRexScenario.router_cfg['no_dut_config']:
self.router.configure_basic_interfaces()
self.router.config_pbr(mode = "config")
self.router.config_ipv6_pbr(mode = "config")
if self.is_loopback:
self.skip('This test uses NAT, not relevant for loopback')
- self.router.configure_basic_interfaces()
- self.router.config_pbr(mode = "config")
+ if not CTRexScenario.router_cfg['no_dut_config']:
+ self.router.configure_basic_interfaces()
+ self.router.config_pbr(mode = "config")
core = self.get_benchmark_param('cores')
mult = self.get_benchmark_param('multiplier')
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))
+ if not CTRexScenario.router_cfg['no_dut_config']:
+ 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
def setUp(self):
CStlGeneral_Test.setUp(self)
print('')
- self.stl_trex.set_service_mode(ports = [0])
self.stl_trex.reset()
+ self.stl_trex.set_service_mode(ports = [0])
def tearDown(self):
CStlGeneral_Test.tearDown(self)
# option to select wanted test by name without file, class etc.
def new_Selector_wantMethod(self, method, orig_Selector_wantMethod = Selector.wantMethod):
result = orig_Selector_wantMethod(self, method)
- return result and (not CTRexScenario.test or CTRexScenario.test in getattr(method, '__name__', ''))
+ return result and (not CTRexScenario.test or filter(lambda t: t in getattr(method, '__name__', ''), CTRexScenario.test.split(',')))
Selector.wantMethod = new_Selector_wantMethod
def new_Selector_wantFunction(self, function, orig_Selector_wantFunction = Selector.wantFunction):
result = orig_Selector_wantFunction(self, function)
- return result and (not CTRexScenario.test or CTRexScenario.test in getattr(function, '__name__', ''))
+ return result and (not CTRexScenario.test or filter(lambda t: t in getattr(function, '__name__', ''), CTRexScenario.test.split(',')))
Selector.wantFunction = new_Selector_wantFunction
parser.add_option('--trex-args', default = '',
help="Additional TRex arguments (--no-watchdog etc.).")
parser.add_option('-t', '--test', type = str,
- help = 'Test name to run (without file, class etc.)')
+ help = 'Test name to run (without file, class etc.). Can choose several names splitted by comma.')
+ parser.add_option('--no-dut-config', action = 'store_true',
+ help = 'Skip the config of DUT to save time. Implies --skip-clean.')
def configure(self, options, conf):
self.kill_running = options.kill_running
self.load_image = options.load_image
self.clean_config = False if options.skip_clean_config else True
+ self.no_dut_config = options.no_dut_config
+ if self.no_dut_config:
+ self.clean_config = False
self.server_logs = options.server_logs
if options.log_path:
self.loggerPath = options.log_path
forceImageReload = self.load_image,
silent_mode = not self.telnet_verbose,
forceCleanConfig = self.clean_config,
+ no_dut_config = self.no_dut_config,
tftp_config_dict = self.configuration.tftp)
try:
CustomLogger.setup_custom_logger('TRexLogger', self.loggerPath)