Example #1
0
  def close(self, control_flow, simulation_cfg, skip_mcs_cfg=False):
    # First, insert a WaitTime, in case there was a controller crash
    self.log_input_event(WaitTime(1.0, time=self.last_time))
    # Flush the json input log
    self.output.close()

    # Grab the dataplane trace path (might be pre-defined, or Fuzzed)
    if self.dp_events != []:
      # If the Fuzzer was injecting random traffic, write the dataplane trace
      tg.write_trace_log(self.dp_events, self.dp_trace_path)
      simulation_cfg.dataplane_trace_path = self.dp_trace_path

    # Write the config files
    path_templates = [(self.replay_cfg_path, replay_config_template)]
    if not skip_mcs_cfg:
      path_templates.append((self.mcs_cfg_path, mcs_config_template))

    wait_on_deterministic_values = False
    if hasattr(control_flow.sync_callback, "record_deterministic_values"):
      wait_on_deterministic_values = control_flow.sync_callback.record_deterministic_values

    for path, template in path_templates:
      with open(path, 'w') as cfg_out:
        config_string = template % (str(simulation_cfg),
                                    self.output_path,
                                    str(wait_on_deterministic_values),
                                    "'%s'" % str(control_flow.invariant_check_name))
        cfg_out.write(config_string)
Example #2
0
    def close(self, simulation_cfg, skip_mcs_cfg=False):
        # First, insert a WaitTime, in case there was a controller crash
        self.log_input_event(WaitTime(1.0, time=self.last_time))
        # Flush the json input log
        self.output.close()

        # Grab the dataplane trace path (might be pre-defined, or Fuzzed)
        if self.dp_events != []:
            # If the Fuzzer was injecting random traffic, write the dataplane trace
            tg.write_trace_log(self.dp_events, self.dp_trace_path)
            simulation_cfg.dataplane_trace_path = self.dp_trace_path

        # Write the config files
        path_templates = [(self.replay_cfg_path, replay_config_template)]
        if not skip_mcs_cfg:
            path_templates.append((self.mcs_cfg_path, mcs_config_template))

        for path, template in path_templates:
            with open(path, 'w') as cfg_out:
                config_string = template % (str(simulation_cfg),
                                            self.output_path,
                                            self.mcs_output_path)
                cfg_out.write(config_string)
Example #3
0
  def close(self, simulation_cfg, skip_mcs_cfg=False):
    # First, insert a WaitTime, in case there was a controller crash
    self.log_input_event(WaitTime(1.0, time=self.last_time))
    # Flush the json input log
    self.output.close()

    # Grab the dataplane trace path (might be pre-defined, or Fuzzed)
    if self.dp_events != []:
      # If the Fuzzer was injecting random traffic, write the dataplane trace
      tg.write_trace_log(self.dp_events, self.dp_trace_path)
      simulation_cfg.dataplane_trace_path = self.dp_trace_path

    # Write the config files
    path_templates = [(self.replay_cfg_path, replay_config_template)]
    if not skip_mcs_cfg:
      path_templates.append((self.mcs_cfg_path, mcs_config_template))

    for path, template in path_templates:
      with open(path, 'w') as cfg_out:
        config_string = template % (str(simulation_cfg),
                                    self.output_path,
                                    self.mcs_output_path)
        cfg_out.write(config_string)