Automated config loader

I have recently began the journey again after a three month standstill. Since it was taking a lot of time to shift around the configs, I decided to try to automate as much as possible, so I created a small script:

#!/bin/bash
routerstart=1;
routerend=10;
DIRECTORY=$1;
portstart=3001;
portend=3010;
for (( i=$routerstart, k=$portstart; i<=$routerend, k<=$portend; i++, k++ )) ; do
echo R$i status;
(printf "\n"; echo "enable"; echo "configure replace bootflash:/INE/advanced.technology.labs/$DIRECTORY/R$i.txt force ignorecase"; sleep 1; echo "quit" ) | telnet rack.yourdomain.edu $k | grep -i R$i;
done

Which really does the job. I have uploaded all config file to routers and this script just uses configure replace pointing to the right directory and txt file.

Pretty neat, since it only takes me 10 seconds to load the configs on all routers.

Please keep in mind that I am using telnet to the port mapped to the serial console of the router. So no matter what config is applied, I should always have access to change it.

I also needed to add some config lines for all config files:

 

#sed -i '6i version 15.4 \nplatform console serial\nlicense boot level premium' INE-config-files/*/*/*/*.txt

Alex