TCL Script here you have an example..

What is TCL or the “Tool Command Language”*, is a very simple, open-source-licensed programming language. Tcl provides basic language features such as variables, procedures, and control, and it runs on almost any modern OS, such as Unix (Linux and non-Linux), MacOS, Windows 95/98/NT/2000/XP/…, PDA systems, and many more. But the key feature of Tcl is its extensibility.

Tcl Developer Exchange

Cisco Documentation for TCL

The Cisco IOS Tcl shell was designed to allow customers to run Tcl commands directly from the Cisco IOS CLI prompt. Cisco IOS software does contain some subsystems such as Embedded Syslog Manager (ESM) and Interactive Voice Response (IVR) that use Tcl interpreters as part of their implementation. These subsystems have their own proprietary commands and keyword options that are not available in the Tcl shell.

For example I use this script to make the router auto generate the scriptfor me for all interfaces; I’m a little bit lazy 🙂

tclsh
 foreach i {
 GigabitEthernet1/18
 Serial2/2/0.1/2/1/1:0
 Serial2/2/0.1/2/1/2:0
 Serial2/2/0.1/2/1/3:0
 Serial2/2/0.1/2/2/1:0
 Serial2/2/0.1/2/2/2:0
 Serial2/2/0.1/2/2/3:0
 GigabitEthernet9/24
 } {
 set int [exec "show run inter $i | in Serial"]
 if {[regexp "Serial" $int ]} {
 puts "interface $i"
 puts "encap ppp"
 }  else {
 puts "interface $i"
 puts "cdp enable"
 puts "Dampening"
 puts "no sh"
 }
 }
 }
 }

Or simple you can use the following script to check if you have global reachability in the network.

or a TCL Script to see if the routers in the domain has global reachability

tclsh
 foreach i {
 1.1.1.1        ! this addresses can be taken using show ip int brief | ex una
 2.2.2.2
 } { ping $i rep 1 }

Tip: if you are using Secure CRT you can press the ALT Key and with the mouse select specific information from the Application (SecureCET) Window

Also Remember to do a tclquit to get out of that mode. (using tclq)

Unfortunately TCL is not supported on the 3500’s, the way to test a configuration in this type of Switching device is:

Sw1(config)#macro name ping
 Enter macro commands one per line. End with the character '@'.
 do ping 154.1.6.6
 do ping 154.1.3.3
 @
 Sw1(config)#
 Sw1(config)#macro global apply ping

Type escape sequence to abort.
 Sending 5, 100-byte ICMP Echos to 154.1.6.6, timeout is 2 seconds:
 !!!!!
 Success rate is 100 percent (5/5), round-trip min/avg/max = 124/124/124 ms
 Type escape sequence to abort.
 Sending 5, 100-byte ICMP Echos to 154.1.3.3, timeout is 2 seconds:
 !!!!!
 Success rate is 100 percent (5/5), round-trip min/avg/max = 60/61/64 ms
 Sw1(config)#


A Networker Blog

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s