Voice over IP Cisco - Non-interactive CLI commands?

This is Interesting: Free IT Magazines  
Home > Archive > Voice over IP Cisco > November 2007 > Non-interactive CLI commands?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Non-interactive CLI commands?
Robert Kulagowski

2007-11-21, 1:11 pm

I'd like to pre-stage an IOS onto routers, and I use the following:

# copy http://ip.add.r.ess/filename flash:

However, this is an interactive command, and even though I've specified
the source and destination, IOS is still prompting me for source file
and destination file names. That would make my RANCID script more
complicated because now I'd have to program in the "expect" stuff as well.

The ftp-server command on my IOS seems to be gone.

TFTP is dog-slow on our high RTT links.

Am I missing some magic command?

2007-11-21, 1:11 pm

Are you using FTP to copy of HTTP?

With FTP, you would need to start by configuring the ftp username and
password in the general config, then issue:

# copy ftp://source filename url> flash:<destination filename> *enter*
And at the end of your script send an extra "enter/line feed" that will
actually confirm your command to the router.


Jean-Francois Guay, ing.
Consultant Technologies IP - Services Professionnels
Communications Convergentes et Solutions Mobiles
Bell Solutions T.I.C
' 514-391-9698


-----Original Message-----
From: Robert Kulagowski [mailto:rkulagow@gmail.com]
Sent: 21 novembre 2007 08:53
To: cisco-voip@puck.nether.net
Subject: [cisco-voip] Non-interactive CLI commands?

I'd like to pre-stage an IOS onto routers, and I use the following:

# copy http://ip.add.r.ess/filename flash:

However, this is an interactive command, and even though I've specified
the source and destination, IOS is still prompting me for source file
and destination file names. That would make my RANCID script more
complicated because now I'd have to program in the "expect" stuff as
well.

The ftp-server command on my IOS seems to be gone.

TFTP is dog-slow on our high RTT links.

Am I missing some magic command?
Robert Kulagowski

2007-11-21, 1:11 pm

jean-francois.guay@bell.ca wrote:
> Are you using FTP to copy of HTTP?
>
> With FTP, you would need to start by configuring the ftp username and
> password in the general config, then issue:
>
> # copy ftp://source filename url> flash:<destination filename> *enter*
> And at the end of your script send an extra "enter/line feed" that will
> actually confirm your command to the router.


Well, I'm using HTTP so that I don't need to provide login credentials
when I pull the IOS to the router.

The sticking point is that I want to make this script _very_ simple.
Using clogin from RANCID I can script non-interactive commands quite
easily, but to get the script to send extra CR is the issue, and I'd
prefer not to do that.

So, there's no "I-Know-What-Im-Doing-Do-What-I-Say" mode for the copy
command?
David Sullivan

2007-11-21, 1:11 pm

cisco-voip-bounces@puck.nether.net wrote:
> jean-francois.guay@bell.ca wrote:
>
> Well, I'm using HTTP so that I don't need to provide login
> credentials when I pull the IOS to the router.
>
> The sticking point is that I want to make this script _very_ simple.
> Using clogin from RANCID I can script non-interactive
> commands quite easily, but to get the script to send extra CR
> is the issue, and I'd prefer not to do that.


Sending CR isn't tricky, just add \n to the end of the line and that'll
send a CR after your command. I've some upgrade scripts for older
switches where I have to use this for deleting old content since they
don't support recursive deletes and prompt.

But this there is a better way:

http://ioshints.blogspot.com/2006/1...ed-by-cisco-ios
..html

Note the caveat though, you may not want it saved back to the
startup-config

David Sullivan
IT Services Systems Team
Barnet College
-----------------------------------------------------------------------------
This communication may contain privileged or confidential information which
is for the exclusive use of the intended recipient. If you are not the
intended recipient, please note that you may not distribute or use this
communication or the information it contains. If this e-mail has reached you
in error, please delete it and any attachment.

Internet communications are not secure and Barnet college does not accept
legal responsibility for the content of this message. Any views or opinions
expressed are those of the author and not necessarily those of Barnet College.

Please note that Barnet college reserves the right to monitor the
source/destinations of all incoming or outgoing e-mail communications.
-----------------------------------------------------------------------------

2007-11-21, 1:11 pm

By issuing the

# copy http://<filename url> flash:<destination filename> *enter* +
*enter*

in your script, you should not have to enter additionnal information and
the router should go on its way. The second *enter*/line feed confirms
the command for you by responding automatically to the router
confirmation dialog for which "yes" is the default answer.

I don't think that should be too hard to implement, probably requirering
an extra "\n" or two in your script.


Jean-Francois Guay, ing.
Consultant Technologies IP - Services Professionnels
Communications Convergentes et Solutions Mobiles
Bell Solutions T.I.C
' 514-391-9698


-----Original Message-----
From: Robert Kulagowski [mailto:rkulagow@gmail.com]
Sent: 21 novembre 2007 10:16
To: cisco-voip@puck.nether.net
Subject: Re: [cisco-voip] Non-interactive CLI commands?

jean-francois.guay@bell.ca wrote:
> Are you using FTP to copy of HTTP?
>
> With FTP, you would need to start by configuring the ftp username and
> password in the general config, then issue:
>
> # copy ftp://source filename url> flash:<destination filename> *enter*
> And at the end of your script send an extra "enter/line feed" that

will
> actually confirm your command to the router.


Well, I'm using HTTP so that I don't need to provide login credentials
when I pull the IOS to the router.

The sticking point is that I want to make this script _very_ simple.
Using clogin from RANCID I can script non-interactive commands quite
easily, but to get the script to send extra CR is the issue, and I'd
prefer not to do that.

So, there's no "I-Know-What-Im-Doing-Do-What-I-Say" mode for the copy
command?
Jonathan Charles

2007-11-24, 1:11 pm

In the script, provide the responses the system is looking for...

For example:

copy tftp flash
10.1.1.1
newios.bin



[include carriage returns to get it to copy...]


Jonathan

On Nov 21, 2007 7:53 AM, Robert Kulagowski <rkulagow@gmail.com> wrote:
> I'd like to pre-stage an IOS onto routers, and I use the following:
>
> # copy http://ip.add.r.ess/filename flash:
>
> However, this is an interactive command, and even though I've specified
> the source and destination, IOS is still prompting me for source file
> and destination file names. That would make my RANCID script more
> complicated because now I'd have to program in the "expect" stuff as well.
>
> The ftp-server command on my IOS seems to be gone.
>
> TFTP is dog-slow on our high RTT links.
>
> Am I missing some magic command?
> ________________________________________
_______
> cisco-voip mailing list
> cisco-voip@puck.nether.net
> https://puck.nether.net/mailman/listinfo/cisco-voip
>

Robert Kulagowski

2007-11-28, 1:11 pm

jean-francois.guay@bell.ca wrote:
> By issuing the
>
> # copy http://<filename url> flash:<destination filename> *enter* +
> *enter*
>
> in your script, you should not have to enter additionnal information and
> the router should go on its way. The second *enter*/line feed confirms
> the command for you by responding automatically to the router
> confirmation dialog for which "yes" is the default answer.
>
> I don't think that should be too hard to implement, probably requirering
> an extra "\n" or two in your script.


That's exactly what it was - I simply added in the \n into my clogin
command and increased the timeout. A simple for i in {foo} loop in bash
did the rest and if I'm not careful I might script myself out of a job!
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com