# znerox/openwrt-configvisualizer architecture

> Architecture diagram of the GitHub repository znerox/openwrt-configvisualizer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/znerox/openwrt-configvisualizer
- Repository: https://github.com/znerox/openwrt-configvisualizer

## Overview

OpenWrt-ConfigVisualizer is a single-file translator: a user runs the script with OpenWrt network and DHCP configuration, optionally adds static hosts, and receives nwdiag text describing interfaces, subnets, and clients. The script parses Ethernet and WireGuard details, collects client records, sorts and matches them to networks, then prints the diagram input. The README describes sending that text to Kroki for image or PDF rendering; the repository does not show an automatic Kroki call. Host-file parsing is documented but its implementation was not sampled.

Main entry points: [`NetworkDiagram.py`](https://github.com/znerox/openwrt-configvisualizer/blob/main/NetworkDiagram.py) (Python script)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Configuration inputs"]
  node_network_config["Network config"]
  node_dhcp_config["DHCP config"]
  node_hosts_file["Optional hosts"]
end

subgraph group_translation["Diagram translation"]
  node_script["Python script<br/>[NetworkDiagram.py]"]
  node_interface_parser["Interface parsing<br/>[NetworkDiagram.py]"]
  node_client_parser["Client parsing<br/>[NetworkDiagram.py]"]
  node_host_import["Static host import<br/>[NetworkDiagram.py]"]
  node_sort_match["Sort and match<br/>[NetworkDiagram.py]"]
end

subgraph group_rendering["Diagram rendering"]
  node_nwdiag_output["nwdiag text"]
  node_kroki["Kroki renderer"]
  node_diagram["Image or PDF"]
end

node_user(("User"))

node_user -->|"runs"| node_script
node_script -->|"prompts"| node_user
node_script -->|"reads"| node_network_config
node_script -->|"reads"| node_dhcp_config
node_script -.->|"optionally reads"| node_hosts_file
node_script -->|"parses interfaces"| node_interface_parser
node_script -->|"parses clients"| node_client_parser
node_script -.->|"optionally imports"| node_host_import
node_interface_parser -->|"interface records"| node_sort_match
node_client_parser -->|"client records"| node_sort_match
node_host_import -.->|"static clients"| node_sort_match
node_sort_match -->|"builds text"| node_nwdiag_output
node_script -->|"prints text"| node_user
node_user -.->|"submits text"| node_kroki
node_kroki -.->|"renders"| node_diagram

click node_script "https://github.com/znerox/openwrt-configvisualizer/blob/main/NetworkDiagram.py"
click node_interface_parser "https://github.com/znerox/openwrt-configvisualizer/blob/main/NetworkDiagram.py"
click node_client_parser "https://github.com/znerox/openwrt-configvisualizer/blob/main/NetworkDiagram.py"
click node_host_import "https://github.com/znerox/openwrt-configvisualizer/blob/main/NetworkDiagram.py"
click node_sort_match "https://github.com/znerox/openwrt-configvisualizer/blob/main/NetworkDiagram.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_network_config,node_dhcp_config,node_hosts_file,node_user toneBlue
class node_script,node_interface_parser,node_client_parser,node_host_import,node_sort_match toneAmber
class node_nwdiag_output,node_kroki,node_diagram toneMint
```

## Components

### Configuration inputs

- **Network config**
- **DHCP config**
- **Optional hosts**

### Diagram translation

- [Python script](https://github.com/znerox/openwrt-configvisualizer/blob/main/NetworkDiagram.py): `NetworkDiagram.py`
- [Interface parsing](https://github.com/znerox/openwrt-configvisualizer/blob/main/NetworkDiagram.py): `NetworkDiagram.py`
- [Client parsing](https://github.com/znerox/openwrt-configvisualizer/blob/main/NetworkDiagram.py): `NetworkDiagram.py`
- [Static host import](https://github.com/znerox/openwrt-configvisualizer/blob/main/NetworkDiagram.py): `NetworkDiagram.py`
- [Sort and match](https://github.com/znerox/openwrt-configvisualizer/blob/main/NetworkDiagram.py): `NetworkDiagram.py`

### Diagram rendering

- **nwdiag text**
- **Kroki renderer**
- **Image or PDF**

### Other components

- **User**

## Connections

- User → Python script: runs
- Python script → User: prompts
- Python script → Network config: reads
- Python script → DHCP config: reads
- Python script → Optional hosts: optionally reads
- Python script → Interface parsing: parses interfaces
- Python script → Client parsing: parses clients
- Python script → Static host import: optionally imports
- Interface parsing → Sort and match: interface records
- Client parsing → Sort and match: client records
- Static host import → Sort and match: static clients
- Sort and match → nwdiag text: builds text
- Python script → User: prints text
- User → Kroki renderer: submits text
- Kroki renderer → Image or PDF: renders
