3 from zyxelcommon import *
4 distro_num_switches = [ 0, 0, 0, 0, 0, 0, 0, 0 ]
5 # distro_vlan_start = [ 301, 405, 509, 617, 727, 835, 938, 1041 ]
6 distro_vlan_start = [ 301, 401, 501, 601, 701, 801, 901, 1001 ]
18 for row in range(1,73,2):
19 print "
\e[37;0m%2u: " % row,
21 if (row <= 3 and sw <= 3) or (row >= 67 and (sw == 1 or sw == 6)) or (row >= 71 and (sw <= 3)):
25 distro = int(retSubnet((row,sw))) - 241
26 # vlan = (distro_num_switches[distro] / switches_per_cnet) + distro_vlan_start[distro]
28 distro_num_switches[distro] = distro_num_switches[distro] + 1
30 text = "%s/%u" % (ip, vlan)
31 swname = "e%u-sw%u" % (row, sw)
34 vlans[vlan].append(swname)
36 vlans[vlan] = [swname]
38 padding1 = "".join(["="] * ((21-len(text))/2))
39 padding2 = "".join(["="] * ((22-len(text))/2))
40 print "".join(("
\e[30;1m", padding1, retColor((row,sw)), text, "
\e[30;1m", padding2)),
45 if row in (17, 33, 49, 65):
49 switches = open("switches-zyxel.txt","w")
50 vlan_list = vlans.keys()
54 for vlan in vlan_list:
60 cnet_major = cnet_major + 1
61 cnet_minor = (num-4) * 64
63 cnet_minor = (num-1) * 64
65 # switches.write("194.0.%u.0 24 split:%s\n" % (i, ",".join(vlans[vlan])))
66 switches.write("194.0.%u.%u 26 e%u-sw%u\n" % (cnet_major, cnet_minor, row, num))