db95d4d673f87fd5c731098ed8522737da277649
3 set host
[lrange $argv 0 0]
5 puts "usage: configure_switch_bootstrap.tcl \[sw1|sw2|swg1|swg2|swm\]"
10 if { $host == "swg1" } { set ipaddress
"10.133.26.231" }
11 if { $host == "swg2" } { set ipaddress
"10.133.26.232" }
12 if { $host == "swm" } { set ipaddress
"10.133.28.231" }
13 if { $host == "sw1" } { set ipaddress
"10.133.26.231" }
14 if { $host == "sw2" } { set ipaddress
"10.133.26.232" }
15 if { $ipaddress == "" } { puts "unknown switch '$host'""; exit 1 }
17 spawn screen -c . /dev/ttyUSB0
22 while { $state != 1 } {
25 -exact ">" { send "enable
\r" }
27 "Password:" { send "thales\r" }
28 eof { send_user
"connection to host failed\n"; exit 1 }
32 send "configure terminal\r"
33 expect
"#" { send "interface vlan 1\r" }
34 expect
"#" { send "ip address $ipaddress 255.255.255.0\r" }
35 expect
"#" { send "exit\r" }
36 expect
"#" { send "line vty 0 4\r" }
37 expect
"#" { send "password thales\r" }
38 expect
"#" { send "enable password thales\r" }
39 expect
"#" { send "end\r" }
41 # quit switch connection
42 expect
"#" { send "exit\r" }
44 # to quit screen we need to send C-a \.
46 expect
"kill all your windows" { send "y\r" }
49 # vim:set tabstop=4 expandtab shiftwidth=4: