From c705d2afe8be8abfa385eeb434c4271209f731a9 Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Thu, 9 Jun 2016 21:52:13 +0200 Subject: Inspector : parse ip link and show version for switches. Discovery : use switch mac for each ports. --- haircontrol/discovery.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'haircontrol/discovery.py') 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) -- cgit v1.1