Original automation module from the submitted project. Lab credentials and the device inventory are not published.
# verify.py
# Automated Operational Validation Engine
# Connects to CORE-SW post-deployment and parses live operational state
# (ACL tables, static routing table, VLAN database) to confirm the automation
# suite configured the device correctly, without manual CLI inspection.
from netmiko import ConnectHandler
from devices import INVENTORY
def run_verification():
print("\n[*] Initiating Verification Engine Cycle...")
for device in INVENTORY["switches"]:
if device["role"] == "core":
try:
net_connect = ConnectHandler(**{
k: v for k, v in device.items() if k not in ("role", "name", "block")
})
# Query operational states
acl_state = net_connect.send_command("show ip access-lists")
route_state = net_connect.send_command("show ip route static")
vlan_state = net_connect.send_command("show vlan brief")
print(f"\n================ Verification Data for {device['name']} "
f"({device['host']}) ================")
print("[STATE LOGS] Active ACL Tables:")
print(acl_state)
print("\n[STATE LOGS] Static Routing Table:")
print(route_state)
print("\n[STATE LOGS] VLAN Database:")
print(vlan_state)
net_connect.disconnect()
except Exception as e:
print(f"[ERROR] Failed verification on device {device['name']} "
f"({device['host']}): {str(e)}")
if __name__ == "__main__":
run_verification()