Pavlin Radoslavov | 07eecc7 | 2013-04-02 22:54:19 +0000 | [diff] [blame] | 1 | #! /usr/bin/env python |
| 2 | import sys |
| 3 | import os |
| 4 | |
Masayoshi Kobayashi | a38e1c2 | 2013-04-03 00:25:26 +0000 | [diff] [blame] | 5 | hosts=['onosgui1', 'onosgui2', 'onosgui3', 'onosgui4', 'onosgui5', 'onosgui6', 'onosgui7', 'onosgui8'] |
Pavlin Radoslavov | 07eecc7 | 2013-04-02 22:54:19 +0000 | [diff] [blame] | 6 | filename = sys.argv[1] |
| 7 | |
| 8 | f = open(filename, 'r') |
| 9 | for line in f: |
| 10 | if line[0] != "#": |
| 11 | fid=int(line.strip().split()[0]) |
| 12 | src_dpid=line.strip().split()[2] |
| 13 | dst_dpid=line.strip().split()[4] |
| 14 | src_nwid=int(src_dpid.split(':')[-2], 16) |
| 15 | dst_nwid=int(dst_dpid.split(':')[-2], 16) |
| 16 | src_hostid=int(src_dpid.split(':')[-1], 16) |
| 17 | dst_hostid=int(dst_dpid.split(':')[-1], 16) |
| 18 | # cmd="ssh %s \'ssh -o StrictHostKeyChecking=no 1.1.%d.1 ping -c 10 -W 1 192.168.%d.%d\' > /tmp/ping.%d 2>&1 &" % (hosts[src_nwid-1], src_hostid, dst_nwid, dst_hostid,fid) |
Masayoshi Kobayashi | a38e1c2 | 2013-04-03 00:25:26 +0000 | [diff] [blame] | 19 | # cmd="ssh %s \'ssh -o StrictHostKeyChecking=no 1.1.%d.1 arp 193.168.%d.%d; ping -c 10 -W 1 192.168.%d.%d\' > /tmp/ping.%d 2>&1 &" % (hosts[src_nwid-1], src_hostid, dst_nwid, dst_hostid, dst_nwid, dst_hostid,fid) |
| 20 | cmd="ssh %s \'ssh -o StrictHostKeyChecking=no 1.1.%d.1 ping -c 10 -W 1 192.168.%d.%d\' > /tmp/ping.%d 2>&1 &" % (hosts[src_nwid-1], src_hostid, dst_nwid, dst_hostid,fid) |
Pavlin Radoslavov | 07eecc7 | 2013-04-02 22:54:19 +0000 | [diff] [blame] | 21 | print cmd |
| 22 | result = os.popen(cmd).read() |
| 23 | |
| 24 | f.close() |