lsjordan / switch-upgrade-tool Goto Github PK
View Code? Open in Web Editor NEWNetwork switch OS upgrade tool. Primarily used for Cisco IOS
License: MIT License
Network switch OS upgrade tool. Primarily used for Cisco IOS
License: MIT License
Incorrect commands can be sent to a switch object without the function erroring
I have had a brief attempt at implementing some Multiprocessing streams to dramatically improve performance (SSH connections are inherently slow, and being able to run more than one switch at once will be a big performance gain).
There is a Multiprocessing branch with some example code that i don't really have the skills to implement, would appreciate any attempts or guidance.
The current reload function for the switch does not work. It returns as a success but the switch does not register a reload.
Address an issue where the control SSH connection expires if a file copy takes a long time.
[INFO] - [MAIN]: 10.5.21.11 - Preparing to copy file...
[SUCCESS] - [MAIN]: 10.5.21.11 - Copy success################] 100.0% - c2960s-universalk9-mz.152-2.E9.bin
[INFO] - [MAIN]: 10.5.21.12 - Preparing to copy file...
Traceback (most recent call last):
File "C:\Tools\switch-upgrade-tool\scripts\swupgrade.py", line 253, in
main(parse_arguments())
File "C:\Tools\switch-upgrade-tool\scripts\swupgrade.py", line 243, in main
success = copy_file(copy_list, log)
File "C:\Tools\switch-upgrade-tool\scripts\swupgrade.py", line 183, in copy_file
switch.save_config()
File "C:\Tools\switch-upgrade-tool\scripts\netdevices.py", line 209, in save_config
self.ssh().send_command("wr mem")
File "C:\tools\python\lib\site-packages\netmiko\base_connection.py", line 1139, in > send_command
prompt = self.find_prompt(delay_factor=delay_factor)
File "C:\tools\python\lib\site-packages\netmiko\base_connection.py", line 972, in find_prompt
self.write_channel(self.RETURN)
File "C:\tools\python\lib\site-packages\netmiko\base_connection.py", line 360, in write_channel
self._write_channel(out_data)
File "C:\tools\python\lib\site-packages\netmiko\base_connection.py", line 331, in _write_channel
self.remote_conn.sendall(write_bytes(out_data, encoding=self.encoding))
File "C:\tools\python\lib\site-packages\paramiko\channel.py", line 846, in sendall
sent = self.send(s)
File "C:\tools\python\lib\site-packages\paramiko\channel.py", line 801, in send
return self._send(s, m)
File "C:\tools\python\lib\site-packages\paramiko\channel.py", line 1180, in _send
raise socket.error("Socket is closed")
OSError: Socket is closed
"""print the information from check_upgrade to the user"""
s_log = Logger(host)
if type == "error":
s_log.error(info, msg, msg_color)
elif type == "info":
s_log.info(info, msg, msg_color)
elif type == "success":
s_log.success(info, msg, msg_color)
else:
s.log.error("Something went wrong")```
Address a bug where the --reload flag doesnt work, unless used at the same time as the --upgrade flag, due to the reload pending exception.
swupgrade.py --host 10.123.21.11 --user *** --copy --upgrade
Password:
[SUCCESS] - 10.123.21.11: [C2960+][lanlite][15.0(2)SE6] - upgrade to 15.2(4)E7 - file already on flash
[INFO] - [MAIN]: 10.123.21.11 - Preparing to upgrade...
[SUCCESS] - [MAIN]: 10.123.21.11 - Upgrade success
swupgrade.py --host 10.123.21.11 --user *** --copy --upgrade --reload
Password:
[ERROR] - 10.123.21.11: Not supported - RELOAD PENDING
swupgrade.py --host 10.123.21.11 --user *** --copy --upgrade --reload
Password:
[SUCCESS] - 10.123.21.11: [C2960+][lanlite][15.0(2)SE6] - upgrade to 15.2(4)E7 - file already on flash
[INFO] - [MAIN]: 10.123.21.11 - Preparing to upgrade...
[SUCCESS] - [MAIN]: 10.123.21.11 - Upgrade success
[INFO] - [MAIN]: 10.123.21.11 - Preparing to reload...
[SUCCESS] - [MAIN]: 10.123.21.11 - Reload success, reloading in 5 mins
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.