Mailing List Archive

Using clogin to push multi-line banner motd's?
Hi,

Forgive me for asking something whacky, bordering on outright stupid,
but this seems like the appropriate forum.

I've been using rancid's clogin as a mechanism for pushing out config
policy changes to IOS-speaking devices automagically, and I have a
feeling others are doing the same.

One small stumbling block I've come across is, I'd like to be able to
push out multi-line banner motd's, eg:

crisco1.lab(config)#banner motd ^
Enter TEXT message. End with the character '^'.
line 1 blah blah
line 2 blah blah
line 2 blah blah
[...]
^
crisco1.lab(config)#

So, I run 'clogin -x [command sequence] [device]'...

spawn telnet crisco1.lab
[...]

User Access Verification

Username: rancid
Password:

crisco1.lab>enable
Password:
crisco1.lab#term length
crisco1.lab#conf t
Enter configuration commands, one per line. End with CNTL/Z.
crisco1.lab(config)#no banner motd
crisco1.lab(config)#banner motd ^
Enter TEXT message. End with the character '^'.

[hangs]

Don't get me wrong, I realize this is the correct behavior, as
clogin's not seeing the prompt it's expecting. Question is, what
work-arounds for this particular issue are there, short of sticking
with one-line banner motd's, or pushing out the config snippets by
some other means?

For bonus points, has anyone written a patch to get clogin to behave
as I want it to, by any chance? :-)

Thanks in advance,
-adam
Using clogin to push multi-line banner motd's? [ In reply to ]
Tue, Feb 26, 2002 at 12:24:33AM -0500, Adam Rothschild:
> Hi,
>
> Forgive me for asking something whacky, bordering on outright stupid,
> but this seems like the appropriate forum.
>
> I've been using rancid's clogin as a mechanism for pushing out config
> policy changes to IOS-speaking devices automagically, and I have a
> feeling others are doing the same.
>
> One small stumbling block I've come across is, I'd like to be able to
> push out multi-line banner motd's, eg:
>
> crisco1.lab(config)#banner motd ^
> Enter TEXT message. End with the character '^'.
> line 1 blah blah
> line 2 blah blah
> line 2 blah blah
> [...]
> ^
> crisco1.lab(config)#
>
> So, I run 'clogin -x [command sequence] [device]'...
>
> spawn telnet crisco1.lab
> [...]
>
> User Access Verification
>
> Username: rancid
> Password:
>
> crisco1.lab>enable
> Password:
> crisco1.lab#term length
> crisco1.lab#conf t
> Enter configuration commands, one per line. End with CNTL/Z.
> crisco1.lab(config)#no banner motd
> crisco1.lab(config)#banner motd ^
> Enter TEXT message. End with the character '^'.
>
> [hangs]
>
> Don't get me wrong, I realize this is the correct behavior, as
> clogin's not seeing the prompt it's expecting. Question is, what
> work-arounds for this particular issue are there, short of sticking
> with one-line banner motd's, or pushing out the config snippets by
> some other means?

you could use -s and rancid-*/util/*.exp as a template. you could
also try embedding \n's in the input. i presume expect's send() will
recursively evaluate it's argument and expand the \n, but do not know
for sure.

> For bonus points, has anyone written a patch to get clogin to behave
> as I want it to, by any chance? :-)
>
> Thanks in advance,
> -adam
Using clogin to push multi-line banner motd's? [ In reply to ]
On Tue, Feb 26, 2002 at 12:24:33AM -0500, Adam Rothschild wrote:
> One small stumbling block I've come across is, I'd like to be able to
> push out multi-line banner motd's, eg:

I've done config changes by putting the new config bits into a
file on my tftp/rcp/ftp// server and then telling the router:
copy URL running

Works quite well.
--asp