In this lesson, we will cover:
- What is Genie Diff?
- How to run Genie Diff via the command line.
- How to exclude keys from comparison via the command line.
- How to run Genie Diff via Python.
- How to use pickle to save the network state when comparing.
- How to exclude keys from comparison via Python.
The scripts and code for this lesson can be found within the pyATS repo under the directory:
What is Genie Diff?
So far, we have used Genie Parse and Learn to take a snapshot of the network at a given point in time. However, let’s say it was reported that there were issues in the network. A user has contacted us, and they cannot get to an internal app. Sure, we could run a Genie Parse or a Genie Learn. But we would need to dig through the whole output, looking for issues. Wouldn’t it be better to compare this output against a known working output (snapshot) and report just the differences? This is where
Diff comes into play.
Diffallows you to perform a comparison between 2 snapshots and return the differences.
Therefore, using the
Diff features opens up some extremely useful use cases:
- Creating a golden snapshot. You can take a new snapshot at the point of network failure and compare it to the golden snapshot to pinpoint the issue.
- Create a snapshot before a maintenance and then compare the two to ensure the maintenance hasn't caused any potential issues in the network.
Whether we are running the Diff via the command line or Python depends on what we provide the Diff tool for it to make its comparison. When running Diff via the command line, we provide it with the Genie text output files. When running Diff using Python, we provide the Diff Python objects.
Let's dive into some examples!