Skip to content
Merged
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
5 changes: 5 additions & 0 deletions modules/test/conn/conf/module_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
"timeout": 30
},
"tests": [
{
"name": "connection.dhcp_address",
"description": "The device under test has received an IP address from the DHCP server and responds to an ICMP echo (ping) request",
"expected_behavior": "The device is not setup with a static IP address. The device accepts an IP address from a DHCP server (RFC 2131) and responds succesfully to an ICMP echo (ping) request."
},
{
"name": "connection.mac_address",
"description": "Check and note device physical address.",
Expand Down
19 changes: 19 additions & 0 deletions modules/test/conn/python/src/connection_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,25 @@ def __init__(self, module):
# response = self.dhcp1_client.set_dhcp_range('10.10.10.20','10.10.10.30')
# print("Set Range: " + str(response))

def _connection_dhcp_address(self):
LOGGER.info("Running connection.dhcp_address")
response = self.dhcp1_client.get_lease(self._device_mac)
LOGGER.info("DHCP Lease resolved:\n" + str(response))
if response.code == 200:
lease = eval(response.message)
if 'ip' in lease:
ip_addr = lease['ip']
LOGGER.info("IP Resolved: " + ip_addr)
LOGGER.info("Attempting to ping device...");
ping_success = self._ping(self._device_ipv4_addr)
LOGGER.info("Ping Success: " + str(ping_success))
if ping_success:
return True, "Device responded to leased ip address"
else:
return False, "Device did not respond to leased ip address"
else:
LOGGER.info("No DHCP lease found for: " + self._device_mac)
return False, "No DHCP lease found for: " + self._device_mac

def _connection_mac_address(self):
LOGGER.info("Running connection.mac_address")
Expand Down