Forsaken_GA wrote: » You're probably not going to find anyone willing to do this for free on this forum. You're essentially requesting a custom script, and that's something you should either contract out, or learn enough to code yourself.
unset config_router1 unset config_router2 #set string "hostname loopback G0/0 S0/0 RIP BGP next_hop" set Router(1) "router1 10.1.1.1 20.1.1.1 30.1.1.2 40.0.0.0 50.1.1.1 60.1.1.1" set Router(2) "router2 10.1.2.1 20.1.2.1 30.1.2.2 40.0.0.0 50.1.2.1 60.1.2.1" for {set i 1} {$i<3} {incr i} { append config_router$i "hostname [lrange $Router($i) 0 0]\n interface loopback0\n ip address [lrange $Router($i) 1 1] 255.255.255.255 \n interface gig 0/0\n ip address [lrange $Router($i) 2 2] 255.255.255.0 \n interface Serial 0/0\n ip address [lrange $Router($i) 3 3] 255.255.255.0 \n router rip\n network [lrange $Router($i) 4 4]\n router bgp 1\n neighbor [lrange $Router($i) 5 5] remote-as 100\n ip route [lrange $Router($i) 6 6] 255.255.255.255 70.1.1.1" } puts $config_router1 puts $config_router2 ***************************************** Output will be something like this... puts $config_router1 puts $config_router2 router2 10.1.2.1 20.1.2.1 30.1.2.2 40.0.0.0 50.1.2.1 60.1.2.1 expect1.311> expect1.312> +> +> +> +> +> +> +> +> +> +> +> +> +> +> +> expect1.313> expect1.314> hostname router1 interface loopback0 ip address 10.1.1.1 255.255.255.255 interface gig 0/0 ip address 20.1.1.1 255.255.255.0 interface Serial 0/0 ip address 30.1.1.2 255.255.255.0 router rip network 40.0.0.0 router bgp 1 neighbor 50.1.1.1 remote-as 100 ip route 60.1.1.1 255.255.255.255 70.1.1.1 expect1.315> hostname router2 interface loopback0 ip address 10.1.2.1 255.255.255.255 interface gig 0/0 ip address 20.1.2.1 255.255.255.0 interface Serial 0/0 ip address 30.1.2.2 255.255.255.0 router rip network 40.0.0.0 router bgp 1 neighbor 50.1.2.1 remote-as 100 ip route 60.1.2.1 255.255.255.255 70.1.1.1
Cucumber wrote: » I currently have a 134 KB script that reads a CSV input file, with each row having a IP address. The script connects to said IP address, feeds a predefined username and password, and have an empty routine to basically do whatever you want.
tiersten wrote: » Eh? 134KB just to do that? Seems a bit big.
Cucumber wrote: » Yup it does a couple of fancy stuff. Like spawning several processes for large CSV input files. The input file may have several IP addreses per device, along other flags to alter script behavior (device type, exception passwords, etc). It detects whether VTY or user/pass is asked for. Detects EXEC level and executes "enable" accordingly. It also has several predefined library routines (i.e. to generate and parse inventories, to save command outputs to a file, etc). EDIT: Oh yeah, and if it cant connect to a device it saves the device in a pending device list, it may try connecting several times, and produces a single log CSV file for further processing.