blob: 9d40c986bcec637bb9a78c1fd65e8b39700e4dae [file] [log] [blame]
Masayoshi Kobayashi4cfa1272013-04-03 00:45:46 +00001#! /usr/bin/env python
2import sys
3import os
4
5def usage():
6 print "%s flowid src_dpid src_port dst_dpid dst_port duration samples" % sys.argv[0]
7 sys.exit()
8
9def main():
10 flowid = sys.argv[1]
11 src_dpid = sys.argv[2]
12 dst_dpid = sys.argv[4]
13 duration=int(sys.argv[6])
14 samples=int(sys.argv[7])
15 src_nwid=int(src_dpid.split(':')[-2], 16)
16 dst_nwid=int(dst_dpid.split(':')[-2], 16)
17 src_hostid=int(src_dpid.split(':')[-1], 16)
18 dst_hostid=int(dst_dpid.split(':')[-1], 16)
19 # /home/ubuntu/ONOS/web/scripts/iperf -t%s -i0.1 -yJ -o /tmp/iperf_%s.out -c 127.0.0.1 &
20 cmd="ssh -o StrictHostKeyChecking=no 1.1.%d.1 '/home/ubuntu/ONOS/scripts/iperf -t %s -i0.1 -k %d -yJ -o /home/ubuntu/ONOS/web/log/iperf_%s.out -c 192.168.%d.%d 2>&1 &' &" % (src_hostid, duration, samples, flowid, dst_nwid, dst_hostid)
21 killcmd='pkill -KILL -f \"iperf .* -o .*/iperf_%s.out\"' % (flowid)
22 print killcmd
23 print cmd
24 os.popen(killcmd)
25 os.popen(cmd)
26
27if __name__ == "__main__":
28 if len(sys.argv) != 8:
29 print len(sys.argv)
30 usage()
31
32 main()