Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
588 changes: 588 additions & 0 deletions .github/docs/AzureLocal_NetworkConfTool_Project_Design_Doc.md

Large diffs are not rendered by default.

437 changes: 437 additions & 0 deletions .github/docs/Project_Roadmap.md

Large diffs are not rendered by default.

402 changes: 402 additions & 0 deletions .github/docs/ai_action_plan.md

Large diffs are not rendered by default.

1,566 changes: 0 additions & 1,566 deletions .github/reviews/AzureLocal_NetworkConfTool_Project_Design_Doc.md

This file was deleted.

491 changes: 0 additions & 491 deletions .github/reviews/Project_Roadmap.md

This file was deleted.

37 changes: 29 additions & 8 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,44 @@ concurrency:
cancel-in-progress: false

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4


- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package.json

- name: Install dependencies
run: |
cd frontend
npm ci

- name: Build frontend
run: |
cd frontend
npm run build

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: frontend

path: frontend/dist

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
18 changes: 11 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,14 @@ cython_debug/
.DS_Store
Thumbs.db

# Playwright
node_modules/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
/playwright/.auth/
# Playwright
node_modules/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
/playwright/.auth/

# Frontend build output
frontend/dist/
frontend/node_modules/
111 changes: 111 additions & 0 deletions backend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Azure Local Network Config Tool - Backend

Python CLI for generating network switch configurations from JSON input.

## Features

- ✅ JSON schema validation with cross-reference checking
- ✅ Role-based configuration transformation (TOR1/TOR2/BMC)
- ✅ Jinja2 template rendering for vendor-specific configs
- ✅ Support for Dell OS10 switches
- ✅ Comprehensive test suite (29 tests, 80% coverage)

## Installation

```bash
cd backend
pip3 install -e .
```

## Usage

### Validate Configuration

```bash
python3 -m src.cli validate ../frontend/examples/dell-tor1.json
```

### Transform Configuration

Validate and add computed fields:

```bash
python3 -m src.cli transform ../frontend/examples/dell-tor1.json > enriched.json
```

### Generate Switch Configuration

```bash
# Generate to specific directory
python3 -m src.cli generate ../frontend/examples/dell-tor1.json -o output/

# Generate to current directory
python3 -m src.cli generate ../frontend/examples/dell-tor1.json
```

## Architecture

```
backend/
├── src/
│ ├── validator.py # JSON schema validation
│ ├── transformer.py # Data enrichment
│ ├── context.py # Template context builder
│ ├── renderer.py # Jinja2 rendering
│ └── cli.py # CLI entry point
├── schema/
│ └── standard.json # JSON Schema definition
├── templates/
│ └── dellemc/os10/ # Dell OS10 templates
└── tests/ # Pytest test suite
```

## Role-Based Computed Values

The transformer automatically adds role-specific values:

| Role | hsrp_priority | mlag_role_priority | mst_priority |
|------|---------------|-------------------|--------------|
| TOR1 | 150 | 1 | 8192 |
| TOR2 | 100 | 32667 | 16384 |
| BMC | null | null | 32768 |

## Testing

```bash
# Run all tests
python3 -m pytest tests/ -v

# Run with coverage
python3 -m pytest tests/ --cov=src --cov-report=term-missing
```

## Development

### Adding New Templates

1. Create template file in `templates/{vendor}/{firmware}/`
2. Use Jinja2 syntax with context variables
3. Include in `full_config.j2` orchestrator
4. Test with example configurations

### Adding New Validators

Cross-reference validators can be added in `validator.py`:

```python
def _check_cross_references(self, config, result):
# Add custom validation logic
pass
```

## Dependencies

- Python ≥ 3.9
- jinja2 ≥ 3.1.0
- jsonschema ≥ 4.20.0
- pytest ≥ 7.4.0 (dev)

## License

See LICENSE file in repository root.
30 changes: 30 additions & 0 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[project]
name = "azure-local-network-config-backend"
version = "1.0.0"
description = "Backend CLI for Azure Local network switch configuration generation"
requires-python = ">=3.9"
dependencies = [
"jinja2>=3.1.0",
"jsonschema>=4.20.0",
"pyyaml>=6.0.0",
]

[project.optional-dependencies]
dev = [
"pytest>=7.4.0",
"pytest-cov>=4.1.0",
]

[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = "test_*.py"
python_classes = "Test*"
python_functions = "test_*"
addopts = "-v --cov=src --cov-report=term-missing"

[project.scripts]
azlocal-netconfig = "src.cli:main"
Loading