Reload a router from Tcl script

In his comment, Michal has asked about the ability to execute IOS commands with prompts from Tcl shell. I haven't found a generic solution yet, but you can reload a router from a Tcl script. First you have to define an EEM applet that reloads the router and can be triggered from command-line interface:
event manager applet forceReload
event none
action 1.0 reload
Now you can use the exec "event manager run forceReload" Tcl command in your Tcl script to run the applet (and reload the router).

Notes:

2 comments:

  1. To reload a router from a TCL script, I have found out the following:
    typeahead "no\n\n"
    exec "reload"
    Works like a charm.
  2. Sadly, the typeahead does not work on IOS-XE anymore. I created a forum post on the cisco website about this: https://community.cisco.com/t5/switching/ios-xe-tcl-typeahead-not-working/td-p/4405404

Add comment
Sidebar