legacy
Nils Schneider 2014-08-17 19:10:19 +02:00
parent 2dfd11189d
commit 0d71de7091
4 changed files with 2 additions and 24 deletions

View File

@ -30,7 +30,7 @@ class NodeRRD(RRD):
return os.path.basename(self.filename).rsplit('.', 2)[0] + ".png"
def update(self):
super().update({'upstate': 1, 'clients': self.node.clients})
super().update({'upstate': 1, 'clients': self.node.clientcount})
def graph(self, directory, timeframe):
"""

View File

@ -31,8 +31,6 @@ class batman:
output = subprocess.check_output(["batctl","-m",self.mesh_interface,"vd","json","-n"])
lines = output.splitlines()
vds = self.vis_data_helper(lines)
for vd in vds:
vd['legacy'] = True
return vds
def vis_data_batadv_vis(self):

View File

@ -91,8 +91,6 @@ class NodeDB:
node = Node()
node.lastseen = self.time
node.flags['online'] = True
if 'legacy' in x:
node.flags['legacy'] = True
self._nodes.append(node)
node.add_mac(x['of'])
@ -110,8 +108,6 @@ class NodeDB:
node = Node()
node.lastseen = self.time
node.flags['online'] = True
if 'legacy' in x:
node.flags['legacy'] = True
node.add_mac(x['router'])
self._nodes.append(node)

18
rrd.py
View File

@ -28,23 +28,7 @@ class rrd:
def update_database(self,db):
nodes = {}
clientCount = 0
for node in db.get_nodes():
if node.flags['online']:
if not node.flags['client']:
nodes[node.id] = node
node.clients = 0;
if 'legacy' in node.flags and node.flags['legacy']:
clientCount -= 1
else:
clientCount += 1
for link in db.get_links():
source = link.source.interface
target = link.target.interface
if source in nodes and not target in nodes:
nodes[source].clients += 1
elif target in nodes and not source in nodes:
nodes[target].clients += 1
clientCount = sum(map(lambda d: d.clientcount, db.get_nodes()))
self.globalDb.update(len(nodes), clientCount)
for node in nodes.values():