cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2975
Views
5
Helpful
7
Replies

Prime Infrastructure 2.1 CLI Template to TFTP Copy File?

Toivo Voll
Level 1
Level 1

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?

7 Replies 7

AFROJ AHMAD
Cisco Employee
Cisco Employee

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 ****

Thanks- Afroz [Do rate the useful post] ****Ratings Encourages Contributors ****

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.

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 ?

Thanks- Afroz [Do rate the useful post] ****Ratings Encourages Contributors ****

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>#

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

Philip Petty
Cisco Employee
Cisco Employee

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

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.

Getting Started

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: