diff options
Diffstat (limited to 'drivers/CiscoSX300.py')
-rw-r--r-- | drivers/CiscoSX300.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/CiscoSX300.py b/drivers/CiscoSX300.py index 7cdeb40..c875ca6 100644 --- a/drivers/CiscoSX300.py +++ b/drivers/CiscoSX300.py @@ -98,6 +98,22 @@ class CiscoSX300(SwitchDriver): self._cli("y") self.connection.expect("Copy succeeded") + # Restart the switch - we need to reload config to do a + # roll-back. Do NOT save running-config first if the switch asks - + # we're trying to dump recent changes, not save them. + # + # This will also implicitly cause a connection to be closed + def switch_restart(self): + self._cli("reload") + index = self.connection.expect(['Are you sure', 'will reset']) + if index == 0: + self._cli("y") # Yes, continue without saving + self.connection.expect("reset the whole") + + # Fall through + self._cli("y") # Yes, continue to reset + self.connection.close(True) + ################################ ### VLAN API functions ################################ @@ -498,7 +514,8 @@ if __name__ == "__main__": buf = p.vlan_get_list() p._dump_list(buf) -# p.switch_save_running_config() + print 'Restarting switch, to explicitly reset config' + p.switch_restart() p.switch_disconnect() # p._show_config() |