Saturday, October 24, 2020

Automate your network device backup with a excel sheet and python - Part 1

Script is written using below python libraries

  1.     Netmiko - For  SSH and Telnet to the device and read the output.
  1.     Xlrd - For reading data and formatting information from Excel (xls or .xlsx files)
  1.     prettytable - To print tables in an attractive ASCII form


Download a copy from: 
https://github.com/arazzan/network_backup_with_python.git

Excel Sheet Sample
    A1. Device_Location    *required
    B1. Serial_Number
    C1. Device_Name_or_Hostname    *required
    D1. Device_type - Platform Support and more details in below link    *required
                                     https://pynet.twb-tech.com/blog/automation/netmiko.html
    E1. IP_address (hostname also supported, if DNS can resolve to IP)    *required
    F1. Software_Version
    G1. Model Number
    H1. Access_Method





Example: Backup all the devices listed in the excel sheet.

>py Backup_Devices.py
>python Backup_Devices.py
Please enter authentication details for template book "MyDevicesUploadTemplate"
"MyDevicesUploadTemplate" need to placed with this app folder
Enter User Name : admin
Enter Password :

* Authentication details of devices need to be type in. User account should have privileges to read the running config.


Once all set, Script will start to backup the device an stored into the folders.

File Path of backup file 

BASE DIR > Current Year > Current Month > Current Date > Device_Location

File Name

IP_address_Current-Date-&-Time.txt


No comments:

Post a Comment