




Generate Cisco Configuration Template Using Python3, Jinja2, and CSV with Validation
This program is designed to generate a configuration template for Cisco Catalyst/Nexus switches.
Table of Contents
- Requirements
- Getting Started
- Installation
- Usage
- Preview
- Helpful Tips
- TODOs
Requirements
- Python @3.11.1
- Jinja2 @3.1.2
Getting Started
│ cisco_config_generator.py
│ cisco_validation.py
│ switch.j2
│ requirements.txt
│ README.md
│ .gitignore
│ LICENSE
│
├───assets
│ preview.png
│
├───configs
│ .gitkeep
│
└───CSV
01_params.csv
02_vlans.csv
03_etherchannels.csv
04_port_mapping.csv
Installation
$ git clone https://github.com/Tes3awy/Cisco-Configuration-Using-Python-Jinja-CSV.git
$ cd Cisco-Configuration-Using-Python-Jinja-CSV
$ python -m venv .venv --upgrade-deps
# Activate Virtual Environment
$ pip install -r requirements.txt
Usage
- Open each
.csv
file respectively and add the configurations that meet your needs. (The CSV files are populated with a sample configuration already)
- Open terminal/cmd.
- Run
python cisco_config_generator.py
.
First, a json_schema.json
file is created (if not created already) from your configuration in CSV files. Then, json_schema.json
is validated against a set of rules in validate_config.py
.
Voila ✨! Your configuration will be created an placed in configs directory.
Preview

Helpful Tips
- DO NOT copy/paste the whole configuration all at once to your device. Divide the configuration template into multiple sections.
- Always save your configuration with the
copy running-config startup-config
command. See Why
TODOs