summaryrefslogtreecommitdiff
path: root/haircontrol/discovery.py
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2016-06-09 21:52:13 +0200
committerLudovic Pouzenc <ludovic@pouzenc.fr>2016-06-09 21:52:13 +0200
commitc705d2afe8be8abfa385eeb434c4271209f731a9 (patch)
treefdcf4a6ba60c27d6aa2a2b6307440393f610cc83 /haircontrol/discovery.py
parent24df4c63bbe9ea6c8d13aba014fcce22f56dc8ac (diff)
downloadhaircontrol-c705d2afe8be8abfa385eeb434c4271209f731a9.zip
haircontrol-c705d2afe8be8abfa385eeb434c4271209f731a9.tar.gz
haircontrol-c705d2afe8be8abfa385eeb434c4271209f731a9.tar.bz2
Inspector : parse ip link and show version for switches.
Discovery : use switch mac for each ports.
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)