NetworkMonitoring
Python Code that allows Network Engineers to apply use-cases exploring Network Observability, Assurance and Automation to enhance Network Monitoring
Overview
Python Code that allows Network Engineers to enhance monitoring capability by targeting specific triggers within the network infrastructure.
Use Case Description
This use case is particularly helpful in validating network observability & assurance by utilizing defined triggers. PYATS's modular methods with parsing makes it incredibly easy to extract the specific information required. (In this case route presence within the table).
Python
The script is written in python using PYATS to interact with the active devices, a GENIE model API to extract the state of a route within the routing table, and store the results in a json file.
Output: The results of the state is stored in a json file. This can also be enhanced to execute follow up actions such as shutdown an interface, etc.
Contacts
*Oluyemi Oshunkoya (yemi_o@outlook.com)
Solution Components
*Python
*Genie
*PYATS
Prerequisites
Python3.6 and above
Toolbox
Main.py: includes the main script run which contains relevant code to connect to the devices highlighted in the testbed file and returns the outcome as a json file.
Gene.yml: this is the PYATS testbed file that contains the device/devices that would be connected to.
You can test this on Cisco's DevNet Sandbox Labs/IOS XE on CSR Latest Code - AlwaysOn/IOS XE on CSR Latest Code AlwaysOn1
Step 1 - Downloading - Option A Using a Docker Image
-
Download and setup docker suitable for your Operating System
https://docs.docker.com/get-docker/
-
Download the latest version of the PYATS from docker hub
$ docker pull ciscotestautomation/pyats:latest
- Run the docker image
$ docker run -it ciscotestautomation/pyats:latest /bin/bash
Step 1 - Downloading - Option B Using GIT
- Clone the repository
git clone https://github.com/yzmar4real/networkmonitoring.git
- CD into the directory
cd networkmonitoring
- (Optional) Use the directory as a virtual environment for the project
python3 -m venv .
- (Optional) Start the virtual environment and install the requirements for the project
source bin/activate
Step 2 - Defining the Testbed for devices to be audited
- Edit genie.yml file to include parameters for your devices. It is usually advisable to target the device with the most outbound interface.
Step 3 - Executing the Script
- Execute the main script from console
python3 Main.py