- HTML 92.3%
- VBA 4.2%
- Python 3.5%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| docs/images | ||
| samples | ||
| tests | ||
| tools | ||
| vendor/jszip | ||
| bulk-replace-shapes-macro.bas | ||
| CHANGELOG.md | ||
| glue-connectors-macro.bas | ||
| LICENSE | ||
| README.md | ||
| topology-to-visio.html | ||
NetBox topology to Visio
Vision: turn the network map NetBox draws into a Visio diagram that people can edit, in one step: tidy, colour-coded by device type, with lines that stay attached when you move things, and ready to swap in Visio's own network icons. Your network's details never leave your computer.
NetBox topology to Visio is a single web page. Give it a NetBox Topology Views export (draw.io XML) and it
downloads a Visio .vsdx file.
- Private: the page loads nothing from the network, and its Content-Security-Policy stops it from trying.
- One file:
topology-to-visio.htmlworks offline in Chrome, Edge, Firefox or Safari.
Quick start
- In NetBox, open Topology Views, choose the site or devices, and export the diagram as draw.io XML.
- Open
topology-to-visio.html(double-click it) and drop the file on it, or click the box to browse for it. To try it first, usesamples/example-site.xml. - Check the preview. Re-run layout tries a different arrangement.
- Click Convert & download .vsdx and open the file in Visio. If Visio offers to repair it the first time, accept: the diagram is kept.
Options
- Arrange as ring & spur where possible: finds the largest loop of switches and draws it as a ring, with everything else branching off it. Untick it for a plain spread-out layout.
- Glue connectors to shapes: the lines stay attached to the devices when you move them in Visio. Untick it for
plain lines (you can glue them later with
glue-connectors-macro.bas).
If the export has saved positions (you arranged the devices in NetBox), they're kept, the right way up. If every device sits at the same point, the page arranges them itself, keeping the lines from crossing as far as it can.
How devices are recognised
Each device is given a role from its name. Devices that share an icon in the export are treated as one type, decided by a vote across their names, so one oddly named switch still looks like its siblings. Devices with an IPv4 address in their name are placed near others in the same /24.
| Role (Visio layer and shape name) | Colour and shape | Recognised by |
|---|---|---|
| Firewall | red hexagon | fortigate, firewall, palo alto, sonicwall |
| Router | orange diamond | router |
| Cloud (ISP or circuit) | blue cloud | circuits (node_c…), isp, circuit, common UK ISP names |
| MediaConverter | teal trapezoid | media converter |
| WirelessAP | green octagon | wap, wireless, access point |
| Switch | blue square | switch |
| Server | indigo pentagon | server, backup, replicator |
| Device | purple square | anything else |
The shape key on the page shows which roles were found; check it for anything in the wrong group.
Swapping in Visio's network icons
Every device is on a Visio layer named after its role, and its shape is called <Role>-<number> (Switch-4).
- Using layers (Visio Plan 1 or 2, or Visio Standard or Professional): open the stencil (More Shapes → Network → Network and Peripherals), then Home → Select → Select by Type → Layer, pick a role, and use Home → Change Shape. "Visio in Microsoft 365" doesn't have layers; use the macro instead.
- Using the macro (any Visio with VBA): open the stencil, then run
bulk-replace-shapes-macro.bas(Alt+F11 → Insert → Module, paste, F5). It replaces every role whose name matches a master in an open stencil and lists the roles it couldn't match. Rename a master to the role name, or edit the macro, for those.
Limits
- It hasn't been opened in Visio itself from here (there's no Visio on this machine). Each file passes
tests/check_vsdx.py, which looks for the mistakes that make Visio refuse or repair a file. - The two VBA macros haven't been run either; they use only standard Visio automation calls.
- Shapes are simple outlines, not Visio's icons (see above for swapping them).
- Roles come from names and icons, so the odd device may land in the wrong group.
- One page per export; a very large site makes a very large page.
- Cable labels and interface names aren't carried over.
For developers
| Path | What it is |
|---|---|
topology-to-visio.html |
The tool, edited directly |
samples/example-site.xml |
A made-up site in the shape of a Topology Views export |
bulk-replace-shapes-macro.bas, glue-connectors-macro.bas |
The Visio macros |
tests/check_vsdx.py |
Checks a .vsdx: python3 tests/check_vsdx.py example-site.vsdx prints ok with the number of shapes and connections, or the problems (standard library only) |
tools/build.py |
Puts JSZip into the page; only needed after replacing the library |
vendor/jszip/ |
JSZip 3.10.2, its licence, version and checksum |
tools/build.py checks the library against SHA256SUMS, refuses one containing </script and a page that loads
anything from the network, and writes the library and its version between the BEGIN JSZIP and END JSZIP
markers.
Version, licence and author
Version 1.3.1; see CHANGELOG.md. MIT licence (LICENSE); the bundled JSZip is MIT or GPLv3
(vendor/jszip/LICENSE.markdown). By Rawrso.me - David Hall.
