Skip to content

Commit 9fcacf4

Browse files
committed
test_gnoi_system_reboot_when_reboot_active
1 parent a2724b7 commit 9fcacf4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/gnmi/test_gnoi_system.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,22 @@ def test_gnoi_system_reboot_fail_invalid_method(duthosts, rand_one_dut_hostname,
5959
pytest_assert(ret != 0, "System.Reboot API did not report failure with invalid method")
6060

6161

62+
def test_gnoi_system_reboot_when_reboot_active(duthosts, rand_one_dut_hostname, localhost):
63+
"""
64+
Verify the gNOI System Reboot API fails if a reboot is already active.
65+
"""
66+
duthost = duthosts[rand_one_dut_hostname]
67+
68+
# Trigger first reboot
69+
ret, msg = gnoi_request(duthost, localhost, "Reboot", '{"method": 1}')
70+
pytest_assert(ret == 0, "System.Reboot API reported failure (rc = {}) with message: {}".format(ret, msg))
71+
logging.info("System.Reboot API returned msg: {}".format(msg))
72+
73+
# Trigger second reboot while the first one is still active
74+
ret, msg = gnoi_request(duthost, localhost, "Reboot", '{"method": 1}')
75+
pytest_assert(ret != 0, "System.Reboot API did not report failure when reboot is already active")
76+
77+
6278
def test_gnoi_system_reboot_status_immediately(duthosts, rand_one_dut_hostname, localhost):
6379
"""
6480
Verify the gNOI System RebootStatus API returns the correct status immediately after reboot.

0 commit comments

Comments
 (0)