

Ios_config "no file prompt quiet"To use the script, follow these steps: Ios_config "event manager policy $policy" Ios_config "no event manager policy $policy" ""Įxec "copy $source$policy $destination$policy" Return -code error "expected policy name" Set destination "nvram:" # replace with local storage device Set source "t" # replace with your host and directory While you can use EEM applet to automate this process, slightly more flexible approach (you can specify the policy name to be replaced) can be implemented with Tcl script: set policy After all these steps, the new policy can be tested.The new version of the EEM policy has to be registered with EEM with event manager policy configuration command.The file has to be downloaded to router's local storage (EEM does not register non-local policies).Source file is usually edited on a general-purpose workstation.Testing Embedded Event Manager (EEM) Tcl policies is a convoluted process: Ios_config "interface $ifname" "shutdown" # ifname is set to first CLI parameter (interface name) The show ip interface brief configuration command is executed and filtered with the interface name.IOS configuration commands interface ifname and shutdown are executed.If it fails, the interface name is not correct and the script aborts. The show ip interface ifnamecommand is executed.If the ifname is empty, the script aborts and prints the usage guidelines (again, in a more human-oriented programming language, this would be if (ifname = “”).Variable ifname is set to the value of the first command-line parameter (in many other programming languages, this would be written as argv).Here's a short script that shuts down the interface and displays its status: In a comment to the “ Execute multiple commands at once” post, Michal has asked for a complete Tcl-shell-with-parameter example. Now you can use the package require name Tcl command to load the packages you need in your Tcl script. When you have completed these steps, the pkgIndex.tcl file will be executed every time the Tcl shell is started in Cisco IOS, defining all the packages you've prepared. Configure the execution of the pkgIndex.tcl file at tclsh startup with the scripting tcl init configuration command (for example, scripting tcl init flash:tcl/pkgIndex.tcl).Transfer all the source files into a directory on the router's flash (or any other local storage device).

This command sets the $dir variable to the path of the pkgIndex.tcl file.

#ACTIVETCL REST INSTALL#
Install a Tcl interpreter on your workstation (use ActiveState's ActiveTcl in Windows environment).Shell on Cisco IOS by following this procedure: Although it's not exactly trivial, you can use standard Tcl packages with Tcl Static int EvalInternalProc( const char *procname, int ct. Tcl_MyDStringAppend(&ds, InternalProcName(id)) Static int SourceInternalProc( int id, const char *args, const char *source) Sprintf(result, " %s%08x ", PROCPREFIX, value) Static char * InternalProcName( int value) Tcl_DStringAppend(ds, string, strlen(string)) Static void Tcl_MyDStringAppend(Tcl_DString * ds, char *string) # define bcopy( src, dest, count) memmove((dest), (src), (count)) # define bzero( mem, sz) memset((mem), 0, (sz)) Static char RCSID = "$Id: tclplugin.c,v 1.65 6 20:02:12 mooooooo Exp $ "
#ACTIVETCL REST SOFTWARE#
* the Free Software Foundation either version 2 of the License, or *
#ACTIVETCL REST LICENSE#
* it under the terms of the GNU General Public License as published by * * This program is free software you can redistribute it and/or modify * Tclplugin.c - Tcl plugin for xchat 1.9.x / 2.x.xĬopyright : Copyright 2002-2012 Daniel P.
