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.
clab2drawio
is a Python script that automatically generates Draw.io diagrams from Containerlab YAML configurations. It aims to simplify the visualization of network designs by providing a graphical representation of container-based network topologies.
For detailed information on clab2drawio
, including features, options, and usage instructions, please refer to the clab2drawio.md file located in the same directory as this README.
drawio2clab
is a Python script that converts Draw.io diagrams into Containerlab-compatible YAML files. This tool is designed to assist in the setup of container-based networking labs by parsing .drawio XML files and generating structured YAML representations of the network.
For more details on drawio2clab
, including features, constraints for drawing, and how to run the tool, please see the drawio2clab.md file in this directory.
To simplify dependency management and execution, the tools can be run inside a Docker container. Follow these instructions to build and run the tool using Docker.
docker pull flosch62/clab-io-draw:latest
Navigate to the project directory and run:
docker build -t clab-io-draw .
This command builds the Docker image of clab-io-draw with the tag clab-io-draw, using the Dockerfile located in the docker/ directory.
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 -v "$(pwd)":/data flosch62/clab-io-draw -i lab-examples/clos03/cfg-clos.clab.yml
docker run -v "$(pwd)":/data flosch62/clab-io-draw -i output.drawio
Replace your_input_file.drawio and your_output_file.yaml with the names of your actual files. This command mounts your current directory to /data inside the container.
- Python 3.6+
It's recommended to use a virtual environment for Python projects. This isolates your project dependencies from the global Python environment. To set up and activate a virtual environment:
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> -o <output_file.yaml>
-i, --input
: Specifies the path to your input .drawio file.
-o, --output
: Specifies the path for the output YAML file.
Make sure to replace <input_file.drawio>
with the path to your .drawio file and <output_file.yaml>
with the desired output YAML file path.
For more comprehensive guidance, including additional command-line options, please see the Usage section in drawio2clab.md
python clab2drawio.py -i <input_file.yaml> -o <output_file.drawio>
-i, --input
: Specifies the path to your input YAML file.
-o, --output
: Specifies the path for the output drawio file.
Make sure to replace <input_file.yaml>
with the path to your .drawio file and <output_file.drawio>
with the desired output YAML file path.
For more comprehensive guidance, including additional command-line options, please see the Usage section in clab2drawio.md