def configure(self, options, conf): self.collect_only = options.collect_only self.functional = options.functional self.stateless = options.stateless self.astf = options.astf self.stateful = options.stateful self.wireless = options.wireless 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 self.save_coredump = options.save_coredump 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 or self.wireless: return self.enabled = True 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.no_daemon = options.no_daemon CTRexScenario.server_logs = self.server_logs CTRexScenario.debug_image = options.debug_image CTRexScenario.json_verbose = self.json_verbose additional_args = CTRexScenario.configuration.trex.get('trex_add_args', '') if not self.no_daemon: CTRexScenario.trex = CTRexClient(trex_host = CTRexScenario.configuration.trex['trex_name'], verbose = self.json_verbose, debug_image = options.debug_image, trex_args = options.trex_args + ' ' + additional_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 and not (CTRexScenario.GAManager and CTRexScenario.elk): 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 ()
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()