summaryrefslogtreecommitdiff
path: root/haircontrol/inspectors.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/inspectors.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/inspectors.py')
-rw-r--r--haircontrol/inspectors.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/haircontrol/inspectors.py b/haircontrol/inspectors.py
index 04b05c1..c5c6940 100644
--- a/haircontrol/inspectors.py
+++ b/haircontrol/inspectors.py
@@ -180,6 +180,13 @@ class ToughSwitchInspector(Inspector):
'cmd':'/usr/www/mactable_data.cgi',
'func': parse_mactable_data_cgi
},
+ 'ip-link': {
+ 'cmd': 'ip -o link',
+ 'kind': 'text',
+ 're': re.compile("\d+:\s+(?P<ifname>[^:]*):.+\s+(?:link/ether\s+(?P<mac>[a-f0-9:]*)\s+brd|link/none)")
+ # 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default \ link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
+ # 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000\ link/ether 8c:89:a5:c7:be:88 brd ff:ff:ff:ff:ff:ff
+ },
}
class EdgeMaxInspector(Inspector):
@@ -192,6 +199,11 @@ class EdgeMaxInspector(Inspector):
# 1 00:15:6D:8E:22:46 0/15 15 Learned
# 1 00:27:22:0E:67:F9 0/17 17 Learned
},
+ 'show-version': {
+ 'cmd':'show version', #XXX needs "enable" mode
+ 're': re.compile("(?P<key>[^\.]+)\.+ (?P<value>.*)")
+ # Burned In MAC Address.......................... 44:D9:E7:51:BF:A7
+ },
}
#TODO Implement them