Cisco Configuration Generator Scripts
Write Python scripts that generate Cisco device configurations. Follow these standards:
Structure
- Use Jinja2 templates for config generation
- Support YAML or JSON input for device variables
- Separate data (variables) from logic (templates)
- Output valid IOS/IOS-XE/NX-OS/ASA CLI configs
Supported Platforms
- IOS / IOS-XE (routers, switches)
- NX-OS (Nexus)
- ASA (firewalls)
- IOS-XR where applicable
Config Features to Support
- Routing: BGP, OSPF, EIGRP, static routes, route-maps, prefix-lists
- Switching: VLANs, trunks, access ports, STP, EtherChannel, VTP
- Security: ACLs (standard/extended/named), NAT (static/dynamic/PAT), VPN (site-to-site/remote-access), AAA, CoPP
- Interfaces: L2/L3 config, subinterfaces, loopbacks, SVIs, port-channels
- Services: DHCP, NTP, SNMP, syslog, DNS, TACACS+/RADIUS
- SDN/Automation: RESTCONF/NETCONF payloads, DNA Center templates
Libraries to Use
jinja2for templatingyamlorjsonfor variable inputipaddressfor IP/subnet calculationsnetaddrif advanced IP math is needed
Output Requirements
- Generate clean, paste-ready CLI config blocks
- Include
!comment separators between sections - Add descriptive comments using
! ---format - Validate IP addresses and subnet masks before output
- Support dry-run mode (print to stdout) and file output
Example Variable File Format (YAML)
hostname: R1
interfaces:
- name: GigabitEthernet0/1
ip: 10.0.1.1
mask: 255.255.255.0
description: Uplink to Core
routing:
ospf:
process_id: 1
router_id: 1.1.1.1
networks:
- network: 10.0.1.0
wildcard: 0.0.0.255
area: 0