]> git.sesse.net Git - nms/commitdiff
Also print VLAN numbers after each switch in the map.
authorSteinar H. Gunderson <sesse@samfundet.no>
Sun, 9 Apr 2006 16:38:29 +0000 (16:38 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Sun, 9 Apr 2006 16:38:29 +0000 (16:38 +0000)
zyxel/switchmap.py

index 8526162ece3670261317c7608d7e9188d6f03191..418fd142d695871f4fdb7c45a8543bbed46b2874 100755 (executable)
@@ -1,10 +1,11 @@
 #! /usr/bin/env python
 
 from zyxelcommon import *
 #! /usr/bin/env python
 
 from zyxelcommon import *
+distro_num_switches = [ 0, 0, 0, 0, 0 ];
 
 print "    ",
 for sw in range(1,7):
 
 print "    ",
 for sw in range(1,7):
-       print "%7u          " % sw,
+       print "%9u            " % sw,
        if sw == 3:
                print "   ",
 print ""
        if sw == 3:
                print "   ",
 print ""
@@ -13,12 +14,18 @@ for row in range(1,75,2):
        print "\e[37;0m%2u: " % row,
        for sw in range(1,7):
                if (row <= 3 and sw <= 3) or (row >= 69 and (sw == 1 or sw == 6)):
        print "\e[37;0m%2u: " % row,
        for sw in range(1,7):
                if (row <= 3 and sw <= 3) or (row >= 69 and (sw == 1 or sw == 6)):
-                       print "%-16s " % "",
+                       print "%-20s " % "",
                else:
                        ip = retIP((row,sw))
                else:
                        ip = retIP((row,sw))
-                       padding1 = "".join(["="] * ((17-len(ip))/2))
-                       padding2 = "".join(["="] * ((18-len(ip))/2))
-                       print "".join(("\e[30;1m", padding1, retColor((row,sw)), ip, "\e[30;1m", padding2)),
+                       distro = int(retSubnet((row,sw))) - 241
+                       vlan = (distro * 100) + (distro_num_switches[distro] / 5) + 301
+                       distro_num_switches[distro] = distro_num_switches[distro] + 1
+
+                       text = "%s/%u" % (ip, vlan)
+                       
+                       padding1 = "".join(["="] * ((21-len(text))/2))
+                       padding2 = "".join(["="] * ((22-len(text))/2))
+                       print "".join(("\e[30;1m", padding1, retColor((row,sw)), text, "\e[30;1m", padding2)),
                        
                if sw == 3:
                        print "   ",
                        
                if sw == 3:
                        print "   ",