Hi All,
I am not able to telenet through below code. Actually calling to this proc is not entering into "expect" portion.
can someone help it out.
PROCcapture { login password ipAddress captureCmd } {
spawn telnet
# Handling the response generated
expect {
# Connection refused
-i $spawn_id "*Connect*failed*" {
set retValue "Wrong IP Address"
exit
}
# Connection TimeOut
-i $spawn_id "timeout" {
exit
}
-i $spawn_id "*Escape Character*" {
send -i $spawn_id "unset ntlm\r"
exp_sleep 1
send -i $spawn_id "open $ipAddress\r"
exp_continue
}
# Sending UserName and Password
# UserName Required
-i $spawn_id "*(y/n)*" {
send -i $spawn_id "y\r"
exp_continue
}
-i $spawn_id "*login:" {
send -i $spawn_id "$login\r"
exp_continue
}
# Password Required
-i $spawn_id "*password: " {
send -i $spawn_id "$password\r"
exp_continue
}
# Invalid UserName or Password
-i $spawn_id "*Login*Failed*" {
set retValue "Invalid Username password, Authentication Failure"
exit
# Further handling still to be done
}
# Awaiting Prompt
-i $spawn_id "*C:*>*" {
set retValue "Prompt Achieved"
send -i $spawn_id "$captureCmd\r"
expect {
-i $spawn_id "*Capturing*" {
# Further handling still to be done
}
}
}
}
} # End of procedure PROCcapture
# spawn a new telnet session for capturing
Thanks in advance