ConfigBuilder Python Class – Replaces data in template with values from CSV file.

I successfully built that router build script. Obviously I can’t show the full glory of what it can do on router builds, because those configs are proprietary for the company for which I work, but I’ll include a sample CSV file data and sample template. It just shows how to use it for your own purposes.

Below is the code:

Below is sample contents of RouterDetails.CSV as referenced in Script

@=============BUILD_INFO=============,
@BUILD_SITE_ID,METROPOLIS
@BUILD_ADDRESS_NUMBER,123
@BUILD_ADDRESS_STREET,MAIN ST
@BUILD_ADDRESS_CITY,DALLAS
@BUILD_ADDRESS_STATE,TX
@BUILD_ADDRESS_COUNTRY,US
@BUILD_DATE,3/8/2018

Below is sample contents of BaseMPLSRouter.tmpl as referenced in Script
===================================================================
CONFIG GENERATED by RouterBuild.py on @BUILD_DATE
Script by Jason Black 3/8/2018
Script Revision 1.0
===================================================================
@RTR_NAME_OF_ROUTER BUILT FOR : @BUILD_SITE_ID
PHYSICAL ADDRESS:
@BUILD_ADDRESS_NUMBER @BUILD_ADDRESS_STREET
@BUILD_ADDRESS_CITY, @BUILD_ADDRESS_STATE @BUILD_ADDRESS_COUNTRY
===================================================================

BELOW IS SCRIPT OUTPUT:
===================================================================
CONFIG GENERATED by RouterBuild.py on 3/8/2018
Script by Jason Black 3/8/2018
Script Revision 1.0
===================================================================
DEMO.RTR1 BUILT FOR : METROPOLIS
PHYSICAL ADDRESS:
123 MAIN ST
DALLAS, TX US
===================================================================