Skip to content

pdudotdev/YANA

Repository files navigation

YANA • Yet Another Network Agent

Version License Last Commit

Platforms Cisco IOS Cisco IOS-XE Arista EOS Juniper JunOS Aruba AOS Vyatta VyOS MikroTik RouterOS FRR
Transport SSH Scrapli
Integrations MCP ChromaDB JUnit XML

Overview

RAG-powered network QA investigation tool for multi-vendor networks.

Run your tests with any framework. When something fails, YANA investigates - it queries live devices, searches protocol specs, follows diagnostic decision trees, and tells you why it failed and what to fix.

Supported models:

  • Haiku 4.5, Sonnet 4.6, Opus 4.6 (default, best reasoning)

Documentation:

What's new:

Tech Stack

Technology Role
Python Core language
FastMCP MCP server exposing 8 tools
Claude Reasoning, context, investigation
LangChain RAG pipeline (chunking, embedding, retrieval)
ChromaDB Vector database for knowledge base
Scrapli Multi-vendor SSH transport
JUnit XML Test results format

Scope

Protocol What's Checked
OSPF Adjacencies, area and area types, config, LSDB
Routing Table, route maps, prefix lists, PBR, ACLs, ECMP
Interfaces Up/down state, expected operational status

Test Network Topology

Network diagram:

topology

Lab environment:

  • 16 devices defined in TOPOLOGY.yml
  • 5 x Cisco IOS, 3 x Cisco IOS-XE, 4 x Arista cEOS, 2 x MikroTik CHR, 1 x Juniper JunOS, 1 x Aruba AOS-CX
  • See lab_configs for my test network's configuration

Installation

Prerequisites: Python 3.11+

Step 1 - Install and ingest:

sudo apt install git make python3.12-venv -y
cd ~ && git clone https://github.com/pdudotdev/YANA
cd YANA && make setup

Step 2 - Configure credentials:

cp .env.example .env
# Edit .env with your device credentials

Step 3 - Authenticate with Claude:

claude auth login

Step 4 - Register the MCP server:

claude mcp add yana -s user -- /home/<user>/YANA/yana/bin/python /home/<user>/YANA/server/MCPServer.py

MCP Tools

Tool Description
get_status Report active data sources (inventory, intent, KB)
list_devices List inventory devices, optionally filtered by CLI style
get_ospf Query OSPF state (neighbors, LSDB, process config) on a live device
get_interfaces Query interface up/down status on a live device
get_routing Query routing table, route maps, prefix lists, PBR, and ACLs on a live device
query_intent Retrieve network design intent from local JSON
traceroute Trace the forwarding path from a device to a destination IP
search_knowledge_base Search network knowledge base (RFCs, vendor guides) with protocol/vendor/topic filters

Customization

YANA is designed to work with your own test topology. Bring your own:

What Where Format
Device inventory data/NETWORK.json JSON dict: device name -> host, platform, cli_style
Design intent data/INTENT.json JSON: router roles, OSPF areas, links, neighbors
Protocol docs docs/*.md Protocol data (re-ingest with make ingest)
Test results results/*.xml JUnit XML from any test runner
Credentials .env ROUTER_USERNAME and ROUTER_PASSWORD

QA Workflow

  1. Run your tests with any framework (pytest, pyATS, Ansible, etc.)
  2. Place JUnit XML results in results/
  3. Investigate failures with the /qa skill:
claude
> /qa

The /qa skill loads the latest JUnit XML, lists all failures, and investigates each one using live device queries, network intent, and RFC context.

Knowledge Base

Protocol documentation lives in docs/ as Markdown files. Each file is tagged with vendor, topic, and protocol metadata during ingestion.

To update after editing docs:

make ingest

RAG optimizations in place:

  • protocol metadata field - filters search by protocol (ospf, bgp, eigrp), eliminating cross-protocol noise
  • Contextual chunk headers - source and protocol prepended to each chunk for better embedding quality
  • Compound filtering - combine vendor, topic, and protocol filters in a single query

See OPTIMIZATIONS.md for the full optimization roadmap.

Project Structure

YANA/
├── server/
│   └── MCPServer.py              # FastMCP server (8 tools)
├── tools/                        # MCP tool implementations
│   ├── ospf.py                   # get_ospf
│   ├── operational.py            # get_interfaces, traceroute
│   ├── routing.py                # get_routing
│   ├── intent.py                 # query_intent
│   ├── status.py                 # get_status
│   ├── inventory_tool.py         # list_devices
│   └── rag.py                    # search_knowledge_base
├── core/                         # Infrastructure
│   ├── inventory.py              # Device dict (from data/NETWORK.json)
│   └── settings.py               # Credentials + SSH config
├── data/                         # Data files
│   ├── NETWORK.json              # Device inventory
│   ├── INTENT.json               # Network design intent
│   └── chroma/                   # ChromaDB vector store (generated)
├── transport/                    # SSH execution (Scrapli)
│   ├── __init__.py               # Command dispatcher + semaphore
│   └── ssh.py                    # Multi-vendor SSH executor
├── platforms/                    # Vendor CLI command mapping
│   ├── platform_map.py           # OSPF, routing, interface + traceroute commands (6 vendors)
│   └── definitions/              # Custom Scrapli definitions
├── input_models/
│   └── models.py                 # Pydantic validation (OspfQuery, KBQuery, etc.)
├── docs/                         # Knowledge base (RFCs + vendor guides)
├── results/                      # QA test results (JUnit XML)
├── skills/
│   ├── ospf/                     # OSPF diagnostic decision tree
│   └── routing/                  # Routing diagnostic decision tree
├── testing/
│   ├── automated/                # Unit + integration tests
│   ├── live/                     # Live lab tests
│   └── run_tests.sh              # Test runner (--live for lab tests)
├── metadata/
│   ├── guardrails/               # Security controls documentation
│   ├── scalability/              # RAG optimization roadmap
│   ├── topology/                 # Test network diagram
│   └── workflow/                 # RAG pipeline walkthrough
├── ingest.py                     # RAG ingestion pipeline
├── Makefile                      # Setup automation (make setup)
├── CLAUDE.md                     # Investigation workflow + tool reference
├── TOPOLOGY.yml                  # Containerlab topology definition
├── .env.example                  # Credential template
├── CHANGELOG.md                  # Version history
├── LICENSE
├── requirements.txt
└── README.md

Planned Upgrades

  • EIGRP and BGP support (tools, skills, knowledge base docs)

Disclaimer

You are responsible for defining your own network inventory and design intent, building your test environment, and meeting the necessary prerequisites (Python 3.11+, Claude CLI/API, network device access).

License

Licensed under GNUv3.0.

Collaborations

Interested in collaborating?

About

RAG-powered troubleshooting assistant for multi-vendor networks. When something fails, YANA investigates - it queries live devices, searches protocol specs, follows diagnostic decision trees, and tells you why it failed and what to fix.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors