move Link and Node to seperate files
This commit is contained in:
parent
967eba4c13
commit
d23736d0f5
27
bat2nodes.py
27
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:
|
||||
|
|
6
link.py
Normal file
6
link.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
class Link():
|
||||
def __init__(self):
|
||||
self.pair = None
|
||||
self.distance = None
|
||||
self.strength = None
|
||||
|
19
node.py
Normal file
19
node.py
Normal file
|
@ -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__()
|
||||
|
||||
|
Loading…
Reference in a new issue