From a89462e227109ca383060a5afa258415b0ee5338 Mon Sep 17 00:00:00 2001 From: Jacob Boddey Date: Thu, 4 Apr 2024 10:40:36 +0100 Subject: [PATCH 1/3] Allow ARP from 0.0.0.0 --- modules/test/conn/python/src/connection_module.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/test/conn/python/src/connection_module.py b/modules/test/conn/python/src/connection_module.py index e0c7f1d1a..2111a1c89 100644 --- a/modules/test/conn/python/src/connection_module.py +++ b/modules/test/conn/python/src/connection_module.py @@ -105,10 +105,11 @@ def _connection_switch_arp_inspection(self): # Check MAC address matches IP address if (arp_packet.hwsrc == self._device_mac and - arp_packet.psrc != self._device_ipv4_addr): + (arp_packet.psrc != self._device_ipv4_addr + or arp_packet.psrc != '0.0.0.0')): LOGGER.info(f'Bad ARP packet detected for MAC: {self._device_mac}') - LOGGER.info(f'''ARP packet from IP {arp_packet.psrc} does not match - {self._device_ipv4_addr}''') + LOGGER.info(f'''ARP packet from IP {arp_packet.psrc} + does not match {self._device_ipv4_addr}''') return False, 'Device is sending false ARP response' if no_arp: From 6186938b08ddd5b122b2c73909ba1bd3d616bcf8 Mon Sep 17 00:00:00 2001 From: Jacob Boddey Date: Thu, 4 Apr 2024 13:27:35 +0100 Subject: [PATCH 2/3] Fix logic --- modules/test/conn/python/src/connection_module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/test/conn/python/src/connection_module.py b/modules/test/conn/python/src/connection_module.py index 2111a1c89..cf8852ef0 100644 --- a/modules/test/conn/python/src/connection_module.py +++ b/modules/test/conn/python/src/connection_module.py @@ -106,7 +106,7 @@ def _connection_switch_arp_inspection(self): # Check MAC address matches IP address if (arp_packet.hwsrc == self._device_mac and (arp_packet.psrc != self._device_ipv4_addr - or arp_packet.psrc != '0.0.0.0')): + and arp_packet.psrc != '0.0.0.0')): LOGGER.info(f'Bad ARP packet detected for MAC: {self._device_mac}') LOGGER.info(f'''ARP packet from IP {arp_packet.psrc} does not match {self._device_ipv4_addr}''') From 5eb0a2ba03e31d17cb8ec8de4da6ae8013889dcf Mon Sep 17 00:00:00 2001 From: Jacob Boddey Date: Thu, 4 Apr 2024 16:30:59 +0100 Subject: [PATCH 3/3] Fix deleting report --- framework/python/src/common/device.py | 4 ++-- framework/python/src/core/testrun.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/framework/python/src/common/device.py b/framework/python/src/common/device.py index 715603e41..51d68dfc6 100644 --- a/framework/python/src/common/device.py +++ b/framework/python/src/common/device.py @@ -43,9 +43,9 @@ def get_reports(self): def remove_report(self, timestamp: datetime): for report in self.reports: - if report.get_started() == timestamp: + if report.get_started().strftime('%Y-%m-%dT%H:%M:%S') == timestamp: self.reports.remove(report) - break + return def to_dict(self): """Returns the device as a python dictionary. This is used for the diff --git a/framework/python/src/core/testrun.py b/framework/python/src/core/testrun.py index 2c62108ee..4ca176a79 100644 --- a/framework/python/src/core/testrun.py +++ b/framework/python/src/core/testrun.py @@ -232,6 +232,7 @@ def delete_report(self, device: Device, timestamp): if report_folder == timestamp: shutil.rmtree(os.path.join(reports_folder, report_folder)) device.remove_report(timestamp) + LOGGER.debug('Successfully deleted the report') return True return False