Intermediate Lab
Interface Status Audit
Objective
Analyze a multi-device list of interface records and produce a structured audit report identifying three distinct real operational issues.
Builds on Reliable Automation.
Prerequisites
- Comfortable working with a list of dictionaries representing multiple devices
- Familiar with the idea of structured, multi-device results (Multi-Device Partial Failure and Structured Results)
Scenario
The problem
You already have interface data for three switches -- as if Lists & Dictionaries for Network Data and CLI Output Parsing had already done their job. But a pile of records isn't the same as knowing what's actually wrong. This lab is the next step: writing the checks that turn raw records into an audit finding a network engineer would actually act on.
Starter data
DEVICE_INTERFACES = [
{"device": "SW1", "interface": "Gi0/1", "status": "up", "protocol": "up", "input_errors": 0, "duplex": "full"},
{"device": "SW1", "interface": "Gi0/2", "status": "up", "protocol": "down", "input_errors": 12, "duplex": "full"},
{"device": "SW1", "interface": "Gi0/3", "status": "up", "protocol": "up", "input_errors": 8450, "duplex": "full"},
{"device": "SW2", "interface": "Gi0/1", "status": "up", "protocol": "up", "input_errors": 0, "duplex": "full"},
{"device": "SW2", "interface": "Gi0/2", "status": "up", "protocol": "up", "input_errors": 40, "duplex": "half"},
{"device": "SW2", "interface": "Gi0/3", "status": "administratively down", "protocol": "down", "input_errors": 0, "duplex": "full"},
{"device": "SW3", "interface": "Gi0/1", "status": "up", "protocol": "up", "input_errors": 0, "duplex": "full"},
]
ERROR_THRESHOLD = 1000Fixed sample data written for this lab -- seven interface records across three switches, not pulled from any live device.
Task
Write three functions, each returning a list of "DEVICE/interface" strings:
find_line_protocol_down(records)— interfaces wherestatus == "up"butprotocol != "up". This is a real, common signature: the physical layer is fine, but line protocol isn't negotiating (often a duplex/speed mismatch, an encapsulation mismatch, or a bad cable).find_high_error_interfaces(records, threshold=ERROR_THRESHOLD)— interfaces whereinput_errorsexceeds the threshold.find_half_duplex(records)— interfaces that areupand runninghalfduplex — worth flagging on its own, since half duplex on modern switch gear is usually a misconfiguration.
Then write audit_report(records) that returns one dict combining all three findings under keys line_protocol_down, high_error_interfaces, half_duplex.
Expected output
{'line_protocol_down': ['SW1/Gi0/2'], 'high_error_interfaces': ['SW1/Gi0/3'], 'half_duplex': ['SW2/Gi0/2']}Real, verified output. Notice SW2/Gi0/3 (administratively down) and SW3/Gi0/1 (fully healthy) correctly appear in none of the three lists.
Self-check only -- nothing here is submitted or graded. Compare against your own output manually.
Solution
Try the task yourself first -- the full solution and explanation stay hidden until you click above.
Key takeaways
- An audit isn't just "collect the data" -- it's a specific set of named conditions checked against data you already have.
- "Up but protocol down" is a real, recognizable operational signature worth its own named check, not just a generic status flag.
- Separating each find_* check from the final report format keeps each check independently reusable and testable.
- All data here is fixed, offline sample data -- no device or connection was involved.
Related lessons
Done with this lesson?