A modern network management web application built with Python Flask backend and Bootstrap 5.3 frontend for Cisco Systems Inc.
# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone and setup
cd nac-nd-gui
uv sync
# Configure environment
cp .env.sample .env
# Run the application
uv run nac-nd-guiVisit http://localhost:9999 to access the application.
⚙️ Configuration Required: To use NaC API and Nexus Dashboard features, configure yaml/config.yaml or use the Admin panel in the web interface. See Configure API Integration section below.
- 🚀 Flask Backend: Lightweight Python web framework
- 🎨 Bootstrap 5.3: Latest Bootstrap for responsive design
- 📱 Mobile-First: Fully responsive layout
- 🔌 API Ready: RESTful API endpoints included
- ✨ Modern JavaScript: Clean, async/await patterns
- 🎯 Interactive UI: Live API testing and form handling
- ⚙️ Admin Panel: Web-based configuration management with YAML storage
- 🔐 Secure Config: API keys stored in YAML format (gitignored)
.
├── src/
│ └── nac_nd_gui/ # Main Python package
│ ├── __init__.py
│ ├── app.py # Flask application with API routes
│ ├── nac_api.py # NaC API client
│ ├── nexus_dashboard.py # Nexus Dashboard client
│ ├── api/
│ │ └── v1/ # API v1 blueprints
│ ├── static/
│ │ ├── css/
│ │ │ └── style.css # Custom CSS styles
│ │ ├── images/
│ │ │ └── *.png # Logo and image assets
│ │ └── js/
│ │ └── app.js # Frontend JavaScript
│ └── templates/
│ └── index.html # Main HTML template
├── pyproject.toml # Project configuration and dependencies
├── .env.sample # Environment variables template
├── .venv/ # Virtual environment (created by uv)
├── yaml/
│ └── config.yaml.sample # Configuration file template
├── README.md # This file
└── DEVELOPMENT.md # Detailed development guide
- Python 3.11 or higher
- uv - Fast Python package installer and resolver
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Or using Homebrew
brew install astral-sh/uv/uv
# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# Or using pip
pip install uv- Clone or navigate to the project directory
cd nac-nd-gui- Install dependencies and create virtual environment
uv syncThis command will:
- Create a
.venvdirectory with the virtual environment - Install all dependencies from
pyproject.toml - Install the package in editable mode
- Set up environment variables
cp .env.sample .env
# Edit .env and set your SECRET_KEY- Run the application
# Using the installed command
uv run nac-nd-gui
# Or using Python module syntax
uv run python -m nac_nd_gui.app
# Or direct execution
uv run python src/nac_nd_gui/app.pyThe application will start on http://localhost:9999
- Configure API Integration (Required for API features)
The application requires configuration for both NaC API and Nexus Dashboard integration.
Navigate to the Admin page in the web interface (http://localhost:9999 → Admin) to configure:
NaC API Settings:
- API URL: NaC API server URL (e.g.,
http://localhost:8000) - API Key: Authentication key for NaC API
- SCM Provider: Source Code Manager (github, gitlab, bitbucket)
- SCM API URL: Your SCM API endpoint
- Repository URL: Your data repository (format:
username/repository) - Data Sources Directory: Directory containing YAML data (usually
data)
Nexus Dashboard Settings:
- API Key: Nexus Dashboard API key for authentication
- URL: Nexus Dashboard URL (e.g.,
https://10.15.0.122) - Username: Nexus Dashboard username
- Fabric Name: Target fabric name (optional - scopes operations to specific fabric)
Configuration is automatically saved to yaml/config.yaml
Security Feature: When loading existing configuration, API key fields show placeholder dots (••••••••••••••••) instead of actual values. The green border indicates a value is already configured. Click into the field to change it, or leave it unchanged to keep the current value.
You can also manually create or edit yaml/config.yaml:
nac:
api_url: http://0.0.0.0:8000
api_key: ghp_xxxxxxxxxxxxxxxx
scm_provider: github
scm_api_url: https://github.com/api/v3/
repository_url: username/repository
data_sources_dir: data
nexus_dashboard:
api_key: xxxxxxxxxxxxxxxxxxxxxxxxx
url: https://10.x.x.x
username: admin
fabric_name: fabric1Field Descriptions:
| Field | Description | Example |
|---|---|---|
nac.api_url |
NaC API server endpoint | http://0.0.0.0:8000 |
nac.api_key |
GitHub/GitLab/Bitbucket personal access token | ghp_xxxxx |
nac.scm_provider |
Source code manager type | github, gitlab, bitbucket |
nac.scm_api_url |
SCM API endpoint | https://github.com/api/v3/ |
nac.repository_url |
Repository path (no base URL) | username/repo-name |
nac.data_sources_dir |
Directory with YAML data in repo | data or datasources |
nexus_dashboard.api_key |
ND API key (from ND admin panel) | Long hex string |
nexus_dashboard.url |
Nexus Dashboard HTTPS URL | https://10.15.0.122 |
nexus_dashboard.username |
ND username for API calls | admin |
nexus_dashboard.fabric_name |
Optional fabric scope | fabric1 |
Note: A sample configuration file is provided at yaml/config.yaml.sample
The application includes interactive API documentation powered by Swagger/Flasgger.
Once the application is running, visit:
http://localhost:9999/swagger/
The Swagger UI provides:
- 📚 Complete API Reference - All endpoints with detailed documentation
- 🧪 Interactive Testing - Try API calls directly from your browser
- 📝 Request/Response Schemas - See exactly what data is expected and returned
- 🏷️ Organized by Categories - General, Tables, Admin, Nexus Dashboard, and NaC API endpoints
- General - Basic application endpoints
- Tables - Data endpoints for UI tables (VRFs, Networks, Switches, Interfaces)
- Admin - Configuration management endpoints
- Nexus Dashboard - Cisco Nexus Dashboard integration endpoints
- NaC API - Network as Code API integration endpoints
# Test the connection
curl http://localhost:9999/api/nexus/test-connection
# Get VRFs from NaC API
curl http://localhost:9999/api/v1/nac/vrfsFor detailed API documentation, examples, and interactive testing, use the Swagger interface.
NaC API (Network as Code API) is a northbound API gateway to Source Code Managers (SCM) like GitHub, GitLab, and Bitbucket. It provides programmatic access to network configuration stored as YAML files in version-controlled repositories.
- GitOps for Networks: Manage network configs as code in Git repositories
- Version Control: Full history and rollback capabilities for network changes
- Validation: Built-in YAML validation and schema checking
- Automation: Enable CI/CD pipelines for network changes
- Multi-Provider: Supports GitHub, GitLab, Bitbucket, and local filesystems
┌─────────────────┐ ┌──────────────┐ ┌─────────────────┐
│ NaC ND GUI │ ──────> │ NaC API │ ──────> │ SCM (GitHub) │
│ (This App) │ │ Gateway │ │ + YAML Data │
└─────────────────┘ └──────────────┘ └─────────────────┘
│ │
│ │
└──────────────────────────────────────────────────────┘
Network config as YAML in Git
- GUI → User makes changes through web interface
- NaC API → Validates and transforms requests to SCM operations
- SCM → Stores network configuration as YAML files
- Network as Code → YAML defines VRFs, networks, switches, etc.
To use NaC API features, you need:
-
Running NaC API Server:
- Install and run NaC API: https://github.com/netascode/nac-api
- Default URL:
http://localhost:8000
-
SCM Access:
- GitHub/GitLab/Bitbucket repository with network data
- Personal Access Token (PAT) with repo read/write permissions
- Repository structured for Network as Code (nac-yaml format)
-
Configuration in yaml/config.yaml:
nac: api_url: http://0.0.0.0:8000 # NaC API server api_key: ghp_xxxxxxxxxxxxxxxx # Your SCM token scm_provider: github # github, gitlab, or bitbucket scm_api_url: https://github.com/api/v3/ repository_url: username/your-repo # SCM repo path data_sources_dir: data # YAML directory in repo
Once configured, this GUI enables:
- ✅ View Network Data: Browse VRFs, networks, switches from Git
- ✅ Make Changes: Add/modify VRFs and networks through forms
- ✅ Validate Changes: NaC API validates YAML before committing
- ✅ Git Integration: All changes tracked in version control
- ✅ Rollback: Use Git history to revert changes
- User fills out "Add VRF" form in the GUI
- GUI sends API request to NaC API
- NaC API validates VRF configuration
- NaC API updates YAML in Git repository
- Git maintains version history
- Network automation (Terraform, etc.) consumes YAML
The application includes a complete Nexus Dashboard API client with:
- Header-based authentication (X-Nd-Username, X-Nd-Apikey)
- RESTful API methods (GET, POST, PUT, DELETE)
- Convenience methods for common operations
- Connection testing from Admin panel
Authentication Method: Uses X-Nd-Username and X-Nd-Apikey headers for all requests.
See NEXUS_DASHBOARD_API.md for complete API documentation and examples.
- Click the "Test API" button to make a live API call
- See formatted JSON responses in real-time
- Fill out the form and submit data to the API
- Receive instant feedback on submission success/failure
- Mobile-first approach using Bootstrap 5.3
- Card-based layout with smooth animations
- Feature showcase with icons
Note: See DEVELOPMENT.md for detailed development instructions, including testing, linting, and contributing guidelines.
# Add a new dependency
uv add package-name
# Add a development dependency
uv add --dev package-name
# Update dependencies
uv sync
# Remove a dependency
uv remove package-nameThis project includes pre-configured development tools:
# Run tests
uv run pytest
# Code formatting
uv run black src/
# Linting
uv run ruff check src/
# Type checking
uv run mypy src/Edit src/nac_nd_gui/app.py or create new blueprints in src/nac_nd_gui/api/v1/:
@app.route('/api/your-endpoint', methods=['GET', 'POST'])
def your_endpoint():
# Your logic here
return jsonify({'status': 'success', 'data': 'your data'})Edit src/nac_nd_gui/static/css/style.css to customize the appearance:
/* Your custom styles */
.your-class {
/* properties */
}Edit src/nac_nd_gui/static/js/app.js to add new frontend features:
async function yourFunction() {
const data = await apiCall('/api/your-endpoint');
console.log(data);
}Before deploying to production:
- Set a strong
SECRET_KEYin your environment variables - Set
FLASK_ENV=production - Use a production WSGI server like Gunicorn:
# Add gunicorn to dependencies
uv add gunicorn
# Run with gunicorn
uv run gunicorn -w 4 -b 0.0.0.0:9999 "nac_nd_gui.app:app"- Consider using a reverse proxy (nginx, Apache)
- Enable HTTPS with SSL certificates
# Build wheel package
uv build
# The built package will be in dist/
# Install on target system:
uv pip install dist/nac_nd_gui-1.0.0-py3-none-any.whl- Framework: Flask 3.0.3
- Package Manager: uv - Fast Python package installer
- Dependencies: Requests 2.31.0, python-dotenv 1.0.1, PyYAML 6.0.1, nac-yaml 1.1.1
- API Documentation: Flasgger 0.9.7.1 (Swagger UI)
- UI Framework: Bootstrap 5.3.3
- Icons: Bootstrap Icons 1.11.3
- Tables: Tabulator 6.2.5
- JavaScript: Modern ES6+ with async/await
- CSS: Custom styles + Bootstrap utilities
- Testing: pytest 8.0+
- Linting: ruff 0.1+
- Formatting: black 24.0+
- Type Checking: mypy 1.8+
- Storage: YAML format for secure configuration management
- API Integration: Cisco Nexus Dashboard REST API client with automatic authentication
- NaC Integration: Network as Code YAML configuration support
MIT License - Feel free to use this template for your projects!
Contributions are welcome! Feel free to submit issues and pull requests.