Back to DevOps & CI/CD

Cisco Network Diagram Generator

cisconetworkingdrawiodiagrammingautomation
4.3 (70)2📄 MIT🕒 2025-10-21Source ↗

Install this skill

npx skills add neuro-synapse/network-topology-agent

Works across Claude Code, Cursor, Codex, Copilot & Antigravity

What this skill does

  • Parses device hostnames, IPs, and interface types from Cisco config files
  • Maps L2/L3 topology using CDP and LLDP neighbor data
  • Generates XML output compatible with Draw.io
  • Automates iconography for routers, switches, firewalls, and servers
  • Supports multiple layout engines like hierarchical and left-to-right

When to use it

  • Documenting existing network infrastructure from backup configs
  • Visualizing the impact of VLAN changes or routing updates
  • Generating network maps for audits or compliance reports
  • Onboarding team members by providing instant visual topology overviews

When not to use it

  • Real-time monitoring of live device status or traffic patterns
  • Directly interacting with or configuring live hardware via SSH
  • Generating diagrams for non-Cisco networking gear

How to invoke it

Example prompts that trigger this skill:

  • Visualize the network topology based on these Cisco config files.
  • Generate a Draw.io diagram from the provided switch and router configurations.
  • Map my infrastructure layout using the configs in the /configs folder.
  • Create a physical topology diagram showing CDP neighbor connections.
  • Plot the network hierarchy for our core and distribution switches.

Example workflow

  1. Collect running-config files from target Cisco devices.
  2. Place all files into a single directory accessible by the agent.
  3. Execute the parsing script to extract interfaces, VLANs, and neighbors.
  4. Define layout preferences for the final diagram (e.g., hierarchical).
  5. Run the generator to output the .drawio XML file.
  6. Open the generated file in Draw.io for final adjustments.

Prerequisites

  • Python 3.8+
  • drawio-network-plot library installed via pip
  • Read-only access to device configuration text files

Pitfalls & limitations

  • !Requires clean configuration files; heavily customized or non-standard syntax may fail to parse
  • !Does not handle real-time state; diagrams are static representations of the config at the time of export
  • !Does not automatically determine physical cable paths between distant racks

FAQ

Does this tool connect to my routers via SSH?
No, this skill is strictly for parsing files you have already collected. It does not perform live network discovery or credential-based logins.
Can it draw non-Cisco devices?
The parser is specifically tuned for Cisco command syntax. While generic nodes can be added, it may not automatically extract connection data from other vendors.
Is the output editable?
Yes, the output is a standard Draw.io XML file, which you can open and modify in any Draw.io-compatible editor.

How it compares

Manual drawing is error-prone and tedious for large topologies; this tool ensures consistency by deriving the diagram directly from the device's source-of-truth configuration files.

Source & trust

2 stars📄 MIT🕒 Updated 2025-10-21🛡 runs-shell

From the source: “# Cisco Network Diagram Generator Generate professional Draw.io network topology diagrams from Cisco device configurations using the `drawio-network-plot` Python library. ## Overview This skill automates the creation of network topology diagrams by: 1. Parsing Cisco device configurations to extract …”

View the full SKILL.md source

# Cisco Network Diagram Generator

Generate professional Draw.io network topology diagrams from Cisco device configurations using the `drawio-network-plot` Python library.

## Overview

This skill automates the creation of network topology diagrams by:
1. Parsing Cisco device configurations to extract topology data
2. Identifying devices, interfaces, connections, and network relationships
3. Generating Draw.io XML diagrams with proper device icons and layouts
4. Supporting multi-layer visualization (physical, logical, L2, L3)

**Assumption**: Device configurations have already been collected. This skill focuses on parsing and visualization, not SSH access or data collection.

## Installation

Install required library:
```bash
pip install drawio-network-plot --break-system-packages
```

## Quick Start Workflow

1. **Parse configurations** - Extract topology data from config files
2. **Build topology model** - Create device and connection objects
3. **Generate diagram** - Use drawio-network-plot to create XML
4. **Save output** - Write to `/mnt/user-data/outputs/network-diagram.drawio`

## Parsing Cisco Configurations

### Key Data to Extract

Extract these elements from Cisco configs:

**Device Information:**
- Hostname: `hostname <name>`
- Device type: Infer from model (router/switch/firewall/L3 switch)
- Management IP: `interface <mgmt>` + `ip address`

**Interface Details:**
- Interface name, status, IP address, subnet mask
- VLANs: `switchport access vlan`, `switchport trunk allowed vlan`
- Descriptions: `description <text>`
- Speed/duplex settings

**Layer 2 Connections:**
- CDP neighbors: Parse `show cdp neighbors detail` output
- LLDP neighbors: Parse `show lldp neighbors detail` output
- Port channels: `interface Port-channel`, member interfaces

**Layer 3 Information:**
- Static routes: `ip route`
- OSPF: `router ospf`, network statements, areas
- BGP: `router bgp`, neighbors, AS numbers
- EIGRP: `router eigrp`, network statements
- HSRP/VRRP: `standby`, `vrrp` configurations

**Important**: Use `references/cisco-parser.md` for detailed parsing patterns and regular expressions for each configuration type.

## Using drawio-network-plot

### Basic Structure

```python
from drawio_network_plot import create_graph, Node, Edge

# Create graph
graph = create_graph(filename="network.drawio", direction="LR")

# Add devices as nodes
router = Node(
    id="rtr1",
    label="Core-Router-01",
    device_type="router",
    ip_address="10.0.0.1"
)
graph.add_node(router)

# Add connections as edges
link = Edge(
    source="rtr1",
    target="sw1",
    label="Gi0/0/0 → Gi1/0/1\n10.1.1.0/30"
)
graph.add_edge(link)

# Generate diagram
graph.draw()
```

### Device Types and Icons

Map Cisco devices to appropriate icons:

- **Router**: `device_type="router"` - Routers, multilayer switches doing L3
- **Switch**: `device_type="switch"` - L2 switches, access switches
- **Firewall**: `device_type="firewall"` - ASA, Firepower
- **Server**: `device_type="server"` - Services, appliances
- **Cloud**: `device_type="cloud"` - Internet, WAN, external networks
- **PC**: `device_type="pc"` - End devices, workstations

### Layout Strategies

**Hierarchical (Top-Down):**
```python
graph = create_graph(filename="network.drawio", direction="TB")
```
Best for: Core → Distribution → Access topologies

**Left-to-Right:**
```python
graph = create_graph(filename="network.drawio", direction="LR")
```
Best for: Service chains, data flows, sequential processing

**Manual Positioning:**
```python
node = Node(id="sw1", label="Switch", x=100, y=200, width=120, height=80)
```
Best for: Complex topologies, specific physical layouts, data center rows

### Edge Labeling Best Practices

Include relevant information on connection labels:

```python
# L3 Point-to-Point
Edge(label="Gi0/0 → Gi0/1\n10.1.1.0/30\nOSPF Area 0")

# L2 Trunk
Edge(label="Trunk\nVLANs: 10,20,30,100\n1Gbps")

# Port Channel
Edge(label="Po1 (LACP)\nGi0/1-2\n2Gbps")
```

## Complete Workflow Example

Use `scripts/generate_network_diagram.py` for a complete implementation:

```bash
python scripts/generate_network_diagram.py <config_directory> <output_file>
```

Or follow this manual workflow:

```python
import re
from drawio_network_plot import create_graph, Node, Edge

# 1. Parse configurations
devices = {}
connections = []

for config_file in config_files:
    # Parse device info
    hostname = extract_hostname(config_file)
    device_type = infer_device_type(config_file)
    mgmt_ip = extract_mgmt_ip(config_file)
    
    devices[hostname] = {
        'type': device_type,
        'mgmt_ip': mgmt_ip,
        'interfaces': extract_interfaces(config_file)
    }
    
    # Parse CDP neighbors to find connections
    cdp_neighbors = parse_cdp_neighbors(config_file)
    for neighbor in cdp_neighbors:
        connections.append({
            'source': hostname,
            'source_int': neighbor['local_interface'],
            'target': neighbor['device_id'],
            'target_int': neighbor['remote_interface']
        })

# 2. Create graph
graph = create_graph(filename="network.drawio", direction="TB")

# 3. Add devices
for hostname, info in devices.items():
    node = Node(
        id=hostname,
        label=f"{hostname}\n{info['mgmt_ip']}",
        device_type=info['type']
    )
    graph.add_node(node)

# 4. Add connections (deduplicate bidirectional links)
seen_connections = set()
for conn in connections:
    conn_key = tuple(sorted([
        f"{conn['source']}:{conn['source_int']}", 
        f"{conn['target']}:{conn['target_int']}"
    ]))
    
    if conn_key not in seen_connections:
        edge = Edge(
            source=conn['source'],
            target=conn['target'],
            label=f"{conn['source_int']} ↔ {conn['target_int']}"
        )
        graph.add_edge(edge)
        seen_connections.add(conn_key)

# 5. Generate diagram
graph.draw()
```

## Advanced Features

### Multi-Layer Diagrams

Create separate diagrams for different network layers:

**Physical Layer**: All devices and physical connections
**Logical Layer**: VLANs, broadcast domains, subnets
**Layer 3**: Routers, routing protocols, subnets
**Security Zones**: Firewalls, ACLs, security boundaries

### Grouping and Containers

Use containers for logical grouping:

```python
from drawio_network_plot import Container

# Create data center container
dc1 = Container(
    id="dc1",
    label="Data Center 1",
    children=["rtr1", "sw1", "sw2", "fw1"]
)
graph.add_container(dc1)
```

### Styling and Customization

Customize colors for different device roles:

```python
node = Node(
    id="core-rtr",
    label="Core Router",
    device_type="router",
    fill_color="#FF6B6B",  # Red for core devices
    font_color="#FFFFFF"
)
```

### Adding Metadata

Include additional information as node properties:

```python
node = Node(
    id="rtr1",
    label="Core-Router-01",
    device_type="router",
    metadata={
        "model": "ISR4451-X",
        "ios_version": "17.6.3",
        "location": "Building A - MDF",
        "serial": "FDO2148B0X1"
    }
)
```

## Handling Complex Topologies

### Large Networks (50+ devices)

For large topologies:
1. Create hierarchical sub-diagrams by location or function
2. Use containers to group related devices
3. Generate separate diagrams for L2 and L3 views
4. Create summary diagrams showing only core infrastructure

### Redundant Paths

Show redundancy clearly:
```python
# Primary path
edge1 = Edge(source="rtr1", target="rtr2", label="Primary\nGi0/0", style="solid")
# Backup path  
edge2 = Edge(source="rtr1", target="rtr2", label="Backup\nGi0/1", style="dashed")
```

### MPLS/VPN Topologies

Represent virtual connections:
```python
# VPN tunnel
vpn_edge = Edge(
    source="site1-rtr",
    target="site2-rtr",
    label="IPsec VPN\n10.100.0.0/24",
    style="dashed",
    color="#0066CC"
)
```

## Output and Delivery

1. Save to outputs directory:
```python
import shutil
shutil.move("network.drawio", "/mnt/user-data/outputs/network-diagram.drawio")
```

2. Generate multiple formats if needed:
   - Primary: `.drawio` (editable XML)
   - Export via Draw.io: PNG, SVG, PDF

3. Provide user with link:
```python
print("[View your network diagram](computer:///mnt/user-data/outputs/network-diagram.drawio)")
```

## Troubleshooting

**Issue**: Overlapping nodes
**Solution**: Use manual positioning or adjust layout direction

**Issue**: Missing connections  
**Solution**: Verify CDP/LLDP data parsing, check for hostname mismatches

**Issue**: Incorrect device types
**Solution**: Review device type inference logic, use explicit type mapping

**Issue**: Too much information on diagram
**Solution**: Create multiple focused diagrams (L2, L3, security) instead of one complex diagram

## Best Practices

1. **Start simple**: Begin with physical connectivity, add layers incrementally
2. **Validate data**: Cross-reference parsed data with source configs before generating diagram
3. **Use meaningful labels**: Include interface names, IP addresses, and protocol info
4. **Group logically**: Use containers for sites, VLANs, or security zones
5. **Handle missing data gracefully**: Use placeholder values when CDP/LLDP is unavailable
6. **Document assumptions**: Note which connections are discovered vs. inferred
7. **Provide context**: Add title, legend, and timestamp to diagrams

## Reference Files

- **`references/cisco-parser.md`**: Detailed regex patterns and parsing functions for all Cisco configuration types
- **`references/drawio-examples.md`**: Complete working examples for different network scenarios
- **`scripts/generate_network_diagram.py`**: Production-ready script with full parsing and generation logic

## Common Use Cases

**Use Case 1: Data Center Topology**
```python
# Create top-down diagram with core, aggregation, and access layers
# Group servers by rack, show redundant uplinks
```

**Use Case 2: Branch Office WAN**
```python
# Show hub-and-spoke topology with MPLS/VPN connections
# Highlight primary and backup WAN links
```

**Use Case 3: VLAN Visualization**
```python
# Create L2 diagram showing VLAN trunks and access ports
# Color-code by VLAN or security zone
```

**Use Case 4: Routing Protocol View**
```python
# Show OSPF areas, BGP peerings, route reflectors
# Label edges with metrics and next-hops
```

## Next Steps After Generation

1. Open diagram in Draw.io (web: app.diagrams.net)
2. Manually refine layout and positioning as needed
3. Add annotations, labels, or documentation
4. Export to PNG/PDF for documentation or presentations
5. Version control the .drawio file for change tracking

Quoted from neuro-synapse/network-topology-agent for reference — see the original for the authoritative, latest version.

📄 Full skill instructions — original source: neuro-synapse/network-topology-agent
This agent skill translates raw Cisco configuration files into structured, visual Draw.io network topology diagrams. By parsing device hostnames, interface configurations, VLAN tagging, and neighbor data from CDP or LLDP protocols, it constructs a machine-readable model of your infrastructure. This tool targets network engineers and system administrators who spend excessive time manually drawing physical and logical connections in documentation software. Instead of dragging and dropping icons to represent subnets or trunk links, users feed existing CLI configuration files into the script to generate standardized diagrams automatically. It supports hierarchical, horizontal, and custom layouts, allowing for clear visualization of complex L2/L3 environments, port-channel assignments, and routing relationships across core, distribution, and access layers.

How to Use This Skill Unit

Option A: Project-Specific (Recommended)

  1. Click "Download" above
  2. In your project, create the directory: .agent/skills/cisco-network-diagram-skill/
  3. Save the file as SKILL.md
  4. The agent will automatically discover the skill based on its description.

Option B: Global Installation (All Agents)

Save the file to these locations to make it available across all projects:

  • Claude Code: ~/.claude/skills/neuro-synapse/network-topology-agent/cisco-network-diagram-skill/SKILL.md
  • Cursor: ~/.cursor/skills/neuro-synapse/network-topology-agent/cisco-network-diagram-skill/SKILL.md
  • Antigravity: ~/.gemini/antigravity/skills/neuro-synapse/network-topology-agent/cisco-network-diagram-skill/SKILL.md

🚀 Install with CLI:
npx skills add neuro-synapse/network-topology-agent

Read the Master Guide: Mastering Agent Skills

Recommended Rules

View more rules

Recommended Workflows

View more workflows

Recommended MCP Servers

View more MCP servers

Take It Further

Maximize your productivity with these powerful resources

📋

Define Your Standards

Set up coding standards to ensure this workflow produces consistent, high-quality results.

Browse Rules Library
📖

Master Workflows

Learn how to create custom workflows, use Turbo Mode, and build your automation library.

Complete Guide

How to use this Skill in Claude Code & Cursor

For Claude Code (CLI)

To use this skill in Claude Code, copy the rule content into your project's custom instructions or follow our Add-Skill CLI guide. This ensures Claude follows your standards during every code generation.

For Cursor & Windsurf

For Cursor or Windsurf, individual skills are best used in the "Rules for AI" section. This specific unit helps the agent avoid devops & ci/cd issues, leading to cleaner, more efficient code.

Why the skill format matters: the standardized Agent Skills format lets your AI agent load detailed instructions only when they are relevant, keeping your prompt clean while improving results.

Source & attribution

This skill is categorized under DevOps & CI/CD and is published by neuro-synapse, maintained in neuro-synapse/network-topology-agent.

← Browse All Agent Skills
Sponsored AI assistant. Recommendations may be paid.