def start_reverse_test(server_ip=DEFAULT_SERVER, cir=10):
    logger = getStreamLogger()
    try:
        client_utils.file_setter(LOGFILE)
        logger = getFileLogger(LOGFILE)
    except:
        pass

    ret_val = asyncio.get_event_loop().create_task(reverse_client(logger, server_ip, cir))
    return ret_val
Example #2
0
def bandwidth_measure(server_ip, rtt):
    try:
        fname = "tempfiles/normal_mode/bb_temp_file"
        client_utils.file_setter(fname)
        output_file = open(fname, "r+")
        bb_proc = start_bandwidth_measure(server_ip, output_file)
        bb_proc.wait()
        output_file.close()
        return end_bandwidth_measure(rtt, fname)
    except:
        GLOBAL_LOGGER.error("baseline bandwidth failed")
        raise
    return
Example #3
0
def mtu_process(server_ip, udp_port):
    try:
        fname = "tempfiles/normal_mode/mtu_temp_file"
        client_utils.file_setter(fname)
        output_file = open(fname, "r+")
        mtu_proc = start_mtu_process(server_ip + ":" + udp_port, output_file)
        mtu_proc.wait()
        output_file.close()
        mtu = end_mtu_process(fname)
        return mtu
    except:
        GLOBAL_LOGGER.error("plpmtu failed")
        raise
    return
def measure_throughput(filename, server_ip, recv_wnd, rtt, mss, connections,
                       actual_rwnd):
    try:
        fname = "tempfiles/normal_mode/thpt_temp_file"
        client_utils.file_setter(fname)
        output_file = open(fname, "w+")
        shark_proc, thpt_proc = \
                start_throughput_measure(filename, server_ip, recv_wnd, mss, connections, output_file)
        thpt_proc.wait()
        shark_proc.kill()
        return end_throughput_measure(rtt, recv_wnd, fname, actual_rwnd)
    except:
        GLOBAL_LOGGER.error("throughput test failed")
        raise
    return
Example #5
0
def measure_rtt(server_ip, client_ip, mtu):
    try:
        pcap_name = "tempfiles/normal_mode/rtt_pcap.pcapng"
        fname = "tempfiles/normal_mode/rtt_temp_file"
        client_utils.file_setter(fname)
        client_utils.file_setter(pcap_name)
        open(fname, "w+").close()
        rtt_proc = start_baseline_measure(server_ip, client_ip, mtu, fname,
                                          pcap_name)
        rtt_proc.wait()
        rtt = end_baseline_measure(fname)
        return rtt
    except:
        GLOBAL_LOGGER.error("RTT failed")
        raise
    return
def start_throughput_measure(filename, server_ip, recv_window, mss,
                             connections, o_file):
    shark_proc = None
    throughput_proc = None
    try:
        client_utils.file_setter(filename)
        shark_proc = subprocess.Popen(["./segmentation_toggler.sh"],
                                      stdout=subprocess.PIPE)
        shark_proc = subprocess.Popen(
            ["tshark", "-w", filename, "-a", "duration:30"],
            stdout=subprocess.PIPE)
        throughput_proc = subprocess.Popen(
            [
                "iperf3",
                "--client",
                server_ip,
                "--time",
                "10",
                "--port",
                str(THPT_NORMAL_PORT),
                "--window",
                str(recv_window),
                "--parallel",
                str(connections),
                "--set-mss",
                str(mss),
                #"--window", "59K",
                #"--parallel", "10",
                #"--set-mss", "1460",
                "--format",
                "m",
                "--bandwidth",
                "100M"
            ],
            stdout=o_file,
            stderr=o_file)
        GLOBAL_LOGGER.debug("Throughput test started")
    except:
        GLOBAL_LOGGER.error("FAILED TO START THROUGHPUT TEST")
        try:
            shark_proc.kill()
            throughput_proc.kill()
        except:
            pass
        raise
    return shark_proc, throughput_proc
Example #7
0
def window_scan(filename, client_ip, server_ip, recv_window, rtt, mss,
                connections, actual_rwnd):
    average_thpt = None
    ideal_thpt = None
    window_efficiency = None
    window_rtt = None
    tshark_proc = None
    thpt_proc = None
    actual_ideal = None
    try:
        client_utils.file_setter(filename)
        tshark_proc = start_window_shark(filename)
        fname = "tempfiles/normal_mode/" + filename + ".temp"
        client_utils.file_setter(fname)
        output_file = open(fname, "w+")
        thpt_proc = start_window_throughput(server_ip, recv_window, mss,
                                            connections, output_file)
        thpt_proc.wait()
        output_file.close()
        average_thpt, ideal_thpt = end_window_throughput\
                (thpt_proc, rtt, recv_window, fname)
        actual_ideal = (int(actual_rwnd) * 8 / (float(rtt) / 1000)) / (10**6)
        end_window_shark(tshark_proc)
        try:
            GLOBAL_LOGGER.debug("analyzing efficiency ...")
            _, _, window_efficiency = analyze_efficiency(filename, client_ip)
            GLOBAL_LOGGER.debug("analyzing buffer delay ...")
            window_rtt, _ = analyze_buffer_delay(filename, client_ip,
                                                 server_ip, 1)
        except:
            GLOBAL_LOGGER.error("error doing window_eff/window rtt")
            raise
    except:
        try:
            tshark_proc.kill()
            thpt_proc.kill()
        except:
            pass
        GLOBAL_LOGGER.error("error doing window scan")
        raise
    try:
        tshark_proc.kill()
    except:
        pass
    return average_thpt, ideal_thpt, window_efficiency, window_rtt, actual_ideal