Tuesday, August 12, 2014

Fun Programming: For Network Engineers

Sometimes its a tedious task to manually configure CLI's on the network devices.
Imagine how much time it will take to configure say near to 100 ACL or VLAN and then configuring each of them.Well the question is not about how to improve your typing skills indeed its about leveraging programming/coding skills for these simpler task to save time and be more efficient.I realize most networking folks aren't going to run out and start doing Tcl programming.

As its almost everywhere "Programming: An Essential Skill For Network Engineers" http://ubm.io/1pKNb9f

WHY not to start with some basic scripting to make life easier :

Cisco has embedded TCL in CISCO IOS.The Tcl interpreter is invoked by typing "tclsh" at the enable EXEC mode prompt. The Tcl shell attempts to interpret a command as a Tcl command. If that fails, it then tries to interpret the command as a Cisco CLI command.Your Tcl program can issue EXEC or CONFIG mode commands. This allows you to write Tcl programs to build menus or walk junior staff through configuration tasks.

Command Purpose
ios_config "command" "sub-command"

Example: ios_config "interface Ethernet 0" "description this is a demo"
Run a Cisco IOS configuration command (sub-mode commands must be quoted on the same line as the main configuration command)

Example:

Configuring 50 VLAN.

1. tclsh
2. for {set I 1} {$I < 51} {incr I} {
ios_config "vlan $I" "exit"
}
3. exit
4. show vlan

Yipee , its done .

No comments:

Post a Comment