diff --git a/ansible/roles/test/files/ptftests/py3/generic_hash_test.py b/ansible/roles/test/files/ptftests/py3/generic_hash_test.py index dd4ed852aa3..8ca1ee02192 100644 --- a/ansible/roles/test/files/ptftests/py3/generic_hash_test.py +++ b/ansible/roles/test/files/ptftests/py3/generic_hash_test.py @@ -379,8 +379,17 @@ def check_ip_route(self, pkt, masked_expected_pkt, sending_port): send the packet and check it is received by one of the expected ports """ testutils.send_packet(self, sending_port, pkt) - port_index, received = testutils.verify_packet_any_port( - self, masked_expected_pkt, self.expected_port_list, timeout=0.1) + try: + port_index, received = testutils.verify_packet_any_port( + self, masked_expected_pkt, self.expected_port_list, timeout=0.1) + except AssertionError: + logging.error("Traffic wasn't sent successfully, trying again") + logging.info(f"Expected packet: {masked_expected_pkt}") + for _ in range(5): + testutils.send_packet(self, sending_port, pkt, count=1) + time.sleep(0.1) + port_index, received = testutils.verify_packet_any_port( + self, masked_expected_pkt, self.expected_port_list, timeout=1) # The port_index is the index of expected_port_list, need to convert it to the ptf port index return self.expected_port_list[port_index], received diff --git a/tests/hash/generic_hash_helper.py b/tests/hash/generic_hash_helper.py index b0e3a430c36..4cb0d0cc990 100644 --- a/tests/hash/generic_hash_helper.py +++ b/tests/hash/generic_hash_helper.py @@ -57,7 +57,7 @@ l2_ports = set() vlans_to_remove = [] interfaces_to_startup = [] -balancing_test_times = 240 +balancing_test_times = 480 balancing_range = 0.25 balancing_range_in_port = 0.8 vxlan_ecmp_utils = VxLAN_Ecmp_Utils()