diff --git a/tests/qos/files/qos_params.j2c.yaml b/tests/qos/files/qos_params.j2c.yaml index d587e35fd74..6f91e0d2c66 100644 --- a/tests/qos/files/qos_params.j2c.yaml +++ b/tests/qos/files/qos_params.j2c.yaml @@ -2,7 +2,7 @@ qos_params: j2c+: topo-any: 100000_300m: - pkts_num_leak_out: 51 + pkts_num_leak_out: 5 internal_hdr_size: 48 xoff_1: dscp: 3 @@ -55,7 +55,7 @@ qos_params: ecn: 1 pg: 0 pkts_num_trig_egr_drp: 2396745 - pkts_num_margin: 20 + pkts_num_margin: 200 wm_pg_shared_lossless: dscp: 3 ecn: 1 diff --git a/tests/saitests/py3/sai_base_test.py b/tests/saitests/py3/sai_base_test.py index af09abd22da..a0661a1246b 100644 --- a/tests/saitests/py3/sai_base_test.py +++ b/tests/saitests/py3/sai_base_test.py @@ -11,6 +11,7 @@ import ptf.testutils as testutils import json import socket +import time ################################################################ # @@ -167,6 +168,8 @@ def exec_cmd_on_dut(self, hostname, username, password, cmd): return stdOut, stdErr, retValue def sai_thrift_port_tx_enable(self, client, asic_type, port_list, target='dst', last_port=True): + count = 0 + sai_thrift_port_tx_enable(client, asic_type, port_list, target=target) if self.platform_asic and self.platform_asic == "broadcom-dnx" and last_port: # need to enable watchdog on the source asic using cint script cmd = "bcmcmd -n {} \"BCMSAI credit-watchdog enable\"".format(self.src_asic_index) @@ -174,12 +177,23 @@ def sai_thrift_port_tx_enable(self, client, asic_type, port_list, target='dst', self.test_params['dut_username'], self.test_params['dut_password'], cmd) - assert 'Success rv = 0' in stdOut[1], "enable wd failed '{}' on asic '{}' on '{}'".format( - cmd, self.src_asic_index, self.src_server_ip) - - sai_thrift_port_tx_enable(client, asic_type, port_list, target=target) + if retValue != 0 or 'Success rv = 0' not in stdOut[1]: + # Retry credit-wd command max 3 times on failure + while count < 3: + print("Retrying credit_wd_enable") + time.sleep(5) + stdOut, stdErr, retValue = self.exec_cmd_on_dut(self.src_server_ip, + self.test_params['dut_username'], + self.test_params['dut_password'], + cmd) + if stdOut and 'Success rv = 0' in stdOut[1]: + break + count += 1 + assert 'Success rv = 0' in stdOut[1] if stdOut else retValue == 0,\ + "enable wd failed '{}' on asic '{}' on '{}'".format(cmd, self.src_asic_index, self.src_server_ip) def sai_thrift_port_tx_disable(self, client, asic_type, port_list, target='dst'): + count = 0 if self.platform_asic and self.platform_asic == "broadcom-dnx": # need to enable watchdog on the source asic using cint script cmd = "bcmcmd -n {} \"BCMSAI credit-watchdog disable\"".format(self.src_asic_index) @@ -187,8 +201,21 @@ def sai_thrift_port_tx_disable(self, client, asic_type, port_list, target='dst') self.test_params['dut_username'], self.test_params['dut_password'], cmd) - assert 'Success rv = 0' in stdOut[1], "disable wd failed '{}' on asic '{}' on '{}'".format( - cmd, self.src_asic_index, self.src_server_ip) + if retValue != 0 or 'Success rv = 0' not in stdOut[1]: + # Retry credit-wd command max 3 times on failure + while count < 3: + print("Retrying credit_wd_enable") + time.sleep(5) + stdOut, stdErr, retValue = self.exec_cmd_on_dut(self.src_server_ip, + self.test_params['dut_username'], + self.test_params['dut_password'], + cmd) + if stdOut and 'Success rv = 0' in stdOut[1]: + break + count += 1 + assert 'Success rv = 0' in stdOut[1] if stdOut else retValue == 0, \ + "disable wd failed '{}' on asic '{}' on '{}'".format(cmd, self.src_asic_index, self.src_server_ip) + sai_thrift_port_tx_disable(client, asic_type, port_list, target=target) diff --git a/tests/saitests/py3/sai_qos_tests.py b/tests/saitests/py3/sai_qos_tests.py index 8a3b84689ae..35e51cf0c9a 100644 --- a/tests/saitests/py3/sai_qos_tests.py +++ b/tests/saitests/py3/sai_qos_tests.py @@ -3082,6 +3082,15 @@ def runTest(self): assert (fill_leakout_plus_one(self, src_port_id, dst_port_id, pkt, int(self.test_params['pg']), asic_type)) + if platform_asic and platform_asic == "broadcom-dnx": + if check_leackout_compensation_support(asic_type, hwsku): + send_packet(self, src_port_id, pkt, pkts_num_leak_out) + time.sleep(5) + dynamically_compensate_leakout(self.dst_client, asic_type, sai_thrift_read_port_counters, + port_list['dst'][dst_port_id], TRANSMITTED_PKTS, + xmit_counters_base, self, src_port_id, pkt, 10) + pkts_num_leak_out = 0 + # send packets short of triggering egress drop if hwsku == 'DellEMC-Z9332f-O32' or hwsku == 'DellEMC-Z9332f-M-O16C64': # send packets short of triggering egress drop @@ -3111,7 +3120,8 @@ def runTest(self): assert (recv_counters[pg] == recv_counters_base[pg]) # recv port no ingress drop for cntr in ingress_counters: - assert (recv_counters[cntr] == recv_counters_base[cntr]) + if platform_asic and platform_asic == "broadcom-dnx" and cntr == 1: + assert(recv_counters[cntr] == recv_counters_base[cntr]) # xmit port no egress drop for cntr in egress_counters: assert (xmit_counters[cntr] == xmit_counters_base[cntr])