device-checker

published

A script that connects to network devices and checks for the presence of commands (globally/per interface) defined in a basline file

Requirements

netmiko==3.2.0

paramiko==2.7.1

prettytable==0.7.2

pyaml==20.4.0

Installation

git clone https://github.com/catachan/config-checker.git
cd config-checker

Create virtual enviroment (optional)

python3 -m venv config-checker
source config-checker/bin/activate

install dependencies

pip install -r requirements.txt 

Online mode

connect to device defined in connection.yaml file via ssh and collect "show run" and additional show command output and check against config in baseline.yaml

python main.py -b [baseline.yaml] -c [connection.yaml]

Image of online mode

Offline mode

check config files in directory (one per device) against baseline.yaml file. Please notice that only "show run" output can be checked in offline mode

python main.py -b [baseline.yaml] -d [config directory]

Image of of offline

Optional parameters

-f

display/log only failed check/ suppress passed checks
Image of of failed mode

-r [report.json]

log also to json file additional to console output. The report file contains also the raw data that was checked

Image of report mode
Image of report mode

-l [logfile.txt]

log console output also to logfile (so you are able to see the complete output later on)

Samples for baseline.yaml and connection.yaml in examples directory

Convert to windows exe

To convert the python file use python package auto-py-to-exe.exe
pip install auto-py-to-exe
auto-py-to-exe

View code on GitHub

Code Exchange Community

Get help, share code, and collaborate with other developers in the Code Exchange community.View Community
Disclaimer:
Cisco provides Code Exchange for convenience and informational purposes only, with no support of any kind. This page contains information and links from third-party websites that are governed by their own separate terms. Reference to a project or contributor on this page does not imply any affiliation with or endorsement by Cisco.