diff --git a/tests/syslog/test_syslog_rate_limit.py b/tests/syslog/test_syslog_rate_limit.py index 1675700f2d..f12683ec57 100644 --- a/tests/syslog/test_syslog_rate_limit.py +++ b/tests/syslog/test_syslog_rate_limit.py @@ -51,6 +51,13 @@ def restore_rate_limit(rand_selected_dut): Args: rand_selected_dut (object): DUT host object """ + output = rand_selected_dut.command('config syslog --help')['stdout'] + manually_enable_feature = False + if 'rate-limit-feature' in output: + # in 202305, the feature is disabled by default for warmboot/fastboot + # performance, need manually enable it via command + rand_selected_dut.command('config syslog rate-limit-feature enable') + manually_enable_feature = True container_data = rand_selected_dut.show_and_parse('show syslog rate-limit-container') host_data = rand_selected_dut.show_and_parse('show syslog rate-limit-host') @@ -63,6 +70,8 @@ def restore_rate_limit(rand_selected_dut): rand_selected_dut.command('config syslog rate-limit-host -b {} -i {}'.format( host_data[0]['burst'], host_data[0]['interval'])) rand_selected_dut.command('config save -y') + if manually_enable_feature: + rand_selected_dut.command('config syslog rate-limit-feature disable') @pytest.mark.disable_loganalyzer diff --git a/tests/test_pretest.py b/tests/test_pretest.py index d86e7d0174..d59ecfc18c 100644 --- a/tests/test_pretest.py +++ b/tests/test_pretest.py @@ -163,6 +163,14 @@ def test_disable_rsyslog_rate_limit(duthosts, enum_dut_hostname): is_dhcp_server_enable = config_facts["ansible_facts"]["DEVICE_METADATA"]["localhost"]["dhcp_server"] except KeyError: is_dhcp_server_enable = None + + output = duthost.command('config syslog --help')['stdout'] + manually_enable_feature = False + if 'rate-limit-feature' in output: + # in 202305, the feature is disabled by default for warmboot/fastboot + # performance, need manually enable it via command + duthost.command('config syslog rate-limit-feature enable') + manually_enable_feature = True for feature_name, state in list(features_dict.items()): if 'enabled' not in state: continue @@ -175,6 +183,8 @@ def test_disable_rsyslog_rate_limit(duthosts, enum_dut_hostname): if "sonic-telemetry" not in output: continue duthost.modify_syslog_rate_limit(feature_name, rl_option='disable') + if manually_enable_feature: + duthost.command('config syslog rate-limit-feature disable') def collect_dut_lossless_prio(dut):