Add README.md
This commit is contained in:
@@ -0,0 +1,75 @@
|
|||||||
|
# Switch Config Manager
|
||||||
|
|
||||||
|
Web-based tool for writing, saving, and pushing configuration files to network switches.
|
||||||
|
Pulls switch inventory from NocoDB and provides a browser UI for editing and deploying configs.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Lists active switches from NocoDB (filterable by department)
|
||||||
|
- Config editor — write or paste switch configuration in the browser
|
||||||
|
- Save configs to disk as `hostname.conf` files
|
||||||
|
- Push configs to switches via SSH (Paramiko)
|
||||||
|
- Web access shortcut — open the switch management UI directly from the app
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
### 1. Configure
|
||||||
|
|
||||||
|
Copy `config.example.py` to `config.py` and fill in your values:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp config.example.py config.py
|
||||||
|
nano config.py
|
||||||
|
```
|
||||||
|
|
||||||
|
```python
|
||||||
|
NOCODB_URL = "http://your-nocodb-host:8080"
|
||||||
|
NOCODB_TOKEN = "your-api-token"
|
||||||
|
NOCODB_BASE_ID = "your-base-id"
|
||||||
|
NOCODB_TABLE_ID = "your-table-id"
|
||||||
|
CONFIGS_DIR = "/configs"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Build and run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose up -d --build
|
||||||
|
```
|
||||||
|
|
||||||
|
The app runs on port **8003** by default.
|
||||||
|
|
||||||
|
### 3. Open the UI
|
||||||
|
|
||||||
|
```
|
||||||
|
http://your-host-ip:8003
|
||||||
|
```
|
||||||
|
|
||||||
|
## NocoDB Requirements
|
||||||
|
|
||||||
|
The NocoDB table must have at minimum:
|
||||||
|
|
||||||
|
| Column | Description |
|
||||||
|
|--------|-------------|
|
||||||
|
| `Hostname` | Switch hostname (used as filename) |
|
||||||
|
| `Active` | Must be `YES` for the switch to appear |
|
||||||
|
| `Dept` | Department code — used for filtering |
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
switch-config-manager/
|
||||||
|
├── app.py # Flask API + SSH push logic
|
||||||
|
├── config.py # Your local config (not committed)
|
||||||
|
├── config.example.py # Config template
|
||||||
|
├── requirements.txt # Python dependencies
|
||||||
|
├── Dockerfile
|
||||||
|
├── docker-compose.yml
|
||||||
|
├── templates/
|
||||||
|
│ └── index.html # Web UI
|
||||||
|
└── configs/ # Saved .conf files (created at runtime)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Saved Configs
|
||||||
|
|
||||||
|
Config files are saved to the `configs/` directory as `hostname.conf`.
|
||||||
|
The directory is bind-mounted from the host so files persist across container restarts.
|
||||||
Reference in New Issue
Block a user