forked from extremenetworks/ExtremeScripting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCleanSwitch.py
29 lines (25 loc) · 872 Bytes
/
CleanSwitch.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python
'''
Script : CleanSwitch
Revision : 1.0
Purpose: This widget provides a method of deleting all configuration
parameters and files from an ExtremeXOS(TM) switch. Once the
files are removed, the switch will reboot using its factory
default configuration.
Specifically, this widget performs the following functions:
1. Removes all files from the internal drive
2. Removes all log entries
3. Removes administrative password and SSH private key
4. Reboots the switch using default configuration
'''
def exosCmd(cmd):
print cmd
try:
exsh.clicmd(cmd,True)
except RuntimeError as msg:
print 'Error',msg
return
exosCmd('rm *')
exosCmd('clear log messages nvram')
exosCmd('clear log static')
exosCmd('unconfigure switch all')