We upload files to Cisco 2811's by use of SCP.
When uploading files, you can get a variable number of prompts depending on whether or not the file exists and you get password prompts in the middle of the copy from the server you are connecting from:
# on upload
#
# if file not already on Cisco (2 prompts: enter, "password")
# swt.024515#
# swt.024515#copy scp://smdr@172.21.94.9/requests/uploads/cta.txt flash:cta.txt
# Destination filename [cta.txt]?
# Ubuntu 7.10
#
# Password:
# Sending file modes: C0766 26 cta.txt
# !
# 26 bytes copied in 7.696 secs (3 bytes/sec)
# swt.024515#
# if file already on Cisco (3 prompts: enter, enter "password")
# swt.024515#
# swt.024515#copy scp://smdr@172.21.94.9/requests/uploads/cta.txt flash:cta.txt
# Destination filename [cta.txt]?
# %Warning:There is a file already existing with this name
# Do you want to over write? [confirm]
# Ubuntu 7.10
#
# Password:
# Sending file modes: C0766 26 cta.txt
# !
# 26 bytes copied in 5.460 secs (5 bytes/sec)
# swt.024515#
Will CatTools support (someday) the ability to handle situations like this without script tweaking? Note that the [confirm] prompt is different from the filename prompt [cta.txt]? (and this prompt changes based on the filename) and the Password: prompt in the middle of the command (due to connecting via SSH to the server)
I've looked at Kiwi CatTools and it does everything we want except for the ability to handle the file copy commands from Device.CLI.Send commands.
Basically there needs to be an open-ended ability to build a list of custom prompt/responses:
"If you see {string or regexp} then send {some sting}" that operates after a command is sent before advancing to the next command.These should not be required but optional (if they happen, send the commands but don't wait for them or treat lack of a match as an error)
Something like this in the list of commands:
copy scp://smdr@172.21.94.9/requests/uploads/cta.txt flash:cta.txt
$KIWI$ /[.*]\s*\?*/ "\n"
$KIWI$ "Password:" "mypass"
show run
...
Where the $KIWI$ are statements that the CLI.Send commands sees and uses to build on-the-fly custom prompt/answers that may or may not happen after the previous command has been sent. They would be cleared internally when the next real prompt is reached before the next command is sent.