06-12-2014 02:29 PM
I'm trying to run the following command on a range of devices:
copy tftp://10.10.10.10/new-acl.txt running-config
The command is in enable mode and interactive, it prompts for confirmation of the filename.
Here's the CLI template I've cobbled together:
#MODE_ENABLE #INTERACTIVE copy tftp://10.10.10.10/new-acl.txt running-config<IQ>Destination filename [running-config]? <R>running-config #ENDS_INTERACTIVE #MODE_END_ENABLE
However, it fails with:
Error : Exception while sending interactive commands to device, java.util.regex.PatternSyntaxException:Illegal character range near index 31 'Destination filename [running-config]? ' ^
I've tried escaping the string with single quotes, double quotes and backslashes for the []? characters, but nothing seems to work. Any advice from the community on how to proceed?
06-12-2014 07:55 PM
Hi,
Can you try syntax like below :
copy tftp://x.x.x.x/ipiac_qos_configuration_updates.txt running<R>
Thanks-
Afroz
****Ratings Encourages Contributors ****
06-16-2014 06:33 AM
Nope. I wasn't sure if you implied that doing <R> without <IQ> would just blindly OK everything (which would be a cool less-than-documented feature), but that does not appear to happen either:
Error : Exception while sending interactive commands to device, Expect timeout: Failed to match expected device output due to Expect timeout current timeout 60000. Current output : Destination filename [running-config ]? Current expects : (<switchname>|<switchname>)\([^\)]+\)#\s*\z <switchname>#
Where <switchname> is the name of the switch I'm deploying to.
06-16-2014 07:05 AM
you will be deploying this template to that device Only so no need to specify the device ip..
above is the error you are getting when running the suggested command ?
06-16-2014 08:05 AM
Based on what I understood your suggestion to be, I changed the template from:
#MODE_ENABLE #INTERACTIVE copy tftp://10.10.10.10/new-acl.txt running-config<IQ>Destination filename [running-config]? <R>running-config #ENDS_INTERACTIVE #MODE_END_ENABLE
to:
#MODE_ENABLE #INTERACTIVE copy tftp://10.10.10.10/new-acl.txt running-config<R> #ENDS_INTERACTIVE #MODE_END_ENABLE
Deploying the new template resulted in the error:
Error : Exception while sending interactive commands to device, Expect timeout: Failed to match expected device output due to Expect timeout current timeout 60000. Current output : Destination filename [running-config ]? Current expects : (<switchname>|<switchname>)\([^\)]+\)#\s*\z <switchname>#
03-20-2016 10:45 PM
This is how I did it and it seemed to work. I don't know if the #MODE_ENABLE works show I entered the command is if I were in Global Config. Also note no space between the question (<IQ> and the response <R>
#INTERACTIVE
do copy tftp://10.50.22.87/MOH/$MOHFilename flash:/media/$MOHFilename<IQ>/media/$MOHFilename<R>/media/$MOHFilename
telephony-service
moh flash:/media/$MOHFilename
Hope this helps
11-29-2015 04:41 PM
Hi Toivo,
Sorry to dig up this old thread but did you end up getting this to work? I'd recommend you try to match a only sub-set of the entire string that you are expecting and avoid any characters that could be considered to be special. In this instance I'd try "Destination filename".
I was working on something similar to this (which is how I came across this thread) and matching on the above works for me. Can you please try the below and let me know if this works?
#MODE_ENABLE
#INTERACTIVE
copy tftp://10.10.10.10/new-acl.txt running-config<IQ>Destination filename<R>running-config
#ENDS_INTERACTIVE
#MODE_END_ENABLE
11-30-2015 05:33 AM
No, never got it to work, and I've since left that position (and they got Solarwinds instead), but thank you for the help! Hopefully it'll help out someone else. I'll also pass it on to my old team.
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: