Cisco IOS Tcl – Understanding Overhead

ciscocisco-iosNetwork

I've not been able to find much in regards to TCL other than the Cisco PDF "Cisco IOS Scripting with TCL Configuration Guide" and I just have a few queries.

I'm looking into potentially utilising this for pinging a range of addresses withing a specific range of DHCP to check for live hosts. (though this can be done via the broadcast address for our large sites it would produce un-neccessary output as well as ip directed-broadcast)

what I want to know, is if I enter TCLSH to write up a quick script to test the range I like, what effect does this have on the router – I.E

Does it create a script file in memory that is held or is it run and forgotten after i exit tcl mode?

Does the script cause any significant overhead on the router that is worth noting?

Less important, but something I've been trying to find – Is there any specific version that tcl was introduced to IOS as standard?

Cheers guys – appreciate anything that can be provided 🙂

Best Answer

Does it create a script file in memory that is held or is it run and forgotten after I exit tcl mode?

Yes it's only saved temporary in memory. You can save the script to a normal text file and rename it to end with .tcl, then upload it to the flash and run it from there. For instance: Router#tclsh flash:/test.tcl.

Does the script cause any significant overhead on the router that is worth noting?

The overhead is only significant if the script is extremely large and utilizes lots of different processes. Remember that script errors with infinite loops can cause a switch to crash, even the high end versions.

Less important, but something I've been trying to find - Is there any specific version that tcl was introduced to IOS as standard?

Cisco IOS Scripting with Tcl

12.3(2)T 12.3(7)T 12.2(25)S 12.2(33)SXH 12.2(33)SRC 12.2(33)SB Cisco IOS XE 3.1.0SG

The Cisco IOS Scripting with Tcl feature provides the ability to run Tcl version 8.3.4 commands from the Cisco IOS command-line interface.

The following commands were introduced or modified: scripting tcl encdir, scripting tcl init, scripting tcl low-memory, tclquit, tclsh.

Tcl SNMP MIB Access

12.3(7)T 12.2(25)S 12.2(33)SXH 12.2(33)SRC 12.2(33)SB Cisco IOS XE 3.1.0SG

The Tcl SNMP MIB Access feature introduces a set of UNIX-like SNMP commands to make access to Simple Network Management Protocol (SNMP) MIB objects easier.

Tcl UDP and VRF support

15.1(1)T

The Tcl UDP and VRF feature provides support for UDP sockets in IOS Tcl.

The following commands were introduced or modified: fconfigure, socket, udp_open, udp_peek.

Fun little script guide:

http://www.ciscozine.com/ios-scripting-with-tcl/

Example of large script:

https://supportforums.cisco.com/t5/eem-scripting/tcl-script-to-replace-text-in-a-file-stored-in-flash/td-p/2516640