def configure(self, options, conf): 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 if self.functional and (not self.pkg or self.no_ssh): return if CTRexScenario.setup_dir and options.config_path: raise Exception('Please either define --cfg or use env. variable SETUP_DIR, not both.') if not options.config_path and CTRexScenario.setup_dir: options.config_path = CTRexScenario.setup_dir if not options.config_path: raise Exception('Please specify path to config.yaml using --cfg parameter or env. variable SETUP_DIR') self.configuration = misc_methods.load_complete_config_file(os.path.join(options.config_path, 'config.yaml')) self.configuration.trex['trex_name'] = address_to_ip(self.configuration.trex['trex_name']) # translate hostname to ip self.benchmark = misc_methods.load_benchmark_config_file(os.path.join(options.config_path, 'benchmark.yaml')) self.enabled = True self.modes = self.configuration.trex.get('modes', []) self.kill_running = options.kill_running self.load_image = options.load_image self.clean_config = False if options.skip_clean_config else True self.server_logs = options.server_logs if options.log_path: self.loggerPath = options.log_path # initialize CTRexScenario global testing class, to be used by all tests CTRexScenario.configuration = self.configuration CTRexScenario.benchmark = self.benchmark CTRexScenario.modes = set(self.modes) CTRexScenario.server_logs = self.server_logs
def configure(self, options, conf): self.functional = options.functional self.collect_only = options.collect_only if self.functional or self.collect_only: return if CTRexScenario.setup_dir and options.config_path: raise Exception( 'Please either define --cfg or use env. variable SETUP_DIR, not both.' ) if not options.config_path and CTRexScenario.setup_dir: options.config_path = CTRexScenario.setup_dir if options.config_path: self.configuration = misc_methods.load_complete_config_file( os.path.join(options.config_path, 'config.yaml')) self.benchmark = misc_methods.load_benchmark_config_file( os.path.join(options.config_path, 'benchmark.yaml')) self.enabled = True else: raise Exception( 'Please specify path to config.yaml using --cfg parameter or env. variable SETUP_DIR' ) self.modes = self.configuration.trex.get('modes', []) self.kill_running = options.kill_running self.load_image = options.load_image self.verbose_mode = options.verbose_mode self.clean_config = False if options.skip_clean_config else True self.server_logs = options.server_logs if options.log_path: self.loggerPath = options.log_path
def configure(self, options, conf): self.collect_only = options.collect_only self.functional = options.functional self.stateless = options.stateless self.stateful = options.stateful self.pkg = options.pkg self.json_verbose = options.json_verbose self.telnet_verbose = options.telnet_verbose self.no_daemon = options.no_daemon CTRexScenario.test = options.test if self.collect_only or self.functional: return if CTRexScenario.setup_dir and options.config_path: raise Exception('Please either define --cfg or use env. variable SETUP_DIR, not both.') if not options.config_path and CTRexScenario.setup_dir: options.config_path = CTRexScenario.setup_dir if not options.config_path: raise Exception('Please specify path to config.yaml using --cfg parameter or env. variable SETUP_DIR') options.config_path = options.config_path.rstrip('/') CTRexScenario.setup_name = os.path.basename(options.config_path) self.configuration = misc_methods.load_complete_config_file(os.path.join(options.config_path, 'config.yaml')) self.configuration.trex['trex_name'] = address_to_ip(self.configuration.trex['trex_name']) # translate hostname to ip self.benchmark = misc_methods.load_benchmark_config_file(os.path.join(options.config_path, 'benchmark.yaml')) self.enabled = True self.modes = self.configuration.trex.get('modes', []) self.kill_running = options.kill_running self.load_image = options.load_image self.clean_config = False if options.skip_clean_config else True self.server_logs = options.server_logs if options.log_path: self.loggerPath = options.log_path # initialize CTRexScenario global testing class, to be used by all tests CTRexScenario.configuration = self.configuration CTRexScenario.no_daemon = options.no_daemon CTRexScenario.benchmark = self.benchmark CTRexScenario.modes = set(self.modes) CTRexScenario.server_logs = self.server_logs CTRexScenario.debug_image = options.debug_image CTRexScenario.json_verbose = self.json_verbose if not self.no_daemon: CTRexScenario.trex = CTRexClient(trex_host = self.configuration.trex['trex_name'], verbose = self.json_verbose, debug_image = options.debug_image, trex_args = options.trex_args) if not CTRexScenario.trex.check_master_connectivity(): print('Could not connect to master daemon') sys.exit(-1) if options.ga and CTRexScenario.setup_name: CTRexScenario.GAManager = GAmanager_Regression(GoogleID = 'UA-75220362-3', AnalyticsUserID = CTRexScenario.setup_name, QueueSize = 100, Timeout = 3, # seconds UserPermission = 1, BlockingMode = 0, appName = 'TRex', appVer = CTRexScenario.trex_version)
def configure(self, options, conf): self.collect_only = options.collect_only self.functional = options.functional self.stateless = options.stateless self.stateful = options.stateful self.pkg = options.pkg self.json_verbose = options.json_verbose self.telnet_verbose = options.telnet_verbose self.no_daemon = options.no_daemon CTRexScenario.test = options.test if self.collect_only or self.functional: return if CTRexScenario.setup_dir and options.config_path: raise Exception('Please either define --cfg or use env. variable SETUP_DIR, not both.') if not options.config_path and CTRexScenario.setup_dir: options.config_path = CTRexScenario.setup_dir if not options.config_path: raise Exception('Please specify path to config.yaml using --cfg parameter or env. variable SETUP_DIR') self.configuration = misc_methods.load_complete_config_file(os.path.join(options.config_path, 'config.yaml')) self.configuration.trex['trex_name'] = address_to_ip(self.configuration.trex['trex_name']) # translate hostname to ip self.benchmark = misc_methods.load_benchmark_config_file(os.path.join(options.config_path, 'benchmark.yaml')) self.enabled = True self.modes = self.configuration.trex.get('modes', []) self.kill_running = options.kill_running self.load_image = options.load_image self.clean_config = False if options.skip_clean_config else True self.server_logs = options.server_logs if options.log_path: self.loggerPath = options.log_path # initialize CTRexScenario global testing class, to be used by all tests CTRexScenario.configuration = self.configuration CTRexScenario.no_daemon = options.no_daemon CTRexScenario.benchmark = self.benchmark CTRexScenario.modes = set(self.modes) CTRexScenario.server_logs = self.server_logs CTRexScenario.debug_image = options.debug_image if not self.no_daemon: CTRexScenario.trex = CTRexClient(trex_host = self.configuration.trex['trex_name'], verbose = self.json_verbose, debug_image = options.debug_image, trex_args = options.trex_args) if not CTRexScenario.trex.check_master_connectivity(): print('Could not connect to master daemon') sys.exit(-1) if options.ga and CTRexScenario.setup_name: CTRexScenario.GAManager = GAmanager(GoogleID = 'UA-75220362-4', UserID = CTRexScenario.setup_name, QueueSize = 100, Timeout = 5, # seconds UserPermission = 1, BlockingMode = 1, appName = 'TRex', appVer = '1.11.232')
def configure(self, options, conf): self.functional = options.functional if self.functional: return if CTRexScenario.setup_dir and options.config_path: raise Exception('Please either define --cfg or use env. variable SETUP_DIR, not both.') if not options.config_path and CTRexScenario.setup_dir: options.config_path = CTRexScenario.setup_dir if options.config_path: self.configuration = misc_methods.load_complete_config_file(os.path.join(options.config_path, 'config.yaml')) self.benchmark = misc_methods.load_benchmark_config_file(os.path.join(options.config_path, 'benchmark.yaml')) self.enabled = True else: raise Exception('Please specify path to config.yaml using --cfg parameter or env. variable SETUP_DIR') self.modes = self.configuration.trex.get('modes', []) self.kill_running = options.kill_running self.load_image = options.load_image self.verbose_mode = options.verbose_mode self.clean_config = False if options.skip_clean_config else True self.server_logs = options.server_logs if options.log_path: self.loggerPath = options.log_path
options, _ = parser.parse_known_args(sys.argv) trex_tests = options.stateless or options.stateful or options.astf or options.bird if not CTRexScenario.is_test_list and (trex_tests or not (trex_tests or options.functional or options.wireless)): if CTRexScenario.setup_dir and options.config_path: fatal('Please either define --cfg or use env. variable SETUP_DIR, not both.') if not options.config_path and CTRexScenario.setup_dir: options.config_path = CTRexScenario.setup_dir if not options.config_path: fatal('Please specify path to config.yaml using --cfg parameter or env. variable SETUP_DIR') options.config_path = options.config_path.rstrip('/') CTRexScenario.setup_name = os.path.basename(options.config_path) CTRexScenario.configuration = misc_methods.load_complete_config_file(os.path.join(options.config_path, 'config.yaml')) CTRexScenario.config_dict = misc_methods.load_object_config_file(os.path.join(options.config_path, 'config.yaml')) CTRexScenario.configuration.trex['trex_name'] = address_to_ip(CTRexScenario.configuration.trex['trex_name']) # translate hostname to ip CTRexScenario.benchmark = misc_methods.load_benchmark_config_file(os.path.join(options.config_path, 'benchmark.yaml')) CTRexScenario.modes = set(CTRexScenario.configuration.trex.get('modes', [])) is_wlc = 'wlc' in CTRexScenario.modes is_bird = 'bird' in CTRexScenario.modes addplugins = [RedNose(), cfg_plugin] result = True try: import coverage except ImportError: pass else: CTRexScenario.coverage = coverage.coverage(include = ['*topo.py']) CTRexScenario.coverage.start()
def configure(self, options, conf): self.collect_only = options.collect_only self.functional = options.functional self.stateless = options.stateless self.stateful = options.stateful self.pkg = options.pkg self.restart_daemon = options.restart_daemon self.json_verbose = options.json_verbose self.telnet_verbose = options.telnet_verbose self.no_daemon = options.no_daemon CTRexScenario.test = options.test if self.no_daemon and (self.pkg or self.restart_daemon): fatal( 'You have specified both --no-daemon and either --pkg or --restart-daemon at same time.' ) if self.no_daemon and self.stateful: fatal("Can't run stateful without daemon.") if self.collect_only or self.functional: return if CTRexScenario.setup_dir and options.config_path: fatal( 'Please either define --cfg or use env. variable SETUP_DIR, not both.' ) if not options.config_path and CTRexScenario.setup_dir: options.config_path = CTRexScenario.setup_dir if not options.config_path: fatal( 'Please specify path to config.yaml using --cfg parameter or env. variable SETUP_DIR' ) options.config_path = options.config_path.rstrip('/') CTRexScenario.setup_name = os.path.basename(options.config_path) self.configuration = misc_methods.load_complete_config_file( os.path.join(options.config_path, 'config.yaml')) self.configuration.trex['trex_name'] = address_to_ip( self.configuration.trex['trex_name']) # translate hostname to ip self.benchmark = misc_methods.load_benchmark_config_file( os.path.join(options.config_path, 'benchmark.yaml')) self.enabled = True self.modes = self.configuration.trex.get('modes', []) 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 # initialize CTRexScenario global testing class, to be used by all tests CTRexScenario.configuration = self.configuration CTRexScenario.no_daemon = options.no_daemon CTRexScenario.benchmark = self.benchmark CTRexScenario.modes = set(self.modes) CTRexScenario.server_logs = self.server_logs CTRexScenario.debug_image = options.debug_image CTRexScenario.json_verbose = self.json_verbose if not self.no_daemon: CTRexScenario.trex = CTRexClient( trex_host=self.configuration.trex['trex_name'], verbose=self.json_verbose, debug_image=options.debug_image, trex_args=options.trex_args) if self.pkg or self.restart_daemon: if not CTRexScenario.trex.check_master_connectivity(): fatal('Could not connect to master daemon') if options.ga and CTRexScenario.setup_name: CTRexScenario.GAManager = GAmanager_Regression( GoogleID=CTRexScenario.global_cfg['google']['id'], AnalyticsUserID=CTRexScenario.setup_name, QueueSize=CTRexScenario.global_cfg['google']['queue_size'], Timeout=CTRexScenario.global_cfg['google'] ['timeout'], # seconds UserPermission=1, BlockingMode=CTRexScenario.global_cfg['google']['blocking'], appName='TRex', appVer=CTRexScenario.trex_version) CTRexScenario.elk = trex_elk.TRexEs( CTRexScenario.global_cfg['elk']['server'], CTRexScenario.global_cfg['elk']['port']) self.set_cont_elk_info()