This repository contains a collection of Python scripts for network automation tasks. These scripts utilize the scrapli
library for SSH connections, networkx
for network topology visualization, and various other libraries for parsing and processing data from network devices.
Input hosts file template is added to the repository.
Make sure you have Python 3 installed. You can install the required libraries using the provided requirements.txt
file:
pip install -r requirements.txt
This script fetches CDP/LLDP neighbor information from network devices specified in a CSV file and builds a network topology. It then visualizes the topology using networkx
and matplotlib
.
Usage:
- Modify the CSV file
hosts.csv
to include the details of network devices. - Run the script:
python GetDevices.py
This script connects to network devices, retrieves the hostname, and updates the hostname in the input CSV file.
Usage:
- Modify the CSV file
hosts.csv
to include the details of network devices. - Run the script:
python GetHostnames.py
This script parses MAC address table information from network devices' show commands and saves the results in a CSV file.
Usage:
- Place show command output files in the
output
directory. - Run the script:
python MacLookup.py
This script iterates over directories and deletes files with "_diff.txt" in their names.
Usage:
- Modify the
directory_path
variable in the script if needed. - Run the script:
python RemoveFiles.py
This script compares two directories containing files and generates diff files for differences.
Usage:
- Modify the
main_directory1
andmain_directory2
variables in the script. - Run the script:
python RunnDiff.py
This script connects to network devices, executes commands, and saves the command output in files.
Usage:
- Modify the CSV file
hosts.csv
to include the details of network devices. - Place the commands to be executed in the
commands.csv
file. - Run the script:
python SaveInfo.py
This script parses version information from network devices' show version commands and saves the results in a CSV file.
Usage:
- Modify the
directory_path
variable in the script - Place show command output files in the
directory_path
directory - Run the script:
python SaveVersion.py
Alexander Deca - Deca Consulting Date: 06/07/2023 For remarks/questions [email protected]
These scripts are provided as-is and may require adjustments based on your network environment and device configurations. Please review and modify the scripts before using them in production environments.