From c0c32b101b4526f2123d098ad715e41a1a7633f8 Mon Sep 17 00:00:00 2001 From: xuliping Date: Sat, 14 Sep 2024 03:34:59 +0000 Subject: [PATCH 1/3] update detect config time --- tests/common/helpers/pfc_gen.py | 3 ++- tests/pfcwd/test_pfcwd_timer_accuracy.py | 23 ++++++++++++++++------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/tests/common/helpers/pfc_gen.py b/tests/common/helpers/pfc_gen.py index de87f7305c7..4e26ec26ae1 100755 --- a/tests/common/helpers/pfc_gen.py +++ b/tests/common/helpers/pfc_gen.py @@ -172,7 +172,7 @@ def main(): packet = packet + b"\x00\x00" pre_str = 'GLOBAL_PF' if options.global_pf else 'PFC' - logger.debug(pre_str + '_STORM_START') + logger.debug(pre_str + '_STORM_DEBUG') # Start sending PFC pause frames senders = [] @@ -186,6 +186,7 @@ def main(): s.start() senders.append(s) + logger.debug(pre_str + '_STORM_START') # Wait PFC packets to be sent for sender in senders: sender.stop() diff --git a/tests/pfcwd/test_pfcwd_timer_accuracy.py b/tests/pfcwd/test_pfcwd_timer_accuracy.py index 359cc400a09..1b4e155a7c7 100644 --- a/tests/pfcwd/test_pfcwd_timer_accuracy.py +++ b/tests/pfcwd/test_pfcwd_timer_accuracy.py @@ -227,19 +227,28 @@ def verify_pfcwd_timers(self): logger.info("all restore time {}".format(self.all_restore_time)) check_point = ITERATION_NUM // 2 - 1 + config_detect_time = self.timers['pfc_wd_detect_time'] + self.timers['pfc_wd_poll_time'] # Loose the check if two conditions are met - # 1. Device is Mellanox plaform - # 2. Leaf-fanout is Non-Onyx or non-Mellanox SONiC devices + # 1. Leaf-fanout is Non-Onyx or non-Mellanox SONiC devices + # 2. Device is Mellanox plaform, Loose the check + # 3. Device is not Mellanox plaform, add 50% of poll time to detect time # It's because the pfc_gen.py running on leaf-fanout can't guarantee the PFCWD is triggered consistently - if self.dut.facts['asic_type'] == "mellanox": - for fanouthost in list(self.fanout.values()): - if fanouthost.get_fanout_os() != "onyx" or \ - fanouthost.get_fanout_os() == "sonic" and fanouthost.facts['asic_type'] != "mellanox": + for fanouthost in list(self.fanout.values()): + if fanouthost.get_fanout_os() != "onyx" or \ + fanouthost.get_fanout_os() == "sonic" and fanouthost.facts['asic_type'] != "mellanox": + if self.dut.facts['asic_type'] == "mellanox": logger.info("Loose the check for non-Onyx or non-Mellanox leaf-fanout testbed") check_point = ITERATION_NUM // 3 - 1 break + else: + logger.info("Configuring detect time for non-Mellanox DUT") + config_detect_time = ( + self.timers['pfc_wd_detect_time'] + + self.timers['pfc_wd_poll_time'] + + (self.timers['pfc_wd_poll_time'] // 2) + ) + break - config_detect_time = self.timers['pfc_wd_detect_time'] + self.timers['pfc_wd_poll_time'] err_msg = ("Real detection time is greater than configured: Real detect time: {} " "Expected: {} (wd_detect_time + wd_poll_time)".format(self.all_detect_time[check_point], config_detect_time)) From 823bdeecf2291b677ec20478070d6cf13e8987e5 Mon Sep 17 00:00:00 2001 From: xuliping Date: Sat, 14 Sep 2024 03:43:31 +0000 Subject: [PATCH 2/3] update --- tests/pfcwd/test_pfcwd_timer_accuracy.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/pfcwd/test_pfcwd_timer_accuracy.py b/tests/pfcwd/test_pfcwd_timer_accuracy.py index 1b4e155a7c7..86e4f708c48 100644 --- a/tests/pfcwd/test_pfcwd_timer_accuracy.py +++ b/tests/pfcwd/test_pfcwd_timer_accuracy.py @@ -231,8 +231,9 @@ def verify_pfcwd_timers(self): # Loose the check if two conditions are met # 1. Leaf-fanout is Non-Onyx or non-Mellanox SONiC devices # 2. Device is Mellanox plaform, Loose the check - # 3. Device is not Mellanox plaform, add 50% of poll time to detect time + # 3. Device is broadcom plaform, add 50% of poll time to detect time # It's because the pfc_gen.py running on leaf-fanout can't guarantee the PFCWD is triggered consistently + logger.debug("dut asic_type {}".format(self.dut.facts['asic_type'])) for fanouthost in list(self.fanout.values()): if fanouthost.get_fanout_os() != "onyx" or \ fanouthost.get_fanout_os() == "sonic" and fanouthost.facts['asic_type'] != "mellanox": @@ -240,8 +241,8 @@ def verify_pfcwd_timers(self): logger.info("Loose the check for non-Onyx or non-Mellanox leaf-fanout testbed") check_point = ITERATION_NUM // 3 - 1 break - else: - logger.info("Configuring detect time for non-Mellanox DUT") + elif self.dut.facts['asic_type'] == "broadcom": + logger.info("Configuring detect time for broadcom DUT") config_detect_time = ( self.timers['pfc_wd_detect_time'] + self.timers['pfc_wd_poll_time'] + From c9cc7adee28548b74a69b0adfe241198ddab2310 Mon Sep 17 00:00:00 2001 From: xuliping Date: Sat, 14 Sep 2024 04:03:10 +0000 Subject: [PATCH 3/3] update coments --- tests/pfcwd/test_pfcwd_timer_accuracy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pfcwd/test_pfcwd_timer_accuracy.py b/tests/pfcwd/test_pfcwd_timer_accuracy.py index 86e4f708c48..32587fbdbdc 100644 --- a/tests/pfcwd/test_pfcwd_timer_accuracy.py +++ b/tests/pfcwd/test_pfcwd_timer_accuracy.py @@ -231,7 +231,7 @@ def verify_pfcwd_timers(self): # Loose the check if two conditions are met # 1. Leaf-fanout is Non-Onyx or non-Mellanox SONiC devices # 2. Device is Mellanox plaform, Loose the check - # 3. Device is broadcom plaform, add 50% of poll time to detect time + # 3. Device is broadcom plaform, add half of polling time as compensation for the detect config time # It's because the pfc_gen.py running on leaf-fanout can't guarantee the PFCWD is triggered consistently logger.debug("dut asic_type {}".format(self.dut.facts['asic_type'])) for fanouthost in list(self.fanout.values()):