diff --git a/bat2nodes.py b/bat2nodes.py index 736336f..8fd5cb6 100644 --- a/bat2nodes.py +++ b/bat2nodes.py @@ -8,6 +8,9 @@ import json import fileinput import argparse +from node import Node +from link import Link + parser = argparse.ArgumentParser() parser.add_argument('-a', '--aliases', @@ -27,30 +30,6 @@ aliases = dict() links = set() nodes = [] -class Node(): - def __init__(self): - self.name = "" - self.macs = set() - self.group = 0 - self.online = False - # groups: - # 0 normal node - # 1 aftermath - # 2 gateways - # 3 TT - - def add_mac(self, mac): - self.macs.add(mac) - - def __repr__(self): - return self.macs.__repr__() - -class Link(): - def __init__(self): - self.pair = None - self.distance = None - self.strength = None - def maybe_node_by_mac(nodes, macs): for node in nodes: for mac in macs: diff --git a/link.py b/link.py new file mode 100644 index 0000000..c69b141 --- /dev/null +++ b/link.py @@ -0,0 +1,6 @@ +class Link(): + def __init__(self): + self.pair = None + self.distance = None + self.strength = None + diff --git a/node.py b/node.py new file mode 100644 index 0000000..a77b060 --- /dev/null +++ b/node.py @@ -0,0 +1,19 @@ +class Node(): + def __init__(self): + self.name = "" + self.macs = set() + self.group = 0 + self.online = False + # groups: + # 0 normal node + # 1 aftermath + # 2 gateways + # 3 TT + + def add_mac(self, mac): + self.macs.add(mac) + + def __repr__(self): + return self.macs.__repr__() + +