There are times when we need to relocate, shut down, or migrate a site to a different location. This involves a lot of pre-checks, pre-validations, and ensuring the same setup of network PoD is active in the other location.
In a multi-vendor environment, and with the increasing SKU size based upon t-shirt size, keeping a track of all active sessions, traffic flows, current interface status, and specific routes manually is difficult. Using Python, we can create an automated way to create a basic checklist and it can be ensured that after relocation the same checklist acts as a post validation checklist.
As an example, we create a basic script that asks if we need to perform a pre-check/post-check and save that in files named pre-check
and post-check
:
from netmiko import ConnectHandler import time def getoutput(cmd): uname="cisco" passwd="cisco" device = ConnectHandler(device_type='cisco_ios', ip="192.168.255.249", username=uname, password=passwd) output...