Skip to content

Commit a23c3ca

Browse files
liuh-80mssonicbld
authored andcommitted
[TACACS] Retry reboot in ro-disk UT when DUT not reachable. (sonic-net#9639)
Retry reboot in ro-disk UT when DUT not reachable. ### Description of PR Retry reboot in ro-disk UT when DUT not reachable. ### Type of change <!-- - Fill x for your type of change. - e.g. - [x] Bug fix --> - [ ] Bug fix - [ ] Testbed and Framework(new/improvement) - [x] Test case(new/improvement) ### Back port request - [ ] 201911 - [ ] 202012 - [x] 202205 ### Approach #### What is the motivation for this PR? Device unreachable after TACACS ro-disk UT failed. #### How did you do it? Add retry when ro-disk DUT not reachable before reboot. #### How did you verify/test it? Pass all UT #### Any platform specific information? #### Supported testbed topology if it's a new test case? ### Documentation <!-- (If it's a new feature, new test case) Did you update documentation/Wiki relevant to your implementation? Link to the wiki page? -->
1 parent 398abb5 commit a23c3ca

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

tests/tacacs/test_ro_disk.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
import time
55

6+
from ansible.errors import AnsibleConnectionFailure
67
from tests.common.devices.base import RunAnsibleModuleFail
78
from tests.common.utilities import wait_until
89
from tests.common.utilities import skip_release
@@ -67,10 +68,15 @@ def do_reboot(duthost, localhost, duthosts):
6768
localhost.wait_for(host=duthost.mgmt_ip, port=22, state="stopped", delay=5, timeout=60)
6869
rebooted = True
6970
break
71+
except AnsibleConnectionFailure as e:
72+
logger.error("DUT not reachable, exception: {} attempt:{}/{}".
73+
format(repr(e), i, retries))
7074
except RunAnsibleModuleFail as e:
7175
logger.error("DUT did not go down, exception: {} attempt:{}/{}".
7276
format(repr(e), i, retries))
7377

78+
wait(wait_time, msg="Wait {} seconds before retry.".format(wait_time))
79+
7480
assert rebooted, "Failed to reboot"
7581
localhost.wait_for(host=duthost.mgmt_ip, port=22, state="started", delay=10, timeout=300)
7682
wait(wait_time, msg="Wait {} seconds for system to be stable.".format(wait_time))

0 commit comments

Comments
 (0)