Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions modules/test/conn/python/src/connection_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,12 +599,7 @@ def _connection_ipv6_ping(self):

def _ping(self, host, ipv6=False):
LOGGER.info('Pinging: ' + str(host))
cmd = 'ping -c 1 '
cmd += ' -6 ' if ipv6 else ''
cmd += str(host)
#cmd = 'ping -c 1 ' + str(host)
success = util.run_command(cmd, output=False) # pylint: disable=E1120
return success
return self._dhcp_util.ping(host, ipv6=ipv6)

def restore_failover_dhcp_server(self, subnet):
# Configure the subnet range
Expand Down
14 changes: 10 additions & 4 deletions modules/test/conn/python/src/dhcp_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"""Module that contains various methods for validating the DHCP
device behaviors"""

import re
import time
from datetime import datetime
import util
Expand Down Expand Up @@ -205,10 +206,15 @@ def is_lease_active(self, lease):
LOGGER.error('Failed to confirm a valid active lease for the device')
return ping_success

def ping(self, host):
cmd = 'ping -c 1 ' + str(host)
success = util.run_command(cmd, output=False) # pylint: disable=E1120
return success
def ping(self, host, ipv6=False):
if ipv6:
command = f'ping -c 1 -6 {host}'
else:
command = f'ping -c 1 {host}'
out, _ = util.run_command(command, supress_error=True)
if re.search(r'\s0% packet loss', out):
return True
return False

def add_reserved_lease(self,
hostname,
Expand Down
Loading