我想同时启动两个或多个主机,以便在mininet中使用python ping通其他两个主机,我这样做并且不起作用
def simpleTest(h1,h2):
print (h1.cmd('ping -c5 %s' h2.IP()))
和主要:
if __name__ == '__main__':
net = Mininet(...)
threads= 3 # three threads
#....codes......
for i in range(1, threads):
hostsrc=net.hosts[i]
hostdest=net.hosts[i+4]
thread = threading.Thread(target=simpleTest(hostsrc,hostdest))
jobs.append(thread)
for j in jobs:
j.start()
for j in jobs:
j.join()
"""
codes ...
"""
任何解决方法请...
通过在此行中添加arg起作用...
thread = threading.Thread(target=simpleTest, args=(hostsrc,hostdest,))