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.drawio
Tip
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.
You can also use a Docker container for a quick start without installing Python and other dependencies locally.
docker pull ghcr.io/srl-labs/clab-io-draw:latest
Run 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.yml
Note
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.drawio
Replace your_input_file.drawio
or your_output_file.yaml
with the
actual file names in your environment.
Important
Python 3.6+ is required if you prefer running these tools locally.
Tip
Using a virtual environment is recommended to avoid version conflicts with global Python packages.
python3 -m venv venv
source venv/bin/activate
After activating the virtual environment, install the required packages from the requirements.txt file:
pip install -r requirements.txt
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
python drawio2clab.py -i <input_file.drawio>
-i, --input
: path to your.drawio
file.-o, --output
: path to your output.yaml
file (optional).
Note
For more details on node-label constraints, usage examples, and additional command-line options, refer to drawio2clab.md.
python clab2drawio.py -i <input_file.yaml>
-i, --input
: path to your Containerlab YAML file.-o, --output
: path to your output.drawio
file (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.