Skip to content

cwccie/topologyviz

Repository files navigation

TopologyViz

Network diagram to structured data converter for Visio, draw.io, and photos.

Parse network topology diagrams from multiple formats, extract devices and connections, validate completeness, and export to structured data formats for automation, documentation, and visualization.

Architecture

                          +------------------+
                          |   CLI Interface   |
                          |  (Click commands) |
                          +--------+---------+
                                   |
              +--------------------+--------------------+
              |                    |                     |
     +--------v--------+  +-------v--------+  +--------v--------+
     |   Parser Engine  |  |   Validator    |  |   Diff Engine   |
     |                  |  |                |  |                  |
     | +drawio_parser   |  | +orphan_check  |  | +device_diff    |
     | +vsdx_parser     |  | +dup_ip_check  |  | +link_diff      |
     | +graphml_parser  |  | +dangling_chk  |  | +merge          |
     | +json_parser     |  | +naming_chk    |  |                  |
     +--------+---------+  +----------------+  +------------------+
              |
     +--------v---------+
     | Device Classifier |
     | (regex + pattern) |
     +--------+---------+
              |
     +--------v---------+       +------------------+
     |  Topology Model   | <--> |  NetworkX Graph  |
     | (Device, Link)    |      |   Conversion     |
     +--------+---------+       +------------------+
              |
     +--------v------------------------------------------+
     |              Export Engine                          |
     |                                                    |
     |  +json  +yaml  +graphml  +d3  +mermaid  +ascii   |
     +----------------------------------------------------+

Features

  • Multi-format parsing -- draw.io XML, Visio .vsdx (stub), GraphML, custom JSON
  • Device recognition -- Regex + pattern classification: router, switch, firewall, server, cloud, WAN link, load balancer, access point, endpoint
  • IP extraction -- Automatic IPv4 address extraction from labels
  • Topology validation -- Orphan devices, dangling links, duplicate IPs, self-loops, naming consistency checks
  • Six export formats -- JSON, YAML inventory, GraphML, D3.js visualization, Mermaid diagram, ASCII art
  • Diff and merge -- Compare two topologies, identify added/removed/modified devices and links, merge with overlay precedence
  • NetworkX integration -- Full bidirectional conversion to NetworkX graphs

Installation

pip install .

For development:

pip install -e ".[dev]"

Usage

Parse a diagram

topologyviz parse network.drawio
topologyviz parse network.json -f yaml
topologyviz parse network.graphml -f ascii

Export to a format

topologyviz export network.drawio -f d3 -o topology.html
topologyviz export network.json -f mermaid -o diagram.md
topologyviz export network.drawio -f yaml -o inventory.yml

Validate a topology

topologyviz validate network.drawio
topologyviz validate network.json --json-output

Compare two diagrams

topologyviz diff old-network.json new-network.json
topologyviz diff baseline.drawio updated.drawio --json-output

Supported Formats

Input

Format Extension Notes
draw.io .drawio Full XML parsing with Cisco stencil support
Visio .vsdx Best-effort shape/connector extraction
GraphML .graphml Standard graph exchange format
JSON .json Custom topology schema

Output

Format Description
JSON Structured topology data
YAML Ansible-style inventory grouped by type
GraphML Standard graph XML format
D3.js Standalone force-directed HTML visualization
Mermaid Markdown-embeddable diagram syntax
ASCII Text-based network diagram

Docker

docker compose up parser-engine
docker compose run parser-engine /data/network.drawio
docker compose run viewer /data/network.json -f d3 > /output/topology.html

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest -v

# Lint
ruff check src/ tests/

# Format
ruff format src/ tests/

JSON Topology Schema

{
  "name": "my-network",
  "devices": [
    {
      "id": "r1",
      "name": "Core-Router",
      "device_type": "router",
      "ip_addresses": ["10.0.0.1"]
    }
  ],
  "links": [
    {
      "id": "l1",
      "source_id": "r1",
      "target_id": "sw1",
      "link_type": "ethernet",
      "bandwidth": "10Gbps"
    }
  ]
}

License

MIT License. Copyright (c) 2026 Corey Wade.

About

Network diagram to structured data converter for Visio draw.io and photos

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages