Network Config Generator

Being a network engineer in a dynamic environment can be sometimes tough. Especially when you face many interface reconfigurations in your daily routine. In this article, I want to share with you a tool, that can make your job easier, and save you some time.


Network Config Generator is a script written in python. It generates CLI commands based on a CSV file. Generated configuration can be copied directly to your network device.

List of currently supported and tested platforms:

  • Cisco (IOS-XE, IOS-XR, NX-OS)
  • Dell (FTOS 9)
  • Quanta

The script was tested and is working correctly on python 3.8. If you have issues with running this script on other python versions, please let me know. I’ll put an annotation in this post.

Current script version: 1.2

Last update: 02.04.2020


In order for the script to work, you need to have the jinja2 python library present on your workstation. You can install it via the python’s pip utility.

$ pip install jinja2

For more information about pip, please visit this website.

If you don’t have installed pip, please visit this website.


You can download the latest script version from the git repository.


The script usage is pretty straightforward, it boils down to two steps.

  1. Fill the config.csv file with necessary information
  2. Run

And that’s it! If you’ve filled the configuration file correctly, generated config will be present both in the terminal window and in the generated_config.txt file.

Config.csv structure

CLI commands are generated based on the information in the config.csv file. You can work on that file with a simple text editor, but I recommend opening it in Microsoft Excel, or similar software because it’s way easier to work that way. Down below you can find screenshots both from Sublime Text and the LibreOffice Calc.

Sublime Text
LibreOffice Calc

While opening config.csv file in the LibreOffice Calc, check only the Semicolon option under the Separator Options. In Microsoft Excel you don’t have to change anything, it will automatically load data into particular columns.

The configuration file structure consists of the following columns:

  1. Interface – configured interface name
  2. Description – description of the configured interface.
  3. Vlan – VLAN/list of VLANs for the interface
  4. Switchport type – a type of configuration to be applied to an interface. Allowed values:
    • access – untagged traffic
    • trunk – tagged traffic
  5. Vendor – configured network device vendor name. Allowed values:
    • cisco
    • dell
    • quanta
  6. Default interface – when checked, the script will generate default interface <interface name> line before entering interface configuration mode. Allowed values:
    • y – adds default interface command
    • n/blank – default interface command is not added
  7. Switchport command – when checked, the script will generate switchport command in the interface configuration mode. Allowed values:
    • y – adds switchport command
    • n/blank – switchport command is not added
  8. Initialize vlans – when checked, the script will generate commands adding particular vlan to the vlan database. Allowed values:
    • y – initializes vlans
    • n/blank – vlans are not initialized

Columns marked as bold are mandatory, so if you want to generate interface configuration, you have to fill them properly. The rest are optional. If you leave the description value empty, then the script will not generate description CLI command for a particular interface. Same stands for default interface, switchport command and initialize vlans columns.


Let’s assume that we have 3 network devices. One Cisco switch, one Dell and one Quanta. We want to configure 2 interfaces on each device. We could do it manually, but to save time, we decide to use configuration generated by the script, so we’re filling a config.csv with the desired configuration.

When the configuration is ready, the next and at the same time the last step is to run a script.

After running the script, in the terminal window, you can find the generated configuration. The configuration is also written to the generated_configration.txt file.

Remember to ALWAYS check generated configuration by yourself before executing it, especially on the production devices. I don’t hold any responsibility for possible errors regarding this script. Use with caution.

But what will happen if the configuration file is filled incorrectly? In this case, we have a typo in the config.csv file. In the second row, there is a tunk switchport mode instead of a trunk.

If you fill rows incorrectly, or just leave some mandatory fields blank, the script will display a warning message with information in which row there is a problem.


I hope that this script will enhance your work, and make it a bit easier.

I’m open to discussion regarding this tool. Feel free to comment down below, or contact me directly. If you find a bug, please also let me know.


Leave a Reply

Your email address will not be published. Required fields are marked *