X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=zyxel%2Fswitchmap.py;h=479d08289a849f74c0450cfaed5acdc6ec8265bf;hb=HEAD;hp=d0800ccb3156cd669c15a251b9a50e86fb3aebec;hpb=c5e95c6729eb350aef927119616985d01be1fe7f;p=nms diff --git a/zyxel/switchmap.py b/zyxel/switchmap.py index d0800cc..479d082 100755 --- a/zyxel/switchmap.py +++ b/zyxel/switchmap.py @@ -1,7 +1,10 @@ #! /usr/bin/env python from zyxelcommon import * -distro_num_switches = [ 0, 0, 0, 0, 0 ]; +distro_num_switches = [ 0, 0, 0, 0, 0, 0, 0, 0 ] +# distro_vlan_start = [ 301, 405, 509, 617, 727, 835, 938, 1041 ] +distro_vlan_start = [ 301, 401, 501, 601, 701, 801, 901, 1001 ] +switches_per_cnet = 1 vlans = {} @@ -12,15 +15,16 @@ for sw in range(1,7): print " ", print "" -for row in range(1,75,2): +for row in range(1,73,2): print "%2u: " % row, for sw in range(1,7): - if (row <= 3 and sw <= 3) or (row >= 69 and (sw == 1 or sw == 6)): + if (row <= 3 and sw <= 3) or (row >= 67 and (sw == 1 or sw == 6)) or (row >= 71 and (sw <= 3)): print "%-20s " % "", else: ip = retIP((row,sw)) distro = int(retSubnet((row,sw))) - 241 - vlan = (distro * 100) + (distro_num_switches[distro] / 5) + 301 +# vlan = (distro_num_switches[distro] / switches_per_cnet) + distro_vlan_start[distro] + vlan = row * 10 + sw distro_num_switches[distro] = distro_num_switches[distro] + 1 text = "%s/%u" % (ip, vlan) @@ -38,7 +42,7 @@ for row in range(1,75,2): if sw == 3: print " ", print "" - if row in (17, 33, 49, 67): + if row in (17, 33, 49, 65): print "" # evil side-effect =) @@ -48,5 +52,16 @@ vlan_list.sort() i = 1; for vlan in vlan_list: - switches.write("194.0.%u.0 24 split:%s\n" % (i, ",".join(vlans[vlan]))) + row = vlan / 10 + num = vlan % 10 + + cnet_major = row + if (num > 3): + cnet_major = cnet_major + 1 + cnet_minor = (num-4) * 64 + else: + cnet_minor = (num-1) * 64 + +# switches.write("194.0.%u.0 24 split:%s\n" % (i, ",".join(vlans[vlan]))) + switches.write("194.0.%u.%u 26 e%u-sw%u\n" % (cnet_major, cnet_minor, row, num)) i = i + 1