Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[syslog] enable/disable syslog rate limit feature in fixture #10986

Merged
merged 1 commit into from
Dec 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -50,6 +50,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 @@ -62,6 +69,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