Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

Remote execution of Cisco IOS commands through console server in Tcl script

Hello everybody!

Could you please help me in the following:

 

General problem

There is a router with NM-32A, which serves as a console server for a number of Cisco routers and switches. When some network diagram has been assembled using some of them, and the neccessary devices are turned on, i would like some Tcl script to run through them all, configure their hostnames, turn on their corresponding interfaces, execute "show cdp neighbors" command, save the output into tcl list variables (one for each device in the scheme), search through each list variable and figure out whether the devices are connected as needed, i.e. according to diagram, whether corresponding interfaces are OK and so on. Is this possible?  Here I don't ask you for exact tcl script, rather the question is principal - possible or not, as well as direction of research?

I think tcl script must be on console server, and there it is executed, starting to configure the devices in the scheme etc.

 

Partial problem #1

I've mastered how to send some responses ahead of the Cisco IOS commands in tcl script, e.g. 

typeahead "y"; exec "clear line xx"

But I've faced with difficulty like this: when I use 

exec "telnet x.x.x.x 20xx"
set CDPList [exec "show cdp neighbors"]
send [binary format c 0x1E]x
typeahead "y"; exec "clear line xx"

the console hangs with no output after exec "telnet x.x.x.x 20xx" tcl string, so I need to clear that line from other vty session to the same console server.

The question here is how one could execute commands remotely, when in reverse telnet session, through tcl script? Should I use typeahead directive with all the commands for execution on the target device before the exec "telnet x.x.x.x 20xx" command?

 

Partial problem #2

How  tcl string looks like that returns to console server from reverse telnet session? How to send <CTRL-Shift-6 x> sequence once in tclsh when the srcript is currently in reverse telnet session?

 

Hope to hear from you!

Eugene

 

427
Views
0
Helpful
0
Replies
CreatePlease to create content