move Link and Node to seperate files

This commit is contained in:
root 2012-05-11 14:12:41 +02:00
parent 967eba4c13
commit d23736d0f5
3 changed files with 28 additions and 24 deletions

View file

@ -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
View file

@ -0,0 +1,6 @@
class Link():
def __init__(self):
self.pair = None
self.distance = None
self.strength = None

19
node.py Normal file
View 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__()