summaryrefslogtreecommitdiff
path: root/haircontrol/discovery.py
diff options
context:
space:
mode:
Diffstat (limited to 'haircontrol/discovery.py')
-rw-r--r--haircontrol/discovery.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/haircontrol/discovery.py b/haircontrol/discovery.py
index a9639be..3180ace 100644
--- a/haircontrol/discovery.py
+++ b/haircontrol/discovery.py
@@ -167,13 +167,25 @@ class Discovery:
# Inspect switches
elif isinstance(i, ToughSwitchInspector):
- result = i.command('mactable_data.cgi')
- for (ifname, mac) in result:
- e.add_seen_mac(ifname, mac)
+ result = i.command('ip-link')
+ switch_mac = '?'
+ for (ifname, mac) in result:
+ if ifname == 'br0': # XXX configurable filter
+ switch_mac = mac
+ result = i.command('mactable_data.cgi')
+ for (ifname, mac) in result:
+ e.add_iface(ifname, switch_mac) # XXX many non-usefull calls
+ e.add_seen_mac(ifname, mac)
elif isinstance(i, EdgeMaxInspector):
+ switch_mac = '?'
+ result = i.command('show-version')
+ for (key, value) in result:
+ if key == 'Burned In MAC Address':
+ switch_mac = value
result = i.command('mac-addr-table')
for (mac, ifname) in result:
+ e.add_iface(ifname, switch_mac) # XXX many non-usefull calls
e.add_seen_mac(ifname, mac)
else:
print("Notice: Nothing inspected on %s"%e)