cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1937
Views
0
Helpful
5
Replies

A little help getting started please

Darren Starr
Level 4
Level 4

I have been coding massive amounts of TCL scripts for IOS and frankly, now that I'm comfortable with TCL as a language I want to make the next move. I have not been able to find a good starting point just yet to make the jump.

I am currently waiting for a copy of the Cisco TCL programmer guide (found a used one) to show up in the mail, but this will take nearly a month.

Can someone take the following script :

  foreach a [ list 6 7 8 9 79 80 81 82 83 84 85 86 87 ] {

  clear line $a

}

And help me convert this so that if I type :

host# clearlab

on the CLI, it will trigger the script and for each "[confirm]" message that shows up, it sends a carriage return.

So far, I have found that I need to register an EEM event (not so hard) and I'll need to import the Cisco libraries. I believe I'll need to also save this to flash using puts [ open...

Any help would be immensly appreciated!

5 Replies 5

Joe Clarke
Cisco Employee
Cisco Employee

What is the event you want to use to trigger the clear line?

Joseph,

Thanks for the response.

As mentioned above... I'd like to make use of the CLI event of a user typing clearlab

You could do an applet like:

event manager environment vty_lines 6 7 8 9 79 80 81 82 83 84 85 86 87

event manager applet clear-vtys

event cli pattern "^clearlab" enter

action 000 cli command "enable"

action 001 foreach a $vty_lines

action 002  cli command "clear line $a" pattern "confirm"

action 003  cli command "y"

action 004 end

Certainly! But it wouldn't help me to learn how to properly trigger TCL scripts from the command line

I only recommended that particular example randomly. I actually plan to use it as a template to hopefully do much grander things

Thanks a lot for this one though, it is also going into my library under "sometimes simple tasks are best done simple"

You can take that applet to http://www.marcuscom.com/convert_applet to get the EEM Tcl version.  The results from that site can give you an EEM Tcl policy that you can register and trigger using the same clearlab command.