Rolling back configuration changes using NAPALM
Loading a configuration onto a device blindly, without verifying which lines actually change, can be a dangerous game, especially if the configuration that is being loaded has hundreds of lines or was generated programmatically. So, wouldn't it be nice if we could get a visual representation of all the changes that will be applied to our configuration and then decide whether we actually want to go ahead and apply them or discard the changes?
This is exactly what NAPALM allows you to do by using the compare_config()
function together with commit_config()
and rollback()
.
Getting ready
Open your code editor and create a file called rollback.py
. Next, in your Terminal, navigate to the same directory that you just created the rollback.py
file in.
How to do it…
The following steps demonstrate how to connect to a device, view the differences between the new configuration and the old configuration, and then lets you...