NetAuto Academy

Intermediate Lab

Interface Status Audit

Intermediate25 min

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)
Local/offline only. The interface records below are fixed sample data, not pulled from any live device.

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

starter.py
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 = 1000

Fixed 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:

  1. find_line_protocol_down(records) — interfaces where status == "up" but protocol != "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).
  2. find_high_error_interfaces(records, threshold=ERROR_THRESHOLD) — interfaces where input_errors exceeds the threshold.
  3. find_half_duplex(records) — interfaces that are up and running half duplex — 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.

Hints

Expected output

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.

Validation checklist

Self-check only -- nothing here is submitted or graded. Compare against your own output manually.

Solution

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?