aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroot <root@freifunk.in-kiel.de>2014-02-04 04:16:03 +0100
committerroot <root@freifunk.in-kiel.de>2014-02-04 04:16:03 +0100
commit852614e7758f276f374cb6bc71ca05b3d89c269b (patch)
treebe04657de5f909f7ba62230467590aa23eeca707
parente0fa153331b138156b12624ce2fdd5fc66050098 (diff)
parent914836eb9a777d0dbde7bf015b5715dad5fefb15 (diff)
Merge remote-tracking branch 'tcatm/master'
-rw-r--r--alfred.py6
-rw-r--r--d3mapbuilder.py1
-rw-r--r--node.py1
-rw-r--r--nodedb.py14
4 files changed, 20 insertions, 2 deletions
diff --git a/alfred.py b/alfred.py
index c0f9d13..086ebc7 100644
--- a/alfred.py
+++ b/alfred.py
@@ -14,6 +14,12 @@ class alfred:
node_alias = {}
if 'location' in node:
node_alias['gps'] = str(node['location']['latitude']) + ' ' + str(node['location']['longitude'])
+
+ try:
+ node_alias['firmware'] = node['software']['firmware']['release']
+ except KeyError:
+ pass
+
if 'hostname' in node:
node_alias['name'] = node['hostname']
elif 'name' in node:
diff --git a/d3mapbuilder.py b/d3mapbuilder.py
index 0d824be..3daf1ee 100644
--- a/d3mapbuilder.py
+++ b/d3mapbuilder.py
@@ -15,6 +15,7 @@ class D3MapBuilder:
output['nodes'] = [{'name': x.name, 'id': x.id,
'macs': ', '.join(x.macs),
'geo': [float(x) for x in x.gps.split(" ")] if x.gps else None,
+ 'firmware': x.firmware,
'flags': x.flags
} for x in nodes]
diff --git a/node.py b/node.py
index bcd5cdd..ba0c3b0 100644
--- a/node.py
+++ b/node.py
@@ -10,6 +10,7 @@ class Node():
"client": False
})
self.gps = None
+ self.firmware = None
def add_mac(self, mac):
mac = mac.lower()
diff --git a/nodedb.py b/nodedb.py
index 9dd9849..b6c2a76 100644
--- a/nodedb.py
+++ b/nodedb.py
@@ -185,6 +185,9 @@ class NodeDB:
if 'gps' in alias:
node.gps = alias['gps']
+ if 'firmware' in alias:
+ node.firmware = alias['firmware']
+
# list of macs
# if options['gateway']:
# mark_gateways(options['gateway'])
@@ -229,14 +232,21 @@ class NodeDB:
for link in self._links:
ids = link.source.interface
idt = link.target.interface
+
try:
node_source = self.maybe_node_by_fuzzy_mac(ids)
node_target = self.maybe_node_by_id(idt)
+
+ if not node_source.flags['client'] and not node_target.flags['client']:
+ # if none of the nodes associated with this link are clients,
+ # we do not want to obscure
+ continue
+
if ids in clientIds and idt in clientIds:
# This is for corner cases, when a client
# is linked to another client.
clientIds[ids] = str(globalIdCounter)
- id1 = str(globalIdCounter)
+ ids = str(globalIdCounter)
globalIdCounter += 1
clientIds[idt] = str(globalIdCounter)
@@ -261,7 +271,7 @@ class NodeDB:
link.id = ids + "-" + idt
- except:
+ except KeyError:
pass
# extends node id by incremented node counter