I am looking to implement Automation to VLAN config:

ios_config - does not suit my automation because I need to have the user input VLAN name and VLAN number as well int VLAN and IP address subnet mask of SVI. Any other TCL function I can use to complete this script? Like this:

Enter VLAN ID:
Enter VLAN name:
Enter VLAN IP address:
Enter VLAN Subnet mask:

ios_config: "no shut"


  • I do not really get your point. Automation still needs your input (by hand or by input file) to generate output. Can you give us an example?
    – Hung Tran
    Oct 30, 2017 at 19:23
  • Hi, say I am configuring to generate VLAN 10 - ios_config "vlan 10" "name test_10" "end". However, for implementation VLAN 10 is not constant VLAN it can be anything from 1-4094, I want to have a function that can perform input VLAN number and IP address, subnet mask for VLAN interface.
    – Implement
    Oct 30, 2017 at 19:27

1 Answer 1


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:

(tcl)#proc Vlanconfig {} { 
+>puts "Enter VLAN ID: " ; 
+>gets stdin VLANid 
+>puts "Enter VLAN Name:" ; 
+>gets stdin VLANname
+>ios_config "vlan $VLANid" "name $VLANname" "end"

//Run your procedure:

Enter VLAN ID: 
Enter VLAN Name:

#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.

  • Yeah this is noice! I scale from here thanks! Let me try this
    – Implement
    Oct 31, 2017 at 15:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.