From: Steinar H. Gunderson Date: Thu, 6 Apr 2006 13:00:17 +0000 (+0000) Subject: Replaced the Z constant by a more hardcoded switch limit. X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=e15fb5fba248ef3f0baff2950a1e7781bbbdc6bd;p=nms Replaced the Z constant by a more hardcoded switch limit. --- diff --git a/zyxel/konfgen.py b/zyxel/konfgen.py index ba12fdd..ea5a9e2 100755 --- a/zyxel/konfgen.py +++ b/zyxel/konfgen.py @@ -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