blob: f4f10c2d33739f6bfd2172c6d53b5bd812b36edf [file] [log] [blame]
Pavlin Radoslavov07eecc72013-04-02 22:54:19 +00001#! /usr/bin/env python
2import sys
3import os
4
Masayoshi Kobayashia38e1c22013-04-03 00:25:26 +00005hosts=['onosgui1', 'onosgui2', 'onosgui3', 'onosgui4', 'onosgui5', 'onosgui6', 'onosgui7', 'onosgui8']
Pavlin Radoslavov07eecc72013-04-02 22:54:19 +00006filename = sys.argv[1]
7
8f = open(filename, 'r')
9for 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 Kobayashia38e1c22013-04-03 00:25:26 +000019# 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 Radoslavov07eecc72013-04-02 22:54:19 +000021 print cmd
22 result = os.popen(cmd).read()
23
24f.close()