Keep standard 30MHzDF and adds the lite configuration
[debian6500.git] / simple-cdd / additional_scripts / configure_switch_bootstrap.tcl
CommitLineData
b3f3562f
OL
1#!/usr/bin/expect
2
3set host [lrange $argv 0 0]
4if { $host == "" } {
3a8d2b2f 5 puts "usage: configure_switch_bootstrap.tcl \[sw1|sw2|swg1|swg2|swm\]"
b3f3562f
OL
6 exit 1
7}
8
9set ipaddress ""
10if { $host == "swg1" } { set ipaddress "10.133.26.231" }
11if { $host == "swg2" } { set ipaddress "10.133.26.232" }
12if { $host == "swm" } { set ipaddress "10.133.28.231" }
8a1c6cff
OL
13if { $host == "sw1" } { set ipaddress "10.133.26.231" }
14if { $host == "sw2" } { set ipaddress "10.133.26.232" }
b3f3562f
OL
15if { $ipaddress == "" } { puts "unknown switch '$host'""; exit 1 }
16
17spawn screen -c . /dev/ttyUSB0
18
19set timeout 5
20
21set state 0
22while { $state != 1 } {
23 expect {
24 timeout { send "\r" }
25 -exact ">" { send "enable\r" }
26 "#" { set state 1 }
27 "Password:" { send "thales\r" }
28 eof { send_user "connection to host failed\n"; exit 1 }
29 }
30}
31
32send "configure terminal\r"
33expect "#" { send "interface vlan 1\r" }
34expect "#" { send "ip address $ipaddress 255.255.255.0\r" }
35expect "#" { send "exit\r" }
36expect "#" { send "line vty 0 4\r" }
37expect "#" { send "password thales\r" }
38expect "#" { send "enable password thales\r" }
39expect "#" { send "end\r" }
40
41# quit switch connection
42expect "#" { send "exit\r" }
43
44# to quit screen we need to send C-a \.
45send "\001\\"
46expect "kill all your windows" { send "y\r" }
47
48exit 0
49# vim:set tabstop=4 expandtab shiftwidth=4: