aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroot <root@freifunk.in-kiel.de>2014-06-05 14:03:20 +0200
committerroot <root@freifunk.in-kiel.de>2014-06-05 14:03:20 +0200
commit8b3bde6b7a5339da2ee4473fe2fa3b7d3159bb17 (patch)
treeb3405d595babcb4cb1b3f935b6269859e9df868f
parentd12befa56f1830ba9e18952021e4255237d612fb (diff)
parentf18d0b38a915cc79a6efe147cf498329d9882461 (diff)
Merge remote-tracking branch 'ffnord/master'
Conflicts: .gitignore
-rw-r--r--alfred.py7
-rwxr-xr-xbat2nodes.py2
-rwxr-xr-xbatman.py2
-rw-r--r--nodedb.py19
4 files changed, 22 insertions, 8 deletions
diff --git a/alfred.py b/alfred.py
index c92bc12..6d926bb 100644
--- a/alfred.py
+++ b/alfred.py
@@ -23,6 +23,11 @@ class alfred:
except KeyError:
pass
+ try:
+ node_alias['id'] = node['network']['mac']
+ except KeyError:
+ pass
+
if 'hostname' in node:
node_alias['name'] = node['hostname']
elif 'name' in node:
@@ -33,5 +38,5 @@ class alfred:
if __name__ == "__main__":
ad = alfred()
- al = ad.alias()
+ al = ad.aliases()
print(al)
diff --git a/bat2nodes.py b/bat2nodes.py
index eee2289..7119464 100755
--- a/bat2nodes.py
+++ b/bat2nodes.py
@@ -49,7 +49,7 @@ if options['mesh']:
bm = batman(mesh_interface)
db.parse_vis_data(bm.vis_data(options['alfred']))
for gw in bm.gateway_list():
- db.mark_gateways(gw.mac)
+ db.mark_gateways(gw['mac'])
else:
bm = batman()
db.parse_vis_data(bm.vis_data(options['alfred']))
diff --git a/batman.py b/batman.py
index faff552..05a4380 100755
--- a/batman.py
+++ b/batman.py
@@ -60,6 +60,8 @@ class batman:
gw.append({'mac': own_mac, 'bandwidth': gw_mode['bandwidth']})
for line in lines:
gw_line = line.split()
+ if (gw_line[0] == 'No'):
+ continue
# When in client gateway mode maybe gw_line[0] is not the right.
gw.append({'mac':gw_line[0], 'bandwidth': gw_line[-1]})
return gw
diff --git a/nodedb.py b/nodedb.py
index f1110aa..fa9caed 100644
--- a/nodedb.py
+++ b/nodedb.py
@@ -169,17 +169,20 @@ class NodeDB:
def import_aliases(self, aliases):
for mac, alias in aliases.items():
try:
- node = self.maybe_node_by_fuzzy_mac(mac)
+ node = self.maybe_node_by_mac([mac])
except:
- # create an offline node
- node = Node()
- node.add_mac(mac)
- self._nodes.append(node)
+ try:
+ node = self.maybe_node_by_fuzzy_mac(mac)
+ except:
+ # create an offline node
+ node = Node()
+ node.add_mac(mac)
+ self._nodes.append(node)
if 'name' in alias:
node.name = alias['name']
- if 'vpn' in alias and alias['vpn']:
+ if 'vpn' in alias and alias['vpn'] and mac and node.interfaces and mac in node.interfaces:
node.interfaces[mac].vpn = True
if 'gps' in alias:
@@ -188,6 +191,9 @@ class NodeDB:
if 'firmware' in alias:
node.firmware = alias['firmware']
+ if 'id' in alias:
+ node.id = alias['id']
+
# list of macs
# if options['gateway']:
# mark_gateways(options['gateway'])
@@ -196,6 +202,7 @@ class NodeDB:
try:
node = self.maybe_node_by_mac((gateway, ))
except:
+ print("WARNING: did not find gateway '",gateway,"' in node list")
continue
node.flags['gateway'] = True