]> git.sesse.net Git - nms/commitdiff
Replaced the Z constant by a more hardcoded switch limit.
authorSteinar H. Gunderson <sesse@samfundet.no>
Thu, 6 Apr 2006 13:00:17 +0000 (13:00 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Thu, 6 Apr 2006 13:00:17 +0000 (13:00 +0000)
zyxel/konfgen.py

index ba12fddec9321df6d4a646c9fa10c1f297d9a57c..ea5a9e20d222be966dc55e8999a2d6095f78dd5d 100755 (executable)
@@ -32,10 +32,6 @@ LOGHOST="194.0.255.20"
 MODE="minicom"
 
 
-# z = antall svitsjer pr. distro
-# DEN FANTASTISKE Z-KONSTANTEN
-Z = 42
-
 import sys
 import os
 import time
@@ -90,12 +86,18 @@ def send(text):
     else: 
         sys.stdout.write(text + "\n")
 
+# No Z-constant for you!
 def retSubnet(sw):
     (rad,num) = sw
-    b = (((rad * 3)-4) / Z) + 1
-    if b == 6:
-        b=5
-    return "24%s" % b
+    if rad <= 7 or (rad == 8 and (sw <= 3 or sw == 6)):
+        return "241"
+    if rad <= 13 or (rad == 14 and sw != 4) or (rad == 15 and sw <= 3):
+        return "242"
+    if rad <= 22 or (rad == 23 and sw >= 4) or (rad == 24 and sw == 4):
+        return "243"
+    if rad <= 29 or (rad == 30 and (sw == 4 or sw == 5)):
+        return "244"
+    return "245"
 
 def retIP(sw):
     (rad,num) = sw