def linear_latency_test(local_filename_to_save_to,
                        num_switches_per_controller,
                        num_ops_per_switch=DEFAULT_NUM_OPS_TO_RUN):
    run_linear_test(
        LATENCY_TEST_JAR_NAME,
        local_filename_to_save_to,
        num_ops_per_switch,
        JAVA_COMMAND_STRING,
        MAX_EXPERIMENT_WAIT_TIME_SECONDS,
        num_switches_per_controller)
def linear_tunnel_test(local_filename_to_save_to,
                       num_switches_per_controller,
                       num_ops_per_switch=DEFAULT_NUM_OPS_TO_RUN):
    run_linear_test(
        TUNNEL_TEST_JAR_NAME,
        local_filename_to_save_to,
        num_ops_per_switch,
        'java -jar %s %s %i %i -1 %s',
        MAX_EXPERIMENT_WAIT_TIME_SECONDS,
        num_switches_per_controller)
def linear_error_test(local_filename_to_save_to,
                      num_switches_per_controller,
                      num_ops_per_switch=DEFAULT_NUM_OPS_TO_RUN,
                      failure_probability=DEFAULT_FAILURE_PROBABILITY):
    run_linear_test(
        ERROR_TEST_JAR_NAME,
        local_filename_to_save_to,
        num_ops_per_switch,
        'java -jar %s %s %i %i ' + str(failure_probability) +' -1 %s',
        MAX_EXPERIMENT_WAIT_TIME_SECONDS,
        num_switches_per_controller)
def linear_speculation_test(local_filename_to_save_to,
                            num_switches_per_controller,
                            should_speculate_arg,
                            num_ops_per_switch=DEFAULT_NUM_OPS_TO_RUN):
    
    run_linear_test(
        SPECULATION_TEST_JAR_NAME,
        local_filename_to_save_to,
        num_ops_per_switch,
        'java -jar %s %s %i %i ' + should_speculate_arg + ' -1 %s',
        MAX_EXPERIMENT_WAIT_TIME_SECONDS,
        num_switches_per_controller)
def linear_fairness_test(local_filename_to_save_to,
                         num_switches_per_controller,
                         wound_wait,
                         num_ops_per_switch=DEFAULT_NUM_OPS_TO_RUN):
    wound_wait_string = 'true' if wound_wait else 'false'
    run_linear_test(
        FAIRNESS_TEST_JAR_NAME,
        local_filename_to_save_to,
        num_ops_per_switch,
        'java -jar %s %s %i %i false ' + wound_wait_string + ' %s',
        MAX_EXPERIMENT_WAIT_TIME_SECONDS,
        num_switches_per_controller,
        # last worker should perform writes instead of just reads on
        # switches.
        'java -jar %s %s %i %i true ' + wound_wait_string + ' %s')