set ipAddr [lindex $argv 0]
set FTP [lindex $argv 1]
spawn telnet $ipAddr
log_file update.log
expect "login:"
send "admin\r"
expect "Password:"
send "password\r"
expect ">"
send "\003"
expect ">"
send "firmwareshow\r"
expect ">"
send "firmwaredownload\r"
expect "*Do you want to continue*:"
send "y\r"
expect "Server Name or IP Address:"
send "172.16.16.16\r"
expect "User Name:"
send "root\r"
expect "File Name:"
send "./v5.2.3/release.plist\r"
expect "Password:"
send "huawei\r"
expect "*Do you want to continue*:"
send "\r"
set timeout 3000
expect "*HA Rebooting*"
after 120000
spawn telnet $ipAddr
expect "login:"
send "admin\r"
expect "Password:"
send "password\r"
expect ">"
send "\003"
expect ">"
send "firmwareshow\r"
after 60000
expect ">"
send "firmwareshow\r"
after 60000
expect ">"
send "firmwareshow\r"
expect ">"
send "firmwaredownload\r"
expect "Server Name or IP Address:"
send "172.16.16.16\r"
expect "User Name:"
send "root\r"
expect "File Name:"
send "./v5.3.2a/release.plist\r"
expect "Password:"
send "huawei\r"
expect "*Do you want to continue*:"
send "y\r"
set timeout 3000
expect "*HA Rebooting*"
after 120000
spawn telnet $ipAddr
expect "login:"
send "admin\r"
expect "Password:"
send "password\r"
expect ">"
send "\003"
expect ">"
send "firmwareshow\r"
expect ">"
send "firmwareshow\r"
after 120000
expect ">"
send "firmwareshow\r"
after 120000
expect ">"
send "firmwareshow\r"
expect ">"
send "firmwaredownload\r"
expect "Server Name or IP Address:"
send "172.16.16.16\r"
expect "User Name:"
send "root\r"
expect "File Name:"
send "./v6.0.1a/release.plist\r"
expect "*FTP*"
send "2\r"
expect "Password:"
send "huawei\r"
expect "*Do you want to continue*:"
send "y\r"
set timeout 3000
expect "*HA Rebooting*"
after 120000
spawn telnet $ipAddr
expect "login:"
send "admin\r"
expect "Password:"
send "password\r"
expect ">"
send "\003"
expect ">"
send "firmwareshow\r"
after 60000
expect ">"
send "firmwareshow\r"
after 60000
expect ">"
send "firmwareshow\r"
after 30000
expect ">"
send "firmwareshow\r"
expect ">"
send "firmwaredownload\r"
expect "Server Name or IP Address:"
send "172.16.16.16\r"
expect "User Name:"
send "root\r"
expect "File Name:"
send "./v6.1.2/release.plist\r"
expect "*FTP*"
send "2\r"
expect "Password:"
send "huawei\r"
expect "*Do you want to continue*:"
send "y\r"
set timeout 3000
expect "*HA Rebooting*"
after 120000
spawn telnet $ipAddr
expect "login:"