This program is designed to send a set of Cisco commands to multiple network devices from text files.
This Python script was tested in a physical lab environment and on IOS XE on CSR Latest AlwaysOn v17.3.1 Cisco DevNet Sandbox.
$ git clone https://github.com/Tes3awy/Send-Config-From-File-To-Devices.git
$ cd Send-Config-From-File-To-Devices
$ pip install -r requirements.txtpython main.pyThe Python script runs as following:
- Reads IP addresses in data/device_ip_list.txt.
- Checks if those IP addresses are valid IPv4 addresses using built-in Python3 ipaddressmodule.
- Pings those IP addresses using Ping3 to check reachability.
- If an IP address is UNREACHABLE for whatever reason, then this IP is added to data/failure.txtwith its error message.
- If an IP address is REACHABLE, then this IP is added to data/success.txt.
 
- If an IP address is UNREACHABLE for whatever reason, then this IP is added to 
- Reads each IP addresse in data/success.txtone by one.
- Prompts the user to enter a username and a password.
These username and password will be used for all network devices of those IP addresses in
data/device_ip_list.txt.
- Initiates a Telnet session to each device one by one using Netmiko.
- Sends commands from data/config.txtto the device of that IP address.
- Saves the configuration on the device.
- Terminates the session.
- You want to add the same exact set of commands to all the devices in your network. Then this script is the best option for this task.
- Username you are logging in with has privilege 15in it. i.e.
username cisco privilege 15 algorithm-type scrypt secret cisco
This Python script does not check for enable mode. It's left to the user to add the
(en)ablecommand at the very top in thedata/config.txtfile and not set anenable secretcommand.
- Enable MultiThreading.