You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+57-24
Original file line number
Diff line number
Diff line change
@@ -2,33 +2,51 @@
2
2
3
3
The `clab-io-draw` project unifies two tools, `clab2drawio` and `drawio2clab`. These tools facilitate the conversion between [Containerlab](https://github.com/srl-labs/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.
10
10
11
-
For detailed information on `clab2drawio`, including features (like [`Grafana`](docs/grafana.md) Dashboard creation), options, and usage instructions, please refer to the [clab2drawio.md](docs/clab2drawio.md) file located in the same directory as this README.
|**drawio2clab**| Converts Draw.io diagrams back into Containerlab-compatible YAML files, supporting quick lab setup.|
12
17
13
-
## drawio2clab
14
18
15
-
`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.
19
+
> [!NOTE]
20
+
> For detailed information on `clab2drawio`, options, and usage instructions, please refer to the [clab2drawio.md](docs/clab2drawio.md)
21
+
22
+
> [!NOTE]
23
+
> For more details on `drawio2clab`, including features, constraints for drawing, and how to run the tool, please see the [drawio2clab.md](docs/drawio2clab.md)
16
24
17
-
For more details on `drawio2clab`, including features, constraints for drawing, and how to run the tool, please see the [drawio2clab.md](docs/drawio2clab.md) file in this directory.
18
25
19
26
## Quick Usage
20
27
21
28
### Running with Containerlab
22
29
```bash
23
-
containerlab graph --drawio -t topo.yml
24
-
containerlab graph --drawio -t topo.drawio
30
+
containerlab graph --drawio -t topo.clab.yml
31
+
containerlab graph --drawio -t topo.clab.drawio
25
32
```
26
33
34
+
> [!TIP]
35
+
> 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`).
36
+
>
37
+
> You can also enhance your output by passing additional arguments. For example:
> This example applies the "nokia_modern" theme to your generated diagram.
42
+
43
+
27
44
### Running with Docker
28
45
29
-
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.
46
+
You can also use a Docker containerfor a quick start without installing Python and other dependencies locally.
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:
40
58
41
59
```bash
42
-
docker run -it -v "$(pwd)":/data ghcr.io/srl-labs/clab-io-draw -i lab-examples/clos03/cfg-clos.clab.yml
60
+
docker run -it -v "$(pwd)":/data ghcr.io/srl-labs/clab-io-draw -i lab-examples/br01.clab.yml
43
61
```
44
-
*Note: The `-it` option is for interactive mode and is only needed if using `-I`.*
62
+
> [!NOTE]
63
+
> The `-it` option is used for interactive mode (`-I`).
64
+
> If you do not need interactive prompts, you can omit `-it`.
45
65
46
66
```bash
47
67
docker run -v "$(pwd)":/data ghcr.io/srl-labs/clab-io-draw -i output.drawio
48
68
```
49
69
50
-
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.
70
+
Replace `your_input_file.drawio` or `your_output_file.yaml` with the
71
+
actual file names in your environment.
51
72
52
73
## Running locally
53
74
54
-
### Requirements
55
-
56
-
- Python 3.6+
75
+
> [!IMPORTANT]
76
+
> Python 3.6+ is required if you prefer running these tools locally.
57
77
58
78
### Installation
59
79
60
80
#### Virtual Environment Setup
61
81
62
-
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:
82
+
> [!TIP]
83
+
> Using a virtual environment is recommended to avoid version conflicts
84
+
> with global Python packages.
63
85
64
86
```bash
65
87
python3 -m venv venv
@@ -86,18 +108,29 @@ Detailed Usages: [drawio2clab.md](docs/drawio2clab.md#usage) and [clab2drawio.md
86
108
python drawio2clab.py -i <input_file.drawio>
87
109
```
88
110
89
-
`-i, --input`: Specifies the path to your input .drawio file.
90
-
Make sure to replace `<input_file.drawio>` with the path to your .drawio file
111
+
- `-i, --input`: path to your `.drawio` file.
112
+
- `-o, --output`: path to your output `.yaml` file (optional).
91
113
92
-
For more comprehensive guidance, including additional command-line options, please see the Usage section in [drawio2clab.md](docs/drawio2clab.md#usage)
114
+
> [!NOTE]
115
+
> For more details on node-label constraints, usage examples, and additional
116
+
> command-line options, refer to
117
+
> [drawio2clab.md](docs/drawio2clab.md#usage).
93
118
94
119
## clab2drawio
95
120
96
121
```bash
97
122
python clab2drawio.py -i <input_file.yaml>
98
123
```
99
124
100
-
`-i, --input`: Specifies the path to your input YAML file.
101
-
Make sure to replace `<input_file.yaml>` with the path to your .drawio file
125
+
- `-i, --input`: path to your Containerlab YAML file.
126
+
- `-o, --output`: path to your output `.drawio` file (optional).
127
+
128
+
> [!NOTE]
129
+
> For advanced functionality—like
130
+
> [Grafana Dashboard](docs/grafana.md) generation (`-g, --gf_dashboard`),interactive mode (`-I`), layout customizations, or theming (`--theme`) refer to [clab2drawio.md](docs/clab2drawio.md#usage).
131
+
132
+
## Contributions & Feedback
133
+
134
+
All feedback and contributions are welcome! If you have suggestions, please open an issue or pull request on the GitHub repository.
102
135
103
-
For more comprehensive guidance, including additional command-line options, please see the Usage section in [clab2drawio.md](docs/clab2drawio.md#usage)
0 commit comments