01-09-2014 12:45 AM
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!
01-09-2014 06:58 AM
What is the event you want to use to trigger the clear line?
01-10-2014 01:31 AM
Joseph,
Thanks for the response.
As mentioned above... I'd like to make use of the CLI event of a user typing clearlab
01-10-2014 07:23 AM
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
01-10-2014 10:14 AM
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"
01-10-2014 10:16 AM
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.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide