def test_arp_ping(self):
"""test ARP ping - compare to arping utilite"""
arp_ping = Ping(IFACE, ARP_NAME, TIMEOUT, False)
for ip in list(ipaddress.ip_network(TEST_NETWORK).hosts())[:5]:
try:
# need arping installed
with os.popen('arping -c {} -t {} {}'.format(COUNT,
TIMEOUT,
str(ip)), 'r'):
# get exit code
ec = os.wait()[1] & 0xFF00
res = arp_ping.ping_host(str(ip))
except PermissionException:
print('Need root previlegies')
if res[STATUS_INDEX] == ONLINE:
self.assertTrue(ec == 0)
else:
self.assertFalse(ec == 0)
评论列表
文章目录