cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2490
Views
0
Helpful
4
Replies

Load a TCL Script from Startup?

astoffel1
Level 1
Level 1

I was wondering we have templates for our managed devices. We have 3 or 4 TCL scripts per device, when we add a new device we load the template and then manually add the TCL script to the correct folder.

My question is there any way to load a TCL from our template instead of manual moving files to the correct folder on the cisco device. I was testing with a simple script that will simple print to the log. This works correctly if I copy and paste from the command line but nested in the config file it will never create the file. Is there a limitation that "cisco interpreter"(basically copying a config file to startup and reloading) that will not allow tclsh to work correctly. 

<Some configs>
interface blah
ip blah
<Some Configs>
tclsh
puts [open flash:/tcl/test.tcl w+] {
::cisco::eem::event_register_none
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*
action_syslog msg "TESTING TCL LOADER"
}
tclquit
!
event manager policy test.tcl
<Some configs>
end

1 Accepted Solution

Accepted Solutions

Do they have to be Tcl?  Can you use applets instead?  At least the basic connectivity policy can be an applet to bootstrap things enough to get the Tcl policies.

View solution in original post

4 Replies 4

Joe Clarke
Cisco Employee
Cisco Employee

If the devices support EEM 4.0, you can have them load directly from the remote server:

event manager policy test.tcl remote URL

Else, you can add "do" lines to the startup config to put the file in place:

do event manager update user policy name test.tcl repository URL

This assumes those commands will not be interactive, though.

As a final solution, consider creating an applet policy that will fetch all of the required Tcl policies at boot time, and then remove itself.

Thanks Joe!

The issue is some of the scripts we use are for connectivity depending on link availability. So the issue we would run into is to reach the URL we would need the script and to reach the URL the script is needed (run into a chicken and the eggs problem)

Do they have to be Tcl?  Can you use applets instead?  At least the basic connectivity policy can be an applet to bootstrap things enough to get the Tcl policies.

I do like the idea of using an applet to get enough connectivity working correctly to ensure connectivity to the remote server. Some of the TCL are pretty complex so this may be a challenge but this sounds like the only real solution vs loading the script manually.