Ejemplo n.º 1
0
 def __init__(self, test_configs, run_list):
     self.test_run_info = {}
     self.test_configs = test_configs
     self.testbed_configs = self.test_configs[keys.Config.key_testbed.value]
     self.testbed_name = self.testbed_configs[
         keys.Config.key_testbed_name.value]
     start_time = logger.get_log_file_timestamp()
     self.id = "{}@{}".format(self.testbed_name, start_time)
     # log_path should be set before parsing configs.
     l_path = os.path.join(
         self.test_configs[keys.Config.key_log_path.value],
         self.testbed_name, start_time)
     self.log_path = os.path.abspath(l_path)
     logger.setup_test_logger(self.log_path, self.testbed_name)
     self.log = logging.getLogger()
     self.controller_registry = {}
     if self.test_configs.get(keys.Config.key_random.value):
         test_case_iterations = self.test_configs.get(
             keys.Config.key_test_case_iterations.value, 10)
         self.log.info(
             "Campaign randomizer is enabled with test_case_iterations %s",
             test_case_iterations)
         self.run_list = config_parser.test_randomizer(
             run_list, test_case_iterations=test_case_iterations)
         self.write_test_campaign()
     else:
         self.run_list = run_list
     self.results = records.TestResult()
     self.running = False
Ejemplo n.º 2
0
    def start_capture(self,
                      override_configs=None,
                      additional_args=None,
                      duration=None,
                      packet_count=None):
        """See base class documentation
        """
        if self._process is not None:
            raise sniffer.InvalidOperationError(
                "Trying to start a sniff while another is still running!")
        capture_dir = os.path.join(self._logger.log_path,
                                   "Sniffer-{}".format(self._interface))
        os.makedirs(capture_dir, exist_ok=True)
        self._capture_file_path = os.path.join(
            capture_dir,
            "capture_{}.pcap".format(logger.get_log_file_timestamp()))

        self._pre_capture_config(override_configs)
        _, self._temp_capture_file_path = tempfile.mkstemp(suffix=".pcap")

        cmd = self._get_command_line(additional_args=additional_args,
                                     duration=duration,
                                     packet_count=packet_count)

        self._process = utils.start_standing_subprocess(cmd)
        return sniffer.ActiveCaptureContext(self, duration)
Ejemplo n.º 3
0
 def __init__(self, test_configs, run_list):
     self.test_run_config = test_configs
     self.testbed_name = self.test_run_config.testbed_name
     start_time = logger.get_log_file_timestamp()
     self.id = '{}@{}'.format(self.testbed_name, start_time)
     self.test_run_config.log_path = os.path.abspath(
         os.path.join(self.test_run_config.log_path, self.testbed_name,
                      start_time))
     logger.setup_test_logger(self.log_path, self.testbed_name)
     self.log = logging.getLogger()
     self.test_run_config.summary_writer = records.TestSummaryWriter(
         os.path.join(self.log_path, records.OUTPUT_FILE_SUMMARY))
     self.run_list = run_list
     self.dump_config()
     self.results = records.TestResult()
     self.running = False
     self.usage_publisher = UsageMetadataPublisher()
 def __init__(self, test_configs, run_list):
     self.test_run_info = {}
     self.test_configs = test_configs
     self.testbed_configs = self.test_configs[keys.Config.key_testbed.value]
     self.testbed_name = self.testbed_configs[
         keys.Config.key_testbed_name.value]
     start_time = logger.get_log_file_timestamp()
     self.id = "{}@{}".format(self.testbed_name, start_time)
     # log_path should be set before parsing configs.
     l_path = os.path.join(
         self.test_configs[keys.Config.key_log_path.value],
         self.testbed_name, start_time)
     self.log_path = os.path.abspath(l_path)
     logger.setup_test_logger(self.log_path, self.testbed_name)
     self.log = logging.getLogger()
     self.controller_registry = {}
     self.controller_destructors = {}
     self.run_list = run_list
     self.results = records.TestResult()
     self.running = False