4 set method [lindex $argv 0]
5 set host [lindex $argv 1]
6 set user [lindex $argv 2]
7 set password [lindex $argv 3]
8 set dryrun [lindex $argv 4]
9 set model [lindex $argv 5]
10 set sequence [lindex $argv 6]
13 if { "$dryrun" == "True" } {
14 set reset_msg "Test: No error"
16 set reset_msg "Reset: No error"
19 set cmd_list { {"ssh $user@$host"} {"telnet $host"} }
21 if { "$method" == "ssh" || "$method" == "telnet" } {
24 if { "$method" == "telnet" } {
31 "password:" { send "$password\n" ; exp_continue }
32 -re "User Name.*" { send "$user\r"; exp_continue}
33 -re "Password.*" { send "$password\r"; exp_continue}
34 -re "Access to the Control Console will be denied" {
35 send_user "Error $method: $expect_out(0,string)\n"; exit }
36 "Are you sure you want to continue connecting (yes/no)? " { send "yes\n" ; exp_continue }
37 "Permission denied" { send_user "Error $method: username/password: $expect_out(0,string)"; exit }
38 "Could not resolve hostname" { send_user "Error $method: $expect_out(0,string)"; exit }
39 "Connection refused" { send_user "Error $method: Could not connect\n"; exit }
40 "Connection timed out" { send_user "Error $method: Connection timed out\n"; exit }
41 "No route to host" { send_user "Error $method: $expect_out(0,string)"; exit }
43 timeout { send_user "Error $method: Timeout\n"; exit; }
48 set steps [split $sequence " "]
50 #send_user "Sending step $step\n";
51 expect "> " { send "$step\r\n"; }
54 if { "$dryrun" == "True" } {
55 expect "Enter 'YES' to continue or <ENTER> to cancel" { send "\r\n\r\n"; }
57 expect "Enter 'YES' to continue or <ENTER> to cancel" { send "YES\r\n"; }
59 expect "> " { send "
\e\e\e\e4\r\n"; }
61 expect eof { send_user "$reset_msg\n" }