From f362446a524efb4bd412cbb608d8704efd47d720 Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Sat, 14 May 2016 00:24:05 +0200 Subject: WIP : First try at getting some data from lldp and ip neigh. --- haircontrol/data.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 haircontrol/data.py (limited to 'haircontrol/data.py') diff --git a/haircontrol/data.py b/haircontrol/data.py new file mode 100644 index 0000000..599d322 --- /dev/null +++ b/haircontrol/data.py @@ -0,0 +1,27 @@ +class Equipment: + def __init__(self, name=None, mgmtip=None): + self.name = name + self.mgmtip = mgmtip + self.ifaces = {} + + def __repr__(self): + return repr( (self.name, self.mgmtip, self.ifaces.values()) ) + + def add_seen_mac(self, ifname, mac): + iface = self.ifaces.get(ifname) + if not iface: + iface = Interface() + iface.name = ifname + self.ifaces[ifname] = iface + iface.mac_seen.append(mac) + +class Interface: + def __init__(self, name=None, mac=None): + self.name = name + self.mac = mac + self.mac_seen = [] + self.remote = [] + + def __repr__(self): + return repr( (self.mac, self.name) ) + -- cgit v1.1