Tcl Scripting for Cisco IOS

In networking environnements, administrators spend lot of time doing daily tasks, troubleshooting problems …etc.
For this reason, CISCO integrate TCL language in their IOS to let administrators automate tasks ,troubleshooting ,network monitoring and enhancing devices functionalities.
Administrators can now create tcl scripts and store them in the devices flash then run them whenever they need it.
Tcl Language :
Tcl is a scripting interpreted programming language. It is very simple and It is commonly used for rapid prototyping, scripted applications, GUIs, and testing.
Example :
When a router interface goes down we will activate ospf in the other interfaces. We will use EEM to detect the event of failure of the interface.
The EEM applet :
event manager applet checkFastInterface event syslog pattern “ .*Interface FastEthernet0/1, changed state to down.*” action 1.0 cli command "tclsh flash:activate_ospf.tcl"
Now we create the activate_ospf.tcl :
ios_config “router ospf 100” ios_config “router-id 1.1.1.1” ios_config “exit” for {set z 0} {z<3} {incr z}{ set interface “int Ethernet 1/” append interface $z ios_config $interface ios_config “ip ospf 100 area 0” ios_config “exit” }
Useful Links:
no comment