Commit | Line | Data |
---|---|---|
57f52f76 TPVT |
1 | #!/usr/bin/expect |
2 | ||
3 | set sub [lrange $argv 0 0] | |
4 | if { $sub == "" } { set sub "1" } | |
3a8d2b2f | 5 | spawn telnet sw1 |
57f52f76 TPVT |
6 | |
7 | expect { | |
6ded6f01 TPVT |
8 | "Password:" { send "thales\r" } |
9 | incorrect { send_user "invalid password or account\n"; exit } | |
10 | timeout { send_user "connection to $sub timed out\n"; exit } | |
11 | eof { send_user "connection to host failed\n"; exit } | |
57f52f76 TPVT |
12 | } |
13 | expect -exact ">" { send "enable\r" } | |
14 | expect "Password:" { send "thales\r" } | |
15 | ||
16 | expect -exact "#" { send "config terminal\r" } | |
17 | ||
18 | expect -exact "#" { send "vlan 192\r" } | |
19 | expect -exact "#" { send "name Integration\r" } | |
20 | expect -exact "#" { send "exit\r" } | |
3a8d2b2f | 21 | f |
6ded6f01 | 22 | expect -exact "#" { send "interface gigabitEthernet 1/47\r" } |
57f52f76 TPVT |
23 | expect -exact "#" { send "switchport mode access\r" } |
24 | expect -exact "#" { send "switchport access vlan 192\r" } | |
25 | expect -exact "#" { send "exit\r" } | |
26 | ||
27 | expect -exact "#" { send "interface vlan 192\r" } | |
28 | expect -exact "#" { send "ip address 192.168.$sub.231 255.255.255.0\r" } | |
29 | expect -exact "#" { send "ip pim dense-mode\r" } | |
30 | expect -exact "#" { send "no shutdown\r" } | |
31 | expect -exact "#" { send "exit\r" } | |
32 | ||
33 | expect -exact "#" { send "ip route 192.168.$sub.0 255.255.255.0 Vlan192\r" } | |
3a8d2b2f | 34 | expect -exact "#" { send "ip route 192.168.$sub.160 255.255.255.255 10.133.26.160\r" } |
57f52f76 TPVT |
35 | expect -exact "#" { send "ip route 192.168.$sub.101 255.255.255.255 Vlan10\r" } |
36 | expect -exact "#" { send "ip route 192.168.0.0 255.255.255.0 192.168.$sub.230\r" } | |
37 | expect -exact "#" { send "exit\r" } | |
38 | ||
39 | expect -exact "#" { send "exit\r" } | |
40 |