aboutsummaryrefslogtreecommitdiff
path: root/util.py
diff options
context:
space:
mode:
authorSteve McIntyre <steve.mcintyre@linaro.org>2014-12-17 16:29:28 +0000
committerSteve McIntyre <steve.mcintyre@linaro.org>2014-12-17 16:29:28 +0000
commitc68a18ef1549e982b0ad0dfac2cd9cad4ddff7dc (patch)
tree70af42cbddac8a7bdf167264240c9ea6eaf04aa1 /util.py
parent5076715a68eec83f23dd7f68b0317954206e1968 (diff)
Move debug code from vland to a helper function here
Change-Id: I16b16cd5bc9be7c3ec42d56ebf95975d2fa504ce
Diffstat (limited to 'util.py')
-rw-r--r--util.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/util.py b/util.py
index 05f12c2..8c47318 100644
--- a/util.py
+++ b/util.py
@@ -15,6 +15,34 @@ class VlanUtil:
class_ = getattr(module, driver)
return class_(switch)
+ def get_all_switches(self, config):
+ for switch in sorted(config.switches):
+ print "Found switch %s:" % (switch)
+ print " Probing:"
+
+ s = util.get_switch_driver(switch, config)
+ s.switch_connect(config.switches[switch].username, config.switches[switch].password)
+ print " Found details of switch:"
+ s._dump_list(s._systemdata)
+ print " Switch has %d ports:" % len(s.switch_get_port_names())
+ for port in s.switch_get_port_names():
+ print " %s" % port
+ if 0 == 1:
+ mode = s.port_get_mode(port)
+ if mode == "trunk":
+ print " port %s is in trunk mode, VLAN(s):" % port
+ vlans = s.port_get_trunk_vlan_list(port)
+ for vlan in vlans:
+ name = s.vlan_get_name(vlan)
+ print " %d (%s)" % (vlan, name)
+ else:
+ vlan = s.port_get_access_vlan(port)
+ name = s.vlan_get_name(vlan)
+ print " port %s is in access mode, VLAN %d (%s):" % (port, vlan, name)
+
+ s.switch_disconnect()
+ del(s)
+
# Simple helper wrapper for all the read-only database queries
def perform_db_query(self, state, command, data):
print 'perform_db_query'