The clab-io-draw project unifies two tools, clab2drawio and drawio2clab. These tools facilitate the conversion between Containerlab YAML files and Draw.io diagrams, making it easier for network engineers and architects to visualize, document, and share their network topologies.
| Tool | Description |
|---|---|
| clab2drawio | Converts Containerlab YAML files into Draw.io diagrams (with optional Grafana support). |
| drawio2clab | Converts Draw.io diagrams back into Containerlab-compatible YAML files, supporting quick lab setup. |
Note
For detailed information on clab2drawio, options, and usage instructions, please refer to the clab2drawio.md
Note
For more details on drawio2clab, including features, constraints for drawing, and how to run the tool, please see the drawio2clab.md
containerlab graph --drawio -t topo.clab.yml
containerlab graph --drawio -t topo.clab.drawioTip
The containerlab graph --drawio command simplifies your workflow by automatically detecting the input file type (.yml or .drawio) and running the appropriate script internally (clab2drawio or drawio2clab).
You can also enhance your output by passing additional arguments. For example:
sudo containerlab graph --drawio -t topo.clab.yml --drawio-args "--theme nokia_modern"This example applies the "nokia_modern" theme to your generated diagram.
Tip
Why uv?
uv is a single, ultra-fast tool that can replace pip, pipx, virtualenv, pip-tools, poetry, and more. It automatically manages Python versions, handles ephemeral or persistent virtual environments (uv venv), lockfiles, and often runs 10–100× faster than pip installs.
-
Install uv (no Python or Rust needed):
# On macOS and Linux curl -LsSf https://astral.sh/uv/install.sh | sh -
Install clab-io-draw
uv tool install git+https://github.com/srl-labs/clab-io-draw
To update later on:
uv tool upgrade clab-io-drawYou can also use a Docker container for a quick start without installing Python and other dependencies locally. The image already includes the draw.io AppImage, so no additional downloads are needed at runtime.
docker pull ghcr.io/srl-labs/clab-io-draw:latestRun drawio2clab or clab2drawio within a Docker container by mounting the directory containing your .drawio/.yaml files as a volume. Specify the input and output file paths relative to the mounted volume:
docker run -it -v "$(pwd)":/data ghcr.io/srl-labs/clab-io-draw -i lab-examples/br01.clab.ymlNote
The -it option is used for interactive mode (-I).
If you do not need interactive prompts, you can omit -it.
docker run -v "$(pwd)":/data ghcr.io/srl-labs/clab-io-draw -i output.drawioReplace your_input_file.drawio or your_output_file.yaml with the
actual file names in your environment.
This section provides a brief overview on how to use the drawio2clab and clab2drawio tools. For detailed instructions, including command-line options and examples, please refer to the dedicated usage sections in their respective documentation files.
Detailed Usages: drawio2clab.md and clab2drawio.md
drawio2clab -i <input_file.drawio>-i, --input: path to your.drawiofile.-o, --output: path to your output.yamlfile (optional).
Note
For more details on node-label constraints, usage examples, and additional command-line options, refer to drawio2clab.md.
clab2drawio -i <input_file.yaml>-i, --input: path to your Containerlab YAML file.-o, --output: path to your output.drawiofile (optional).
Note
For advanced functionality—like
Grafana Dashboard generation (-g, --gf_dashboard),interactive mode (-I), layout customizations, or theming (--theme) refer to clab2drawio.md.
All feedback and contributions are welcome! If you have suggestions, please open an issue or pull request on the GitHub repository.