Update IOS program

Started by dlots, February 13, 2017, 02:25:43 PM

Previous topic - Next topic

dlots

We have a project to update the IOSs on ~8,000 cisco devices, so I wrote a program for it: I'll try and put it up on github if you think people would be interested
I have it mostly working, it takes ~10min per device to get the code onto each device (you can run however many copies the file-server/bandwidth will support though). 
You just run this from the cli on a PC/server with the proper libraries installed.


"upgrade IOS.py" username password ftp_server_IP IOS_name

"upgrade IOS.py" dlots fakepassword 10.0.0.1 c2800nm-advipservicesk9-mz.124-25c.bin

Inside the same folder as the program is a txt document named "device list.txt" that has all the devices in it we will want to update.
It then downloads the IOS over FTP (no SCP cause I don't seem to be able to run it on my laptop, not cause I particularly need FTP)
Verifies the IOS copied over correctly.
Removes existing boot statements
Updates the boot statement
Verifies the boot statement is in the running config
Saves the config
Updates Status.csv to say that the current device has been updated

Current Limitations:
•   It is currently device specific I only have a 2800 to test with currently, but Cisco's devices have a tendency to change a little from device type to device type, so I might end up with a slightly different version for each majorly different hardware type, or another couple variables hanging off the end.
o   The location of the directory is different from one device to another (flash vs bootflash)
o   The terminology for successful verifications of the IOS
o   ETC
•   It doesn't  currently do as much error checking as I would like
o   Checking free space before copying
o   Seeing if the OS is already there before copying it over.
o   Making sure the device it SSHed to is the right kind of device (don't want to copy a 2800 to a 3650)
o   Error checking along the way to see if something gets messed up
o   etc


wintermute000

nice work! pls put it up on github

Take a look at this for a start - using ansible would take a lot of the logic handling / error handling work away

https://networklore.com/ansible-ios-upgrade/