blob: 37325d64f76f2dde01f2836a8a880e8028bfae64 [file] [log] [blame]
#! /usr/bin/env python
import sys
import os
hosts=['onosdevz1', 'onosdevz2', 'onosdevz3', 'onosdevz4', 'onosdevz5', 'onosdevz6', 'onosdevz7', 'onosdevz8']
filename = sys.argv[1]
f = open(filename, 'r')
for line in f:
if line[0] != "#":
fid=int(line.strip().split()[0])
src_dpid=line.strip().split()[2]
dst_dpid=line.strip().split()[4]
src_nwid=int(src_dpid.split(':')[-2], 16)
dst_nwid=int(dst_dpid.split(':')[-2], 16)
src_hostid=int(src_dpid.split(':')[-1], 16)
dst_hostid=int(dst_dpid.split(':')[-1], 16)
# 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)
cmd="ssh %s \'ssh -o StrictHostKeyChecking=no 1.1.%d.1 arp 192.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)
print cmd
result = os.popen(cmd).read()
f.close()