Automatic Cisco IOS firmware upgrades
Requires:
Automates the entire upgrade process:
Auto-detects best upgrade method available:
archive download-sw
software install
request platform software package install
copy
followed by set boot ...
Supported platforms:
Experimentally supported platforms:
Currently unsupported platforms:
NOTE: Use at your own risk. It works well in my environment, but serious bugs are possible. Test thoroughly in a lab environment, and see known issues below.
config/config.yaml.example
to config.yaml
, and review config/images.yaml
, matching both to your requirements. Defaults are sane, but don't take any chances :)images.yaml
to the src_image_path
defined in config.yaml
.Note: Pay special attention if you have devices of the same model, but need different IOS images (e.g., ipbase vs ipservices). In that case, define both images in images.yaml
and add the same model to their respective models
lists. Then, change match_feature_set
to true
in config.yaml
.
>>> from iosfw import iosfw
>>> device = iosfw('ios-sw-1')
>>> device.open()
Username [austindcc]:
Password:
Enable secret:
Opening connection to ios-sw-1...
Connected to ios-sw-1 (WS-C3560X-48P) as austind via ssh
Running version: 12.2(55)SE8
Upgrade version: 15.2(4)E8
Upgrade status: NEEDS UPGRADE
>>> device.upgrade()
Starting upgrade on ios-sw-1 at 14:34:09 06/13/19...
Checking free space...
Found enough free space!
Installing new firmware...
NOTE: No status updates possible during install, which may take 10 minutes or longer.
Install successful!
Removing running image...
Deleting flash:/c3560e-universalk9-mz.122-55.SE8...
Running image deleted.
Scheduling reload...
Reload scheduled for 00:00:00 PDT Fri Jun 14 2019 (9 hours and 16 minutes away)
Upgrade on ios-sw-1 completed at 14:43:32 06/13/19
Total time elapsed: 0:09:23.224298
iosfw
no longer works. I recommend setting up an FTP server on a separate host and setting config.yaml
accordingly.request platform software package install
. Upgrading them requires a different manual process that is not yet implemented:
del /force flash:/cat*.pkg
del /force flash:/packages.conf
no boot system
in config modecopy <source> flash:
request platform software package expand switch all file flash:/<file>
boot system flash:/<file>
reload at 00:00
iosfw
does not check to ensure transfer_source
is reachable. If not reachable, the install command will fail, but not timeout for more than 30 minutes. Most commonly, transfer_source
may not be reachable due to sending the requests out the incorrect interface. You can specify the source interface for TFTP and FTP transfers with ip (ftp|tftp) source-interface <iface>
in config mode.iosfw
throws a ProcessLookupError
on exit. I have not found a way to catch or suppress this.napalm
connection objecttransfer_source
, attempting fix as neededContributions welcome.
See CHANGELOG.md
archive download-sw
and request platform software package install
) download the upgrade package twice, for reasons I did not determine.iosfw
class exposes all of NAPALM's config parameters, and stores the NAPALM session under self.napalm
, so you can use all of NAPALM's features easily.self.device
- so you can send arbitrary commands with iosfw.device.send_command('my arbitrary command')