BrandonSpendlove

Cisco configuration - populate vlans

Sep 16th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.15 KB | None | 0 0
  1. print "======== VLAN config populator =========="
  2.  
  3. def createVlans(amount, start):
  4.     count = 0
  5.     print "!start vlan config"
  6.     while amount > count:
  7.         print ("vlan {}\n name {}".format(start, ("py-vlan-" + str(start))))
  8.         start = start + 1
  9.         count = count + 1
  10.     print "!finished\n"
  11.  
  12. def createVlansIncrement(amount, start, increment):
  13.     count = 0
  14.     print "! start vlan config\n"
  15.     while amount > count:
  16.         print("vlan {}\n name {}".format(start, ("py-vlan-" + str(start))))
  17.         start = start + increment
  18.         count = count + 1
  19.     print "! finished\n"
  20.  
  21. print "[0]: Create vlans (increment by 1)"
  22. print "[1]: Create vlans (custom increment)"
  23. option = input("Please select an option (input number): ")
  24.  
  25. if option == 0:
  26.     op0_amount = input("Input amount of VLANS: ")
  27.     op0_start = input("Input starting VLAN number: ")
  28.     createVlans(op0_amount, op0_start)
  29. if option == 1:
  30.     op1_amount = input("Input amount of VLANS: ")
  31.     op1_start = input("Input starting VLAN number: ")
  32.     op1_increment = input("Input incremental number: ")
  33.     createVlansIncrement(op1_amount, op1_start, op1_increment)
Add Comment
Please, Sign In to add comment