cd worker
mv config{.example,}.pyReplace the default configuration with your devices credentials (secret fiels is for Cisco enable password)
docker compose up
If you need to rebuild docker images you can:
docker compose rm
docker compose --build --force-recreate/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')/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})Example for adding a new VLAN:
VLAN ID = 333subnet = '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
pythonfrom 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)



