Cisco IOS-XE Guestshell ZTP Script for Catalyst 9000 Series Switches
Overview
This script will be pushed to the device and then executed on-box. There are static variables set within the script that will need to be adjusted to match your environment.
Requirements
- Catalyst 9000 series switch
- Management port
- DHCP server
- Option 67 (only) if http/https server is available, ex.
http://fileserver/ztp.py
- Option 150 specifies TFTP server
- Option 67 specifies the name of the file
ztp.py
Variables
- TFTP Server
- Image name
- Image MD5
- File system
- Config file
- Uses serial number obtained from the device
Workflow - Upgrade Required
- Obtain serial number from device
- Set
config_file
variable to serialnumber.cfg
- Checks to see if image exists on device
- If the file exists, verify MD5 hash
- If MD5 hash does not match, retransfer
- If file does not exist, transfer file and verify MD5 hash
- Deploy EEM script to upgrade device (install mode)
- Device reboots
- See Workflow - Upgrade NOT Required
Workflow - Upgrade NOT Required
- Obtain serial number from device
- Set
config_file
variable to serialnumber.cfg
- Checks to see if configuration exists on device
- If not, transfer file over
- Find and remove any existing certs on device
- Deploy configuration using EEM script (configure replace)
Things To Note
Configure replace requires commands to be exact which can cause the configuration deployment to fail. Make sure all commands have been tested prior to deployment.