Pyats routing

From automateyournetwork/netclaw · View interactive version

Pyats routing is an AI agent skill from the GitHub repository automateyournetwork/netclaw. CCIE-level routing protocol analysis for Cisco IOS/IOS-XE/NX-OS devices - OSPF, BGP, EIGRP, IS-IS, static routes, RIB/FIB verification, redistribution audit, and convergence validation. Use when analyzing routing tables, debugging OSPF neighbors, checking BGP peering, verifying route redistribution,

How to use this skill

Skill file

Routing Protocol Analysis

Dynamic-inventory note (Spec160): for NETCLAW_TESTBED_MODE=dynamic, use the

persistent native pyATS MCP session that composed, validated and explicitly activated

the reviewed candidate. Separate MCP_CALL processes do not share dynamic inventory.

Use scripts/pyats-testbed-session.py only for bounded preview/activate/list; it does

not perform device operations. The static examples below apply to static mode.

See docs/DYNAMIC-TESTBEDS.md; all existing device/change-control requirements apply.

Routing Table Analysis

Always start here. The routing table is the source of truth for forwarding decisions.

Full Routing Table

PYATS_TESTBED_PATH=$PYATS_TESTBED_PATH python3 $MCP_CALL "${PYATS_PYTHON:-python3} -u $PYATS_MCP_SCRIPT" pyats_run_show_command '{"device_name":"R1","command":"show ip route"}'

Per-Protocol Routes

# OSPF routes only
PYATS_TESTBED_PATH=$PYATS_TESTBED_PATH python3 $MCP_CALL "${PYATS_PYTHON:-python3} -u $PYATS_MCP_SCRIPT" pyats_run_show_command '{"device_name":"R1","command":"show ip route ospf"}'

# BGP routes only
PYATS_TESTBED_PATH=$PYATS_TESTBED_PATH python3 $MCP_CALL "${PYATS_PYTHON:-python3} -u $PYATS_MCP_SCRIPT" pyats_run_show_command '{"device_name":"R1","command":"show ip route bgp"}'

# Connected and static
PYATS_TESTBED_PATH=$PYATS_TESTBED_PATH python3 $MCP_CALL "${PYATS_PYTHON:-python3} -u $PYATS_MCP_SCRIPT" pyats_run_show_command '{"device_name":"R1","command":"show ip route connected"}'

PYATS_TESTBED_PATH=$PYATS_TESTBED_PATH python3 $MCP_CALL "${PYATS_PYTHON:-python3} -u $PYATS_MCP_SCRIPT" pyats_run_show_command '{"device_name":"R1","command":"show ip route static"}'

VRF Routes

PYATS_TESTBED_PATH=$PYATS_TESTBED_PATH python3 $MCP_CALL "${PYATS_PYTHON:-python3} -u $PYATS_MCP_SCRIPT" pyats_run_show_command '{"device_name":"R1","command":"show ip route vrf MGMT"}'

Analysis checklist:


OSPF Deep Dive

OSPF Process Overview

PYATS_TESTBED_PATH=$PYATS_TESTBED_PATH python3 $MCP_CALL "${PYATS_PYTHON:-python3} -u $PYATS_MCP_SCRIPT" pyats_run_show_command '{"device_name":"R1","command":"show ip ospf"}'

Check: Router ID, areas configured, SPF run count (high = instability), reference bandwidth, stub/NSSA config, authentication.

OSPF Neighbors

PYATS_TESTBED_PATH=$PYATS_TESTBED_PATH python3 $MCP_CALL "${PYATS_PYTHON:-python3} -u $PYATS_MCP_SCRIPT" pyats_run_show_command '{"device_name":"R1","command":"show ip ospf neighbor"}'

Neighbor state analysis:

Common OSPF problems and their symptoms:

| Symptom | Likely Cause |

|---------|-------------|

| Stuck in EXSTART | MTU mismatch between neighbors |

| Stuck in INIT | Hello reaching neighbor but not returning (ACL, asymmetric routing) |

| Neighbor flapping | Unstable link, hello/dead timer too aggressive, CPU too high to process hellos |

| Missing routes | Area type mismatch (stub vs non-stub), missing redistribute or default-information originate |

| Suboptimal routing | Cost misconfiguration, missing auto-cost reference-bandwidth |

OSPF Interfaces

PYATS_TESTBED_PATH=$PYATS_TESTBED_PATH python3 $MCP_CALL "${PYATS_PYTHON:-python3} -u $PYATS_MCP_SCRIPT" pyats_run_show_command '{"device_name":"R1","command":"show ip ospf interface"}'

Check per interface: Area assignment, network type (broadcast/point-to-point/NBMA), cost, hello/dead timers, DR/BDR election, authentication type, passive status.

OSPF Database (LSDB)

PYATS_TESTBED_PATH=$PYATS_TESTBED_PATH python3 $MCP_CALL "${PYATS_PYTHON:-python3} -u $PYATS_MCP_SCRIPT" pyats_run_show_command '{"device_name":"R1","command":"show ip ospf database"}'

LSA types to understand:

Red flags in LSDB:


BGP Deep Dive

BGP Summary

PYATS_TESTBED_PATH=$PYATS_TESTBED_PATH python3 $MCP_CALL "${PYATS_PYTHON:-python3} -u $PYATS_MCP_SCRIPT" pyats_run_show_command '{"device_name":"R1","command":"show ip bgp summary"}'

Check: Local AS, router ID, table version, total paths/best paths, per-neighbor state.

Neighbor state column meaning:

BGP Neighbors Detail

PYATS_TESTBED_PATH=$PYATS_TESTBED_PATH python3 $MCP_CALL "${PYATS_PYTHON:-python3} -u $PYATS_MCP_SCRIPT" pyats_run_show_command '{"device_name":"R1","command":"show ip bgp neighbors"}'

Deep analysis per neighbor:

Common BGP problems:

| Symptom | Likely Cause |

|---------|-------------|

| Stuck in Active | TCP connection failing — check ACL, reachability, update-source, ebgp-multihop |

| Neighbor flapping | Unstable link, route-map causing route churn, max-prefix exceeded |

| 0 prefixes received | No network or redistribute on remote side, outbound filter on remote, address-family not activated |

| Routes not in RIB | Next-hop unreachable (next-hop-self missing for iBGP), route filtered by policy |

| Suboptimal path | Weight/local-pref/AS-path/MED not set correctly |

BGP Table

PYATS_TESTBED_PATH=$PYATS_TESTBED_PATH python3 $MCP_CALL "${PYATS_PYTHON:-python3} -u $PYATS_MCP_SCRIPT" pyats_run_show_command '{"device_name":"R1","command":"show ip bgp"}'

BGP best path selection order (memorize this):

  1. Highest Weight (Cisco proprietary, local to router)
  2. Highest Local Preference (iBGP, default 100)
  3. Locally originated (network/redistribute/aggregate)
  4. Shortest AS-path
  5. Lowest Origin (IGP < EGP < Incomplete)
  6. Lowest MED (from same neighbor AS only)
  7. eBGP over iBGP
  8. Lowest IGP metric to next-hop
  9. Oldest route (for eBGP)
  10. Lowest router ID
  11. Lowest neighbor IP

EIGRP Analysis

EIGRP Neighbors

PYATS_TESTBED_PATH=$PYATS_TESTBED_PATH python3 $MCP_CALL "${PYATS_PYTHON:-python3} -u $PYATS_MCP_SCRIPT" pyats_run_show_command '{"device_name":"R1","command":"show ip eigrp neighbors"}'

Check: Hold timer (resetting to max means hellos received), uptime, SRTT, RTO, Q count (should be 0 — non-zero means retransmission queue backed up).

EIGRP Topology

PYATS_TESTBED_PATH=$PYATS_TESTBED_PATH python3 $MCP_CALL "${PYATS_PYTHON:-python3} -u $PYATS_MCP_SCRIPT" pyats_run_show_command '{"device_name":"R1","command":"show ip eigrp topology"}'

DUAL states:

EIGRP metric components (classic): Bandwidth, Delay, Reliability, Load, MTU (only BW and delay used by default).

EIGRP metric components (wide/named mode): Throughput, Latency, Reliability, Load, MTU, Extended attributes.


Redistribution Audit

When multiple routing protocols are in use, check redistribution points:

PYATS_TESTBED_PATH=$PYATS_TESTBED_PATH python3 $MCP_CALL "${PYATS_PYTHON:-python3} -u $PYATS_MCP_SCRIPT" pyats_run_show_command '{"device_name":"R1","command":"show ip protocols"}'

Redistribution checklist:

Route Filtering Verification

PYATS_TESTBED_PATH=$PYATS_TESTBED_PATH python3 $MCP_CALL "${PYATS_PYTHON:-python3} -u $PYATS_MCP_SCRIPT" pyats_run_show_command '{"device_name":"R1","command":"show route-map"}'

PYATS_TESTBED_PATH=$PYATS_TESTBED_PATH python3 $MCP_CALL "${PYATS_PYTHON:-python3} -u $PYATS_MCP_SCRIPT" pyats_run_show_command '{"device_name":"R1","command":"show ip prefix-list"}'

Convergence Validation

After any routing change, verify convergence:

  1. Check all expected neighbor adjacencies are FULL/Established
  2. Verify the routing table has all expected prefixes
  3. Ping across the network from the device to validate data plane
  4. Check logs for any protocol events during the change
  5. Compare route counts before and after
# Verify route count
PYATS_TESTBED_PATH=$PYATS_TESTBED_PATH python3 $MCP_CALL "${PYATS_PYTHON:-python3} -u $PYATS_MCP_SCRIPT" pyats_run_show_command '{"device_name":"R1","command":"show ip route summary"}'

Failure Behavior

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.