From 2a3598c94e3eec753486f4645434d67826979240 Mon Sep 17 00:00:00 2001 From: Cong Hou <97947969+congh-nvidia@users.noreply.github.com> Date: Tue, 1 Oct 2024 01:17:39 +0800 Subject: [PATCH] Improve the error tolerance for drop counter test (#14676) On T0 testbed, sometimes we observed addtional drops which equals to the number of vlan members. --- tests/common/helpers/drop_counters/drop_counters.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/common/helpers/drop_counters/drop_counters.py b/tests/common/helpers/drop_counters/drop_counters.py index e8c71dcd33..5e181b87eb 100644 --- a/tests/common/helpers/drop_counters/drop_counters.py +++ b/tests/common/helpers/drop_counters/drop_counters.py @@ -115,10 +115,16 @@ def _check_drops_on_dut(): if not wait_until(25, 1, 0, _check_drops_on_dut): # We were seeing a few more drop counters than expected, so we are allowing a small margin of error - DEOP_MARGIN = 10 + # The max number of unexpected drop we see equals to the number of vlan members in t0 topology + duthost = duthosts.frontend_nodes[0] + mg_facts = duthost.minigraph_facts(host=duthost.hostname)["ansible_facts"] + DROP_MARGIN = 0 if mg_facts['minigraph_vlans'] else 10 + for vlan in mg_facts['minigraph_vlans']: + DROP_MARGIN += len(mg_facts['minigraph_vlans'][vlan]['members']) + logger.info(f"The DROP_MARGIN is {DROP_MARGIN}") actual_drop = _get_drops_across_all_duthosts() for drop in actual_drop: - if drop >= packets_count and drop <= packets_count + DEOP_MARGIN: + if drop >= packets_count and drop <= packets_count + DROP_MARGIN: logger.warning("Actual drops {} exceeded expected drops {} on iface {}\n".format( actual_drop, packets_count, dut_iface)) break