Skip to content

Commit

Permalink
[syslog] enable/disable syslog rate limit feature in fixture (#10986)
Browse files Browse the repository at this point in the history
Feature syslog rate limit has been disabled by default to avoid consume CPU cycles during warm / fast reboot. There are new CLIs to enable/disable it. The PR is to automatically enable it before syslog rate limit test and disable it after.

Summary:
In fixture "restore_rate_limit", enable the feature at beginning, disable the feature at the end.

Change-Id: I61545db602d579fa0f337686427235c6d04998c7
  • Loading branch information
Junchao-Mellanox authored and mssonicbld committed Jan 18, 2024
1 parent 7893f49 commit d578043
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/syslog/test_syslog_rate_limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand All @@ -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
Expand Down
10 changes: 10 additions & 0 deletions tests/test_pretest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down

0 comments on commit d578043

Please sign in to comment.