def reload(self, reload_timeout=300, save_config=True):
"""Reload the device.
CSM_DUT#reload
System configuration has been modified. Save? [yes/no]: yes
Building configuration...
[OK]
Proceed with reload? [confirm]
"""
response = "yes" if save_config else "no"
events = [SAVE_CONFIG, PROCEED, pexpect.TIMEOUT, pexpect.EOF]
transitions = [
(SAVE_CONFIG, [0], 1, partial(a_send_line, response), 60),
(PROCEED, [0, 1], 2, partial(a_send, "\r"), reload_timeout),
# if timeout try to send the reload command again
(pexpect.TIMEOUT, [0], 0, partial(a_send_line, self.reload_cmd), 10),
(pexpect.TIMEOUT, [2], -1, a_reconnect, 0),
(pexpect.EOF, [0, 1, 2], -1, a_disconnect, 0)
]
fsm = FSM("IOS-RELOAD", self.device, events, transitions, timeout=10, max_transitions=5)
return fsm.run()
评论列表
文章目录