Coder Social home page Coder Social logo

dude051 / network_drawer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from otahi/network_drawer

0.0 1.0 0.0 724 KB

Drawer for network diagrams from JSON or YAML

Home Page: https://github.com/otahi/network_drawer

License: MIT License

Ruby 100.00%

network_drawer's Introduction

NetworkDrawer

A network diagram drawer with YAML or JSON.

Gem Version

Installation

Ensure you can use Graphviz, before installing network_drawer.

You can install Graphviz as follow.

# Mac OS X with brew
brew install graphviz

# CentOS
yum install graphviz

# Ubuntu
apt-get install graphviz

Add this line to your application's Gemfile:

gem 'network_drawer'

And then execute:

$ bundle

Or install it yourself as:

$ gem install network_drawer

Usage

You can draw a network diagram with a YAML or JSONfile with SVG format:

$ bundle exec network_drawer draw examples/simple.yml

$ bundle exec network_drawer draw examples/simple.json

You can draw a network diagram with specified style:

$ bundle exec network_drawer draw examples/simple.yml -s examples/simple_style.yml

$ bundle exec network_drawer draw examples/simple.json -s examples/simple_style.json

You can draw a network diagram with specified layout(dot, fdp..):

$ bundle exec network_drawer draw examples/simple.yml -l fdp

You can draw a network diagram with png format:

$ bundle exec network_drawer draw examples/simple.yml -f png

Then You will get a network diagram. See more Gallery

sample diagram(SVG)

sample diagram(PNG)

How to describe

You can describe diagram with YAML or JSON.

Network diagram

You can describe diagram as follows:

simple.yml

layers:
- Web:
    nodes:
    - WebLB:
        ports:
        - 80/tcp
        - 443/tcp
        type: LB
        url: https://github.com/otahi/network_drawer/
    - Web001:
        ports:
        - 80/tcp
    - Web002:
        ports:
        - 80/tcp
- App:
    nodes:
    - AppLB:
        ports:
        - 80/tcp
        - 25/tcp
        type: LB
    - App001:
        ports:
        - 80/tcp
        - 25/tcp
    - App002:
        ports:
        - 80/tcp
        - 25/tcp
nodes:
- Browser:
  type: Client
- Mail Server:
  type: Client
connections:
- from: Browser
  to: WebLB:80/tcp
  type: HTTP
- from: Browser
  to: WebLB:443/tcp
- from: Mail Server
  to: AppLB:25/tcp
  type: SMTP
- from: WebLB
  to: Web001:80/tcp
  type: HTTP
- from: WebLB
  to: Web002:80/tcp
  type: HTTP
- from: Web001
  to: AppLB:80/tcp
  type: HTTP
- from: Web002
  to: AppLB:80/tcp
  type: HTTP
- from: AppLB
  to: App001:25/tcp
  type: SMTP
- from: AppLB
  to: App001:80/tcp
  type: HTTP
- from: AppLB
  to: App002:25/tcp
  type: SMTP
- from: AppLB
  to: App002:80/tcp
  type: HTTP

Style

You can specify your style for nodes or edges with Graphviz attributes.

simple_style.yml

types: 
  WEB: 
    style: rounded,filled,dotted
    fillcolor: azure
  LB: 
    style: rounded,filled,dotted
    fillcolor: azure
  HTTP: 
    color: blue
  SMTP: 
    color: green

Contributing

  1. Fork it ( https://github.com/otahi/network_drawer/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

network_drawer's People

Watchers

 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.