Reload EEM Tcl policy with help of Tcl shell
Testing Embedded Event Manager (EEM) Tcl policies is a convoluted process:
Alternatively, if you define alias exec eem tclsh flash:changePolicy.tcl, you can specify policy name as an argument to the eem command, for example eem testPolicy.tcl.
- Source file is usually edited on a general-purpose workstation.
- The file has to be downloaded to router's local storage (EEM does not register non-local policies).
- The new version of the EEM policy has to be registered with EEM with event manager policy configuration command
- After all these steps, the new policy can be tested.
set policy [lindex $argv 0]To use the script, follow these steps:
set source "tftp://10.0.0.10/tcl/" # replace with your host and directory
set destination "nvram:" # replace with local storage device
if {[string equal $policy ""]} {
return -code error "expected policy name"
}
puts "replacing policy: $policy"
ios_config "file prompt quiet"
ios_config "no event manager policy $policy" ""
exec "copy $source$policy $destination$policy"
ios_config "event manager policy $policy"
ios_config "no file prompt quiet"
- Save the script in a .tcl file (for example, changePolicy.tcl)
- Change the script parameters (remote host and local storage)
- Save the .tcl file to your router's local storage (you can also run it from a remote server)
- Configure a command alias, for example alias exec eem tclsh flash:changePolicy.tcl testPolicy.tcl
Alternatively, if you define alias exec eem tclsh flash:changePolicy.tcl, you can specify policy name as an argument to the eem command, for example eem testPolicy.tcl.
1 comments: