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

Enable container autorestart for bgp/test_bgp_session.py #15766

Merged
Merged
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
19 changes: 19 additions & 0 deletions tests/bgp/test_bgp_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,24 @@
]


@pytest.fixture
def enable_container_autorestart(duthosts, rand_one_dut_hostname):
# Enable autorestart for all features
duthost = duthosts[rand_one_dut_hostname]
feature_list, _ = duthost.get_feature_status()
container_autorestart_states = duthost.get_container_autorestart_states()
for feature, status in list(feature_list.items()):
# Enable container autorestart only if the feature is enabled and container autorestart is disabled.
if status == 'enabled' and container_autorestart_states[feature] == 'disabled':
duthost.shell("sudo config feature autorestart {} enabled".format(feature))

yield
for feature, status in list(feature_list.items()):
# Disable container autorestart back if it was initially disabled.
if status == 'enabled' and container_autorestart_states[feature] == 'disabled':
duthost.shell("sudo config feature autorestart {} disabled".format(feature))


@pytest.fixture(scope='module')
def setup(duthosts, rand_one_dut_hostname, nbrhosts, fanouthosts):
duthost = duthosts[rand_one_dut_hostname]
Expand Down Expand Up @@ -102,6 +120,7 @@ def verify_bgp_session_down(duthost, bgp_neighbor):
@pytest.mark.parametrize("failure_type", ["interface", "neighbor"])
@pytest.mark.disable_loganalyzer
def test_bgp_session_interface_down(duthosts, rand_one_dut_hostname, fanouthosts, localhost,
enable_container_autorestart,
nbrhosts, setup, test_type, failure_type, tbinfo):
'''
1: check all bgp sessions are up
Expand Down
Loading