diff --git a/tests/gnmi/conftest.py b/tests/gnmi/conftest.py index 6a74fc580b9..859ba20aa6f 100644 --- a/tests/gnmi/conftest.py +++ b/tests/gnmi/conftest.py @@ -210,7 +210,13 @@ def setup_gnmi_server(duthosts, rand_one_dut_hostname, localhost, ptfhost): # Rollback configuration rollback(duthost, SETUP_ENV_CP) - recover_cert_config(duthost) + # Get the skip_gnmi_check flag from duthost options + skip_gnmi_check = duthost.host.options.get('skip_gnmi_check', False) + # Skip GNMI restart if the reboot flag is set + if not skip_gnmi_check: + recover_cert_config(duthost) + else: + logging.info("Skipping GNMI restart due to skip_gnmi_check flag") @pytest.fixture(scope="module", autouse=True) diff --git a/tests/gnmi/test_gnoi_system.py b/tests/gnmi/test_gnoi_system.py index e19b5dd1645..be1f3eac76b 100644 --- a/tests/gnmi/test_gnoi_system.py +++ b/tests/gnmi/test_gnoi_system.py @@ -42,6 +42,9 @@ def test_gnoi_system_reboot(duthosts, rand_one_dut_hostname, localhost): """ duthost = duthosts[rand_one_dut_hostname] + # Set flag to indicate that this test involves reboot + duthost.host.options['skip_gnmi_check'] = True + # Trigger reboot ret, msg = gnoi_request(duthost, localhost, "Reboot", '{"method": 1}') pytest_assert(ret == 0, "System.Reboot API reported failure (rc = {}) with message: {}".format(ret, msg))