Skip to content
Merged
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
72 changes: 0 additions & 72 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

53 changes: 3 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
- [Sample Input JSON](#sample-input-json)
- [Sample Template (Jinja2)](#sample-template-jinja2)
- [Quick Start](#quick-start)
- [Choose Your Path](#choose-your-path)
- [Basic Usage](#basic-usage)
- [Quick Examples](#quick-examples)
- [What's Improved in This Version](#whats-improved-in-this-version)
- [Key Enhancements](#key-enhancements)

Expand All @@ -27,7 +24,7 @@ This tool generates vendor-specific network switch configurations (e.g., Cisco N

**First time here?** Choose your path:

- **Just want to use it?** → [`docs/EXECUTABLE_USAGE.md`](docs/EXECUTABLE_USAGE.md)
- **Just want to use it?** → [`docs/QUICK_START.md`](docs/QUICK_START.md)
- **Need to convert your data format?** → [`docs/CONVERTOR_GUIDE.md`](docs/CONVERTOR_GUIDE.md)
- **Want to customize templates?** → [`docs/TEMPLATE_GUIDE.md`](docs/TEMPLATE_GUIDE.md)
- **Need to create/modify switch templates?** → [`docs/SWITCH_INTERFACE_TEMPLATE.md`](docs/SWITCH_INTERFACE_TEMPLATE.md)
Expand Down Expand Up @@ -157,7 +154,7 @@ root/
├── build/ # Build artifacts and executables
├── docs/ # Documentation files
│ ├── CONVERTOR_GUIDE.md # Guide for creating custom convertors
│ ├── EXECUTABLE_USAGE.md # Standalone executable usage guide
│ ├── QUICK_START.md # Quick start and executable usage guide
│ ├── SWITCH_INTERFACE_TEMPLATE.md # Switch interface template guide
│ ├── TEMPLATE_GUIDE.md # Jinja2 template development guide
│ └── TROUBLESHOOTING.md # Common issues and solutions
Expand Down Expand Up @@ -231,51 +228,7 @@ router bgp {{ bgp.asn }}

## Quick Start

### Choose Your Path

**New to this tool?** Start here based on what you want to do:

| I want to... | Go to |
|--------------|--------|
| **Use the precompiled executable** (no coding needed) | [`docs/EXECUTABLE_USAGE.md`](docs/EXECUTABLE_USAGE.md) |
| **Convert my custom input format** | [`docs/CONVERTOR_GUIDE.md`](docs/CONVERTOR_GUIDE.md) |
| **Create or modify configuration templates** | [`docs/TEMPLATE_GUIDE.md`](docs/TEMPLATE_GUIDE.md) |
| **Create or modify switch interface templates** | [`docs/SWITCH_INTERFACE_TEMPLATE.md`](docs/SWITCH_INTERFACE_TEMPLATE.md) |
| **Understand the tool's architecture** | [`docs/TOOL_DESIGN.md`](docs/TOOL_DESIGN.md) |
| **Fix issues or troubleshoot** | [`docs/TROUBLESHOOTING.md`](docs/TROUBLESHOOTING.md) |

### Basic Usage

The tool accepts these parameters:

| Parameter | Required | Description |
|-------------------|----------|-------------|
| `--input_json` | ✅ Yes | Path to your input JSON file (lab or standard format) |
| `--output_folder` | ❌ No | Directory to save generated configs (default: current directory) |
| `--template_folder` | ❌ No | Folder containing Jinja2 templates (default: input/jinja2_templates) |
| `--convertor` | ❌ No | Convertor to use for non-standard formats (default: convertors.convertors_lab_switch_json) |

### Quick Examples

```bash
# Basic usage - auto-detects input format
python src/main.py --input_json input/standard_input.json --output_folder output/

# With custom output directory
python src/main.py --input_json my_input.json --output_folder configs/

# Using short convertor alias
python src/main.py --input_json lab_input.json --output_folder output/ --convertor lab

# Using the standalone executable (Windows)
network_config_generator.exe --input_json input/standard_input.json --output_folder output/

# Using the standalone executable (Linux)
./network_config_generator --input_json input/standard_input.json --output_folder output/
```

> [!IMPORTANT]
> **Tip:** The tool automatically detects if your input is in standard format or needs conversion!
For detailed usage instructions, examples, and setup steps, see [`docs/QUICK_START.md`](docs/QUICK_START.md).

---

Expand Down
74 changes: 30 additions & 44 deletions docs/EXECUTABLE_USAGE.md → docs/QUICK_START.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,42 @@ The easiest way to use this tool is with our pre-built executables. No need to i

## 🚀 Quick Start

### Step 1: Prepare your input file
- Any JSON file with your switch data works
- Tool automatically detects the format

### Step 2: Generate configs
```bash
To see all available options and usage details, run the executable with the `-h` or `--help` flag:

```powershell
# Windows
.\network_config_generator.exe --input_json your_switches.json --output_folder configs\
.\network_config_generator.exe -h

# Linux
# Make it executable (Linux only)
chmod +x network_config_generator
./network_config_generator --input_json your_switches.json --output_folder configs/
./network_config_generator -h
```

This will display a summary of command-line arguments, default values, and workflow steps.
```powershell
> .\network_config_generator.exe -h
usage: network_config_generator.exe [-h] --input_json INPUT_JSON [--template_folder TEMPLATE_FOLDER]
[--output_folder OUTPUT_FOLDER] [--convertor CONVERTOR]

options:
-h, --help show this help message and exit
--input_json INPUT_JSON
Path to input JSON file (lab or standard format)
--template_folder TEMPLATE_FOLDER
Folder containing Jinja2 templates (default: input/jinja2_templates)
--output_folder OUTPUT_FOLDER
Directory to save generated configs (default: same directory as input file)
--convertor CONVERTOR
Convertor to use for non-standard input formats (default:
convertors.convertors_lab_switch_json)

Examples:
network_config_generator.exe --input_json input/standard_input.json --output_folder output/
network_config_generator.exe --input_json my_lab_input.json --output_folder configs/ --convertor lab
```

![Network Config Generator Demo](./media/network-config-generator01.gif)


## 📋 What You Get

Expand All @@ -49,41 +70,6 @@ configs/
└── ... (same files)
```

## ⚙️ Advanced Options

To see all available options and usage details, run the executable with the `-h` or `--help` flag:

```bash
# Windows
.\network_config_generator.exe -h

# Linux
./network_config_generator -h
```

This will display a summary of command-line arguments, default values, and workflow steps.
```powershell
PS C:\Users\liunick\Downloads\config_test> .\network_config_generator.exe -h
usage: network_config_generator.exe [-h] --input_json INPUT_JSON [--template_folder TEMPLATE_FOLDER]
[--output_folder OUTPUT_FOLDER] [--convertor CONVERTOR]

Network config generator - automatically detects input format and converts if needed, then generates configs.

options:
-h, --help show this help message and exit
--input_json INPUT_JSON
Path to input JSON file (can be lab format or standard format)
--template_folder TEMPLATE_FOLDER
Root folder containing vendor templates (default: input/jinja2_templates)
--output_folder OUTPUT_FOLDER
Directory to save generated config files (default: current directory)
--convertor CONVERTOR
Python module path for the convertor to use when input is not in standard format. Only used if
conversion is needed. (default: convertors.convertors_lab_switch_json)

Workflow: 1) Check if input is standard format 2) If not, convert using specified convertor 3) Generate config files
from standard format
```

## 🆘 Need Help?

Expand Down
Binary file added docs/media/network-config-generator01.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions tests/TEST_CASES_SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Test Cases Summary

## Quick Reference
**Status**: ✅ All tests passing (38 passed, 8 skipped)
**Run Tests**: `python -m pytest tests/ -v`

### Understanding Test Results
- ✅ **Passed**: Test executed and validation succeeded (38 tests)
- ⏭️ **Skipped**: Expected baseline files don't exist (8 tests - missing full_config.cfg files)
- ❌ **Failed**: Would indicate actual test failure (none currently)

---

## Test Scenarios

### Configuration Generator Tests (`test_generator.py`)
**Total: 34 tests** | 29 passed ✅ | 5 skipped

| Test Scenario | Count | Description |
|--------------|-------|-------------|
| `test_generated_config_output` | 28 | Compares generated config files against expected outputs |
| `test_config_syntax_validation` | 3 | Validates syntax of generated configuration files |
| `test_output_file_generation` | 3 | Verifies output files are created successfully |

**Test Cases Coverage:**
- ✅ `std_cisco_nxos_fc` - Cisco NX-OS Fully Connected (9 config files validated)
- ✅ `std_cisco_nxos_switched` - Cisco NX-OS Switched (8 passed, 1 skipped: full_config.cfg)
- ✅ `std_dell_os10_fc` - Dell OS10 Fully Connected (9 passed, 1 skipped: full_config.cfg)

> **Note**: Only `full_config.cfg` files are skipped (typically not used in production deployments)

### Lab Input Convertor Tests (`test_convertors.py`)
**Total: 12 tests** | 9 passed ✅ | 3 skipped

| Test Scenario | Count | Description |
|--------------|-------|-------------|
| `test_convert_switch_input_json` | 4 | Converts lab format to standard format and validates |
| `test_input_format_validation` | 4 | Validates lab input format structure |
| `test_output_format_validation` | 4 | Validates standard output format structure |

**Test Cases Coverage:**
- ✅ `convert_lab_switch_input_json_cisco_nxos_fc` - Cisco NX-OS Fully Connected (validated)
- ⏭️ `convert_lab_switch_input_json_cisco_nxos_switched` - Cisco NX-OS Switched (skipped: missing BMC outputs)
- ✅ `convert_lab_switch_input_json_cisco_nxos_switchless` - Cisco NX-OS Switchless (validated)
- ✅ `convert_lab_switch_input_json_dell_os10` - Dell OS10 (validated)

> **Note**: Some expected output files may differ from generated ones (e.g., BMC switch definitions) - these tests are skipped until baselines are updated.
Loading