LOGBOOK

HELP

Quiz Entry - updated: 2026.10.15

Walk through what a basic pyATS script does to check that an interface is up.

It loads a testbed with one router, connects to it over SSH, fetches the status of all interfaces, and checks whether GigabitEthernet1 is "up".

Steps of a basic pyATS check from testbed file to interface status check

* Load the testbed, connect over SSH, fetch interface status as a dictionary, check one value. *

from pyats.topology import loader
from genie.libs.sdk.apis.iosxe.interface.get import get_interface_status

testbed = loader.load("testbed.yaml")       # 1. load testbed (Router1, iosxe, ssh)
device = testbed.devices["Router1"]
device.connect()                            # 2. SSH to the router

status = get_interface_status(device=device)  # 3. status of all interfaces

intf = "GigabitEthernet1"                   # 4. check one interface
if intf not in status:
    print(f"{intf} not found")
elif status[intf]["status"] == "up":
    print(f"{intf} is up")
else:
    print(f"{intf} is DOWN")

The script never touches raw CLI text. The Genie API returns a Python dictionary, so the check is a normal lookup and comparison. The same pattern scales to hundreds of devices: loop over testbed.devices instead of picking one.

Go deeper:

From Quiz: ITIA / Infrastructure Automation: DevOps, GitOps, Deployment Strategies and Network Testing | Updated: Oct 15, 2026