Ccnp

Cisco IOS Scripting with Tcl
The Cisco IOS Scripting with Tcl feature provides the ability to run Tool Command Language (Tcl) version 8.3.4 commands from the Cisco IOS command-line interface (CLI).
Feature History for Cisco IOS Scripting with Tcl

Release 12.3(2)T 12.3(7)T 12.2(25)S 12.2(33)SXH

Modification This feature was introduced. Support was added for accessing SNMP MIB objects usingTcl. This feature was integrated into Cisco IOS Release 12.2(25)S. This feature was integrated into Cisco IOS Release 12.2(33)SXH.

Contents
• • • • • • • •

Prerequisites for Cisco IOS Scripting with Tcl, page 1 Restrictions for Cisco IOS Scripting with Tcl, page 2 Information About Cisco IOS Scripting with Tcl, page 3 How to Configure Cisco IOS Scripting with Tcl, page 4 ConfigurationExamples for Cisco IOS Scripting with Tcl, page 12 Additional References, page 16 Command Reference, page 17 Glossary, page 22

Prerequisites for Cisco IOS Scripting with Tcl

Familiarity with Tcl programming and Cisco IOS commands is assumed.

Corporate Headquarters: Cisco Systems, Inc., 170 West Tasman Drive, San Jose, CA 95134-1706 USA

Copyright © 2003–2004 Cisco Systems, Inc. Allrights reserved.

Cisco IOS Scripting with Tcl Restrictions for Cisco IOS Scripting with Tcl

Tcl commands can be executed from the Tcl configuration mode using the Cisco IOS CLI. Tcl configuration mode, like global configuration mode, is accessed from privileged EXEC mode. Access to privileged EXEC mode should be managed by restricting access using the enable command password.Restrictions for Cisco IOS Scripting with Tcl
• •

If Cisco IOS configuration commands are used within the Tcl scripts, submode commands must be entered as quoted arguments on the same line as the configuration command. Error messages are provided, but you must check that the Tcl script will run successfully because errors may cause the Tcl shell to run in an infinite loop.

Caution

The use of Tclserver sockets to listen to telnet and FTP ports (23 and 21 respectively) will preempt the normal handling of these ports in Cisco IOS software.

Table 1 lists Tcl commands and library calls that do not behave within Cisco IOS software as documented in standard Tcl documents.
Tcl Command Options That Behave Differently in Cisco IOS Software

Table 1

Command after

Keyword ms

Argumentscript

Supported Partially

Comments When the CLI tclsh command is used, there is no event loop implemented unless Embedded Syslog Manager (ESM) is active on the same router. Commands entered using the after Tcl command will not run unless forced using the update command. Sleep mode (the after command) works only with the ms keyword. The optional -time keyword to set the file access time isnot supported in Cisco IOS software. The optional -time keyword to set the file modification time is not supported in Cisco IOS software. When the CLI tclsh command is used, there is no event loop implemented unless Embedded Syslog Manager (ESM) is active on the same router. Commands entered using the fileevent Tcl command will not run unless forced using the update command.

file

-timeatime

No

file

-time

mtime

No

fileevent

Partially

Cisco IOS Release 12.3(2)T, 12.3(7)T, 12.2(25)S

2

Cisco IOS Scripting with Tcl Information About Cisco IOS Scripting with Tcl

Table 1

Tcl Command Options That Behave Differently in Cisco IOS Software (continued)

Command history

Keyword !n

Argument

Supported Partially

Comments The !n shortcut does notwork in Cisco IOS software. Use the history Tcl command with the redo n keyword. When the CLI load command is used, an error message stating “dynamic loading not available on this system” is displayed.

load

No

Information About Cisco IOS Scripting with Tcl
To create and use Tcl scripts within Cisco IOS software, you should understand the following concepts:
• • •

Tcl Shell for…