You need to build a function/procedure (with commands) to achieve this:
- To write to screen/a channel, use: puts
- To read input or a single line from screen/a channel, use: gets
- To retrieve a value from a variable, use: $
- To run a Cisco IOS configuration command, use: ios_config
The following simple procedure/script asks you to enter a VLAN ID and its name, then it will configure that VLAN on your device:
//Configure your TCL procedure:
#tclsh
(tcl)#proc Vlanconfig {} {
+>puts "Enter VLAN ID: " ;
+>gets stdin VLANid
+>puts "Enter VLAN Name:" ;
+>gets stdin VLANname
+>ios_config "vlan $VLANid" "name $VLANname" "end"
+>}
(tcl)#
//Run your procedure:
(tcl)#Vlanconfig
Enter VLAN ID:
200
Enter VLAN Name:
Users
(tcl)#tclquit
#show vlan
VLAN Name Status
...
200 Users active
...
You can expand this procedure to configure L3 Int VLAN and its IP address as you what.
I hope it is helpful and you have an idea of how to build your own TCL procedure.