I ran into the following problem today: I need to import configs into my GNS3 topology but:
- the configs to be imported are txt files formatted like R1.txt, R2.txt etc
- my gns3 project folder has subfolders named after the device ID, e.g. a32ebfcf-1011-46ef-a864-144ad35746aa with startup-config.cfg files inside them
- txt configs have gigabit interfaces and not ethernet like my gns3 configs
- I use Ecobyte’s Replace Text tool to replace gigabit1 string in all files in a given file hierarchy with ethernet0/0 string
- I copy my R1.txt, R2.txt into the folder with a specific gns3 project folder (each subfolder here is one IOU device)
- I have prepared a cmd .bat file that does the following for each txt file, e.g.
move R5.txt a32ebfcf-1011-46ef-a864-144ad35746aa\
ren a32ebfcf-1011-46ef-a864-144ad35746aa\R5.txt startup-config.cfg
To make things easier, you can create one project BASICPROJECT, change all the ids for R1 to be all 1s (remember to change IDs in the .gns3 file, too!!!), and then load that project and save as NEWPROJECT. IDs will stay the same and the .bat file ids can stay the same, too.
I change IDs also in the .gns3 file (each ID needs to be changed in two places!)
My modified .bat file also looks much better now:
move R5.txt 55555555-5555-5555-5555-555555555555\
ren 55555555-5555-5555-5555-555555555555\R5.txt startup-config.cfg
So once these one-off changes in the folder names and .gns3 project files are done, now every time I have to import new .txt files because i e.g. need InitialRipConfig, i ONLY:
- copy the .txt files with the configs (R1.txt, R2.txt etc.) and the .bat file into a gns3 project folder and I run the .bat file. Magic.
It may not be the most elegant solution, but it works.