-
Notifications
You must be signed in to change notification settings - Fork 51
/
tune_bw_rtt_loss.py
50 lines (41 loc) · 3.47 KB
/
tune_bw_rtt_loss.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import os
def do_args():
import argparse
p = argparse.ArgumentParser()
p.add_argument("-b", "--bandwidth", dest="bw", default="100Mbit/s",
help="URL of rabbitmq server")
p.add_argument("-d","--delay", dest="delay", default="30ms",
help="URL of rabbitmq server")
p.add_argument("-q","--buffer", dest="queue", default="50slots",
help="user name for the rabbitmq server")
p.add_argument("-l", '--loss', dest='loss', default="0",
help="password for rabbitmq server")
return p.parse_args()
def main():
opts = do_args()
if opts.loss != "0":
print "I am here"
os.system("ssh -t -t -o StrictHostKeyChecking=no [email protected] \"~/setloss.sh {}\"".format(opts.loss))
os.system("ssh -t -t -o StrictHostKeyChecking=no [email protected] \"~/setloss.sh {}\"".format(opts.loss))
elif opts.loss == "0":
print "iiiiiii"
os.system("ssh -t -t -o StrictHostKeyChecking=no [email protected] \"sudo iptables -F\"")
os.system("ssh -t -t -o StrictHostKeyChecking=no [email protected] \"sudo iptables -F\"")
os.system("ssh -t -t -o StrictHostKeyChecking=no [email protected] \"~/setpipe.sh {} {} {} {}\"".format("bw",
opts.bw,
"delay",
opts.delay))
if opts.queue != "50slots":
os.system("ssh -t -t -o StrictHostKeyChecking=no [email protected] \"~/setpipe.sh {} {} {} {} {} {}\"".format("bw",
opts.bw,
"delay",
opts.delay,
"queue",
opts.queue))
else:
os.system("ssh -t -t -o StrictHostKeyChecking=no [email protected] \"~/setpipe.sh {} {} {} {}\"".format("bw",
opts.bw,
"delay",
opts.delay))
if __name__ == "__main__":
main()