This repo contains code, and examples from the Packet Coders pyATS webinar.
Note The webinar video can be viewed here: https://youtu.be/epzxoHr2YZE
The 2 demos that are included within this repo are:
- Example 1 - Create an interface error report.
- Example 2 - Perform a maintenance diff check.
The recording of the webinar can be viewed here (TBC).
To setup your environment to use the examples within this repo perform the following:
- Create a virtual environment To isolate the installation of your Python dependancies create a virtual environment.
python3 -m venv .venv
- Activate virtual environment Enter your virtual environment
source .venv/bin/activiate
- Install dependancies Install the various Python dependancies via PIP:
pip install -r requirements.txt
- Add credentials to .env Add your device credentials to .env. Like so:
cp .env-example .env
vim .env
PYATS_UNAME=### <--- update
PYATS_PWORD=### <--- update
Note: If you are running these examples against your own network please ensure you update the testbed.yml accordingly.
This example is based upon creating an interface error report for out_discards (via Python) using:
- Genie Parse
- Pcall
- Dq
- Rich
You can run the script like so:
$ ./examples/002_genie_parse_w_rich.py
This example is based upon diff`ing the network pre and post a network change (via the pyATS CLI) using:
- Genie Learn
- Genie Diff
To run this demo perform the following:
- Take a snapshot of the network (pre change):
$ ./examples/003_genie_diff_pre_1.sh
- Make the network change(s).
- Take a snapshot of the network (post change):
$ ./examples/004_genie_diff_post_2.sh
- Perform a diff between the pre and post change snapshots.
$ ./examples/005_genie_diff_compare_3.sh