示例#1
0
def tcpdump_route1_test():
    print ""
    print "    === tcpdump_route1_test ==="
    print ""
    print " --------------------------------------------------------------------- "
    print " |   client(eth1) -- router(eth1) -- router(eth3) --> server(eth1)    |"
    print " |   set up tcpdump (or tshark) on router(eth1) and router(eth1)      |"
    print " --------------------------------------------------------------------- "
    print ""

    # do_ssh_back(router_eth0, ssh_port, "tcpdump  -w /var/tmp/network_tcpdump_route1_test.dump -i eth2 -i eth1  2>&1 &")
    do_ssh_back(router_eth0, ssh_port, "tshark -s 150 -i eth1 -i eth2 -n -w /var/tmp/network_tcpdump_route1_test.dump tcp 2>&1 &")

    do_ssh(client_eth0, ssh_port, "tc qdisc add dev "+ client_eth1 +" root netem delay 500ms > /dev/null 2>&1")
    do_ssh(client_eth0, ssh_port, "tc qdisc show dev "+ client_eth1)
    time.sleep(5)

    do_ssh(client_eth0, ssh_port, "curl " +server_eth1+ " > /dev/null 2>&1")

    time.sleep(10)

    # do_ssh(router_eth0, ssh_port, "tshark -r /var/tmp/network_tcpdump_route1_test.dump")
    do_ssh(router_eth0, ssh_port, "tcpdump -r /var/tmp/network_tcpdump_route1_test.dump")
    do_ssh(router_eth0, ssh_port, "pkill tshark ; pkill tcpdump")
    do_ssh(router_eth0, ssh_port, "rm -f /var/tmp/network_tcpdump_route1_test.dump")

    return
示例#2
0
def bigdata_route1_test():
    print ""
    print "    === bigdata_route1_test ==="
    print ""
    print " --------------------------------------------------------------------- "
    print " |   client(eth1) -- router(eth1) -- router(eth3) --> server(eth1)    |"
    print " |   wget BIGDATA FILE from server to client                          |"
    print " --------------------------------------------------------------------- "
    print ""

    # do_ssh_back(router_eth0, ssh_port, "tcpdump  -w /var/tmp/network_tcpdump_route1_test.dump -i eth2 -i eth1  2>&1 &")
    do_ssh_back(router_eth0, ssh_port, "tshark -s 150 -i eth1 -i eth2 -n -w /var/tmp/network_tcpdump_route1_test.dump tcp 2>&1 &")

    time.sleep(5)

    do_ssh(server_eth0, ssh_port, "mkdir -p /var/www/html/bigdata")
    do_ssh(server_eth0, ssh_port, "dd if=/dev/zero of=/var/www/html/bigdata/1M bs=1M count=1")

    do_ssh(client_eth0, ssh_port, "mkdir -p /root/bigdata/")
    do_ssh(client_eth0, ssh_port, "wget -P /root/bigdata " +server_eth1+ "/bigdata/1M  > /dev/null 2>&1")

    time.sleep(10)

    # do_ssh(router_eth0, ssh_port, "tshark -r /var/tmp/network_tcpdump_route1_test.dump")
    do_ssh(router_eth0, ssh_port, "tcpdump -r /var/tmp/network_tcpdump_route1_test.dump")

    do_ssh(router_eth0, ssh_port, "pkill tshark ; pkill tcpdump")
    do_ssh(router_eth0, ssh_port, "rm -f /var/tmp/network_tcpdump_route1_test.dump")

    do_ssh(client_eth0, ssh_port, "rm -f /root/bigdata/")
    do_ssh(server_eth0, ssh_port, "rm -rf /var/www/html/bigdata")

    return
示例#3
0
def qperf_tcp_lat_route1_test():
    print ""
    print "    === qperf_tcp_lat_route1_test ==="
    print ""
    print " --------------------------------------------------------------------- "
    print " |   client(eth1) -- router(eth1) -- router(eth3) --> server(eth1)    |"
    print " |   set up qperf on client and server                                |"
    print " --------------------------------------------------------------------- "
    print ""

    do_ssh_back(server_eth0, ssh_port, "qperf &")

    time.sleep(3)

    do_ssh(client_eth0, ssh_port, "qperf -v " + server_eth1 + " tcp_lat")

    do_ssh(server_eth0, ssh_port, "pkill qperf")

    return
示例#4
0
def qperf_tcp_lat_route1_test():
    print ""
    print "    === qperf_tcp_lat_route1_test ==="
    print ""
    print " --------------------------------------------------------------------- "
    print " |   client(eth1) -- router(eth1) -- router(eth3) --> server(eth1)    |"
    print " |   set up qperf on client and server                                |"
    print " --------------------------------------------------------------------- "
    print ""

    do_ssh_back(server_eth0, ssh_port, "qperf &")

    time.sleep(3)

    do_ssh(client_eth0, ssh_port, "qperf -v " + server_eth1 + " tcp_lat")

    do_ssh(server_eth0, ssh_port, "pkill qperf")

    return
示例#5
0
def bigdata_route1_test():
    print ""
    print "    === bigdata_route1_test ==="
    print ""
    print " --------------------------------------------------------------------- "
    print " |   client(eth1) -- router(eth1) -- router(eth3) --> server(eth1)    |"
    print " |   wget BIGDATA FILE from server to client                          |"
    print " --------------------------------------------------------------------- "
    print ""

    # do_ssh_back(router_eth0, ssh_port, "tcpdump  -w /var/tmp/network_tcpdump_route1_test.dump -i eth2 -i eth1  2>&1 &")
    do_ssh_back(
        router_eth0, ssh_port,
        "tshark -s 150 -i eth1 -i eth2 -n -w /var/tmp/network_tcpdump_route1_test.dump tcp 2>&1 &"
    )

    time.sleep(5)

    do_ssh(server_eth0, ssh_port, "mkdir -p /var/www/html/bigdata")
    do_ssh(server_eth0, ssh_port,
           "dd if=/dev/zero of=/var/www/html/bigdata/1M bs=1M count=1")

    do_ssh(client_eth0, ssh_port, "mkdir -p /root/bigdata/")
    do_ssh(
        client_eth0, ssh_port, "wget -P /root/bigdata " + server_eth1 +
        "/bigdata/1M  > /dev/null 2>&1")

    time.sleep(10)

    # do_ssh(router_eth0, ssh_port, "tshark -r /var/tmp/network_tcpdump_route1_test.dump")
    do_ssh(router_eth0, ssh_port,
           "tcpdump -r /var/tmp/network_tcpdump_route1_test.dump")

    do_ssh(router_eth0, ssh_port, "pkill tshark ; pkill tcpdump")
    do_ssh(router_eth0, ssh_port,
           "rm -f /var/tmp/network_tcpdump_route1_test.dump")

    do_ssh(client_eth0, ssh_port, "rm -f /root/bigdata/")
    do_ssh(server_eth0, ssh_port, "rm -rf /var/www/html/bigdata")

    return
示例#6
0
def iperf_route1_test():
    print ""
    print "    === iperf_tcp_lat_route1_test ==="
    print ""
    print " --------------------------------------------------------------------- "
    print " |   client(eth1) -- router(eth1) -- router(eth3) --> server(eth1)    |"
    print " |   set up qperf on client and server                                |"
    print " --------------------------------------------------------------------- "
    print ""

    # do_ssh_back(router_eth0, ssh_port, "tcpdump -w /var/tmp/client.dump -i eth2 2>&1 &")
    do_ssh_back(server_eth0, ssh_port, "iperf -s &")

    time.sleep(3)

    do_ssh(client_eth0, ssh_port, "iperf -i 2 -c " + server_eth1)

    time.sleep(10)

    do_ssh(server_eth0, ssh_port, "pkill iperf")

    return
示例#7
0
def iperf_route1_test():
    print ""
    print "    === iperf_tcp_lat_route1_test ==="
    print ""
    print " --------------------------------------------------------------------- "
    print " |   client(eth1) -- router(eth1) -- router(eth3) --> server(eth1)    |"
    print " |   set up qperf on client and server                                |"
    print " --------------------------------------------------------------------- "
    print ""

    # do_ssh_back(router_eth0, ssh_port, "tcpdump -w /var/tmp/client.dump -i eth2 2>&1 &")
    do_ssh_back(server_eth0, ssh_port, "iperf -s &")

    time.sleep(3)

    do_ssh(client_eth0, ssh_port, "iperf -i 2 -c " +server_eth1)

    time.sleep(10)

    do_ssh(server_eth0, ssh_port, "pkill iperf")

    return