Coder Social home page Coder Social logo

cisco-vlan-manager's Introduction

cisco-vlan-manager

Schema

Configuration

cd worker
mv config{.example,}.py

Replace the default configuration with your devices credentials (secret fiels is for Cisco enable password)

Install

docker-compose up

If you need to rebuild docker images you can:

docker-compose rm
docker-compose --build --force-recreate

API endpoints

[GET]

  • /update: Read from 'update' redis stream, It contains messages about worker events.
redis_app.xread(streams={'update': 0}, count=1)
  • /config: Fetch running configurations stored in the redis key 'cisco_config'
redis_app.get('config_cisco')

[POST]

/action: Store tasks for worker in the redis stream 'todo'

  • {'type': 'add'}: Add a new VLAN on cisco devices

  • {'type': 'remove'}: Remove an existing VLAN on cisco devices

  • {'type': 'update'}: Update running configurations in the redis key 'config_cisco'

  • {'type': 'save'}: Save current configurations on devices (write memory)

redis_app.xadd('todo', {'json': content})

Frontend result

Manual deployment

Example for adding a new VLAN:

  • VLAN ID = 333
  • subnet = '10.88.77.0/24'
git clone https://github.com/zteeed/cisco-vlan-manager.git
cd cisco-vlan-manager/worker
python3 -m virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
mv config{.example,}.py
vim config.py  # update credentials with real ones
python
from src.devices_functions import get_devices, disconnect_devices
from src.redis_job import make
devices = get_devices()
action = dict(type='add', vlan_num=333, subnet='10.88.77.0/24')
make(devices, action, '999')
disconnect_devices(devices)

cisco-vlan-manager's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

deeby

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.