From 04f3bdf7be77f21210584e19fbbdef44ee35d248 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 9 Apr 2006 19:19:56 +0000 Subject: [PATCH] Make switchmap.py generate switches.txt for the table switches. --- zyxel/switchmap.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/zyxel/switchmap.py b/zyxel/switchmap.py index 418fd14..99d07e7 100755 --- a/zyxel/switchmap.py +++ b/zyxel/switchmap.py @@ -3,6 +3,8 @@ from zyxelcommon import * distro_num_switches = [ 0, 0, 0, 0, 0 ]; +vlans = {} + print " ", for sw in range(1,7): print "%9u " % sw, @@ -22,6 +24,12 @@ for row in range(1,75,2): distro_num_switches[distro] = distro_num_switches[distro] + 1 text = "%s/%u" % (ip, vlan) + swname = "e%u-sw%u" % (row, sw) + + try: + vlans[vlan].append(swname) + except KeyError: + vlans[vlan] = [swname] padding1 = "".join(["="] * ((21-len(text))/2)) padding2 = "".join(["="] * ((22-len(text))/2)) @@ -32,3 +40,13 @@ for row in range(1,75,2): print "" if row in (17, 33, 49, 67): print "" + +# evil side-effect =) +switches = open("switches-zyxel.txt","w") +vlan_list = vlans.keys() +vlan_list.sort() + +i = 2; +for vlan in vlan_list: + switches.write("194.0.%u.0 24 split:%s\n" % (i, ",".join(vlans[vlan]))) + i = i + 1 -- 2.39.2