stop relying on batmanadv gateway feature

respondd
Nils Schneider 2015-07-31 11:55:32 +02:00
parent 431d46e191
commit c2e21b4f5b
2 changed files with 4 additions and 16 deletions

View File

@ -93,20 +93,18 @@ def main(params):
for alfred in alfred_instances:
nodes.import_statistics(nodesdict, alfred.statistics())
# acquire gwl and visdata for each batman instance
# acquire visdata for each batman instance
mesh_info = []
for batman in batman_instances:
vd = batman.vis_data()
gwl = batman.gateway_list()
mesh_info.append((vd, gwl))
mesh_info.append(vd)
# update nodedb from batman-adv data
for vd, gwl in mesh_info:
for vd in mesh_info:
nodes.import_mesh_ifs_vis_data(nodesdict, vd)
nodes.import_vis_clientcount(nodesdict, vd)
nodes.mark_vis_data_online(nodesdict, vd, now)
nodes.mark_gateways(nodesdict, gwl)
# clear the nodedb from nodes that have not been online in $prune days
if params['prune']:
@ -114,7 +112,7 @@ def main(params):
# build nxnetworks graph from nodedb and visdata
batadv_graph = nx.DiGraph()
for vd, gwl in mesh_info:
for vd in mesh_info:
graph.import_vis_data(batadv_graph, nodesdict, vd)
# force mac addresses to be vpn-link only (like gateways for example)

View File

@ -61,7 +61,6 @@ def import_nodeinfo(nodes, nodeinfos, now, assume_online=False):
node = nodes.setdefault(nodeinfo['node_id'], {'flags': dict()})
node['nodeinfo'] = nodeinfo
node['flags']['online'] = False
node['flags']['gateway'] = False
if assume_online:
mark_online(node, now)
@ -86,7 +85,6 @@ def import_statistics(nodes, stats):
stats = filter(lambda d: d['node_id'] in nodes, stats)
for node, stats in map(lambda d: (nodes[d['node_id']], d), stats):
add(node, stats, 'clients', ['clients', 'total'])
add(node, stats, 'gateway', ['gateway'], lambda d: macs.get(d, d))
add(node, stats, 'uptime', ['uptime'])
add(node, stats, 'loadavg', ['loadavg'])
add(node, stats, 'memory_usage', ['memory'],
@ -152,14 +150,6 @@ def import_vis_clientcount(nodes, vis_data):
nodes[node_id]['statistics'].setdefault('clients', clientcount)
def mark_gateways(nodes, gateways):
macs = build_mac_table(nodes)
gateways = filter(lambda d: d in macs, gateways)
for node in map(lambda d: nodes[macs[d]], gateways):
node['flags']['gateway'] = True
def mark_vis_data_online(nodes, vis_data, now):
macs = build_mac_table(nodes)