]> git.sesse.net Git - nms/blob - zyxel/zyxelcommon.py
Factored out some code into zyxelcommon.py.
[nms] / zyxel / zyxelcommon.py
1 NETWORK="194.0"
2 TRAPHOST="194.0.255.20"
3 LOGHOST="194.0.255.20"
4
5 # No Z-constant for you!
6 def retSubnet(sw):
7     (rad,num) = sw
8     if rad <= 7 or (rad == 8 and (sw <= 3 or sw == 6)):
9         return "241"
10     if rad <= 13 or (rad == 14 and sw != 4) or (rad == 15 and sw <= 3):
11         return "242"
12     if rad <= 22 or (rad == 23 and sw >= 4) or (rad == 24 and sw == 4):
13         return "243"
14     if rad <= 29 or (rad == 30 and (sw == 4 or sw == 5)):
15         return "244"
16     return "245"
17
18 def retIP(sw):
19     (rad,num) = sw
20     gangefaktor = rad - ((rad - 1) / 2)
21     lopenr = 2 + 6 * gangefaktor + num
22     return NETWORK + ".%s.%s" % (retSubnet(sw), lopenr)
23