Coder Social home page Coder Social logo

clab-io-draw's Introduction

clab-io-draw

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.

Drawio Example

clab2drawio

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

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.

Quick Usage

Running with Docker

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.

Pulling from dockerhub

docker pull flosch62/clab-io-draw:latest

Building the Docker Image by yourself

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.

Running the Tools

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.

Running locally

Requirements

  • Python 3.6+

Installation

Virtual Environment Setup

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  

Installing Dependencies

After activating the virtual environment, install the required packages from the requirements.txt file:

pip install -r requirements.txt

Usage

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

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

clab2drawio

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

clab-io-draw's People

Contributors

flosch62 avatar sacckth avatar hellt avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.