From 793486ff65fcdd7ab6b17dc3d5ee36778740126c Mon Sep 17 00:00:00 2001 From: kantorkel Date: Tue, 1 Dec 2015 19:29:57 +0100 Subject: [PATCH] funktionierendes setup --- alfred_merge.py | 4 +-- gateway.json | 86 +++++++++++++++++++++++++++++++++++++++++++++++++ lib/alfred.py | 2 +- mkmap.sh | 6 ++-- 4 files changed, 92 insertions(+), 6 deletions(-) create mode 100644 gateway.json diff --git a/alfred_merge.py b/alfred_merge.py index aa623b2..ee1143f 100755 --- a/alfred_merge.py +++ b/alfred_merge.py @@ -27,9 +27,9 @@ class alfred_merge: self.request_data_type_2 = request_data_type_2 def aliases(self): - output = subprocess.check_output(["/usr/local/sbin/alfred-json","-z", "-r",str(self.request_data_type_1),"-f","json"]) + output = subprocess.check_output(["/usr/local/bin/alfred-json","-z", "-r",str(self.request_data_type_1),"-f","json"]) alfred_data_1 = json.loads(output.decode("utf-8")) - output = subprocess.check_output(["/usr/local/sbin/alfred-json","-z", "-r",str(self.request_data_type_2),"-f","json"]) + output = subprocess.check_output(["/usr/local/bin/alfred-json","-z", "-r",str(self.request_data_type_2),"-f","json"]) alfred_data_2 = json.loads(output.decode("utf-8")) return json.dumps(rec_merge(alfred_data_1, alfred_data_2)) diff --git a/gateway.json b/gateway.json new file mode 100644 index 0000000..c7b0966 --- /dev/null +++ b/gateway.json @@ -0,0 +1,86 @@ +[ + { + "node_id": "deadbeef0101", + "hostname": "gw01", + "network": { + "mesh": { + "bat0": { + "interfaces": { + "tunnel": [ + "de:ad:be:ff:01:01", + "de:ad:bf:ff:01:01" + ] + } + } + } + } + }, + { + "node_id": "deadbeef0505", + "hostname": "gw02", + "network": { + "mesh": { + "bat0": { + "interfaces": { + "tunnel": [ + "de:ad:be:ff:05:05", + "de:ad:be:ff:05:06", + "de:ad:bf:ff:05:05" + ] + } + } + } + } + }, + { + "node_id": "deadbeef0303", + "hostname": "gw03", + "network": { + "mesh": { + "bat0": { + "interfaces": { + "tunnel": [ + "de:ad:be:ff:03:03", + "de:ad:bf:ff:03:03" + ] + } + } + } + } + }, + { + "node_id": "deadbfff2222", + "hostname": "gw05", + "network": { + "mesh": { + "bat0": { + "interfaces": { + "tunnel": [ + "de:ad:be:ff:22:22", + "de:ad:be:ff:22:23", + "de:ad:bf:ff:22:22" + ] + } + } + } + } + }, + { + "node_id": "deadbeef8888", + "hostname": "gw08", + "network": { + "mesh": { + "bat0": { + "interfaces": { + "tunnel": [ + "de:ad:be:ff:88:88", + "de:ad:be:ff:88:89", + "de:ad:bf:ff:88:88" + ] + } + } + } + } + } +] + diff --git a/lib/alfred.py b/lib/alfred.py index 4353874..531eaea 100644 --- a/lib/alfred.py +++ b/lib/alfred.py @@ -13,7 +13,7 @@ class Alfred(object): raise RuntimeError('alfred: invalid unix socket path given') def _fetch(self, data_type): - cmd = ['alfred-json', + cmd = ['/usr/local/bin/alfred-json', '-z', '-f', 'json', '-r', str(data_type)] diff --git a/mkmap.sh b/mkmap.sh index cf85166..b49f9a5 100755 --- a/mkmap.sh +++ b/mkmap.sh @@ -1,6 +1,6 @@ #!/bin/bash -PATH='/opt/ffmap-backend/' +FFMAPPATH='/opt/ffmap-backend/' PEERS="/etc/fastd/ffhh-mesh-vpn/peers" -python2 $PATH/generate_aliases.py $PEERS > $PATH/aliases.json -python3 $PATH/backend.py -d /var/www/meshviewer/data/ -a $PATH/aliases.json --vpn de:ad:be:ff:01:01 +python2 $FFMAPPATH/generate_aliases.py $PEERS > $FFMAPPATH/aliases.json +python3 $FFMAPPATH/backend.py -d /var/www/meshviewer/ --aliases $FFMAPPATH/aliases.json $FFMAPPATH/gateway.json -m bat0:/var/run/alfred.sock -p 30 --vpn de:ad:be:ff:01:01 --vpn de:ad:be:ff:05:05 --vpn de:ad:be:ff:05:06 --vpn de:ad:be:ff:03:03 --vpn de:ad:be:ff:22:22 --vpn de:ad:be:ff:22:23 --vpn de:ad:be:ff:88:88 --vpn de:ad:be:ff:88:89 --vpn de:ad:bf:ff:88:88 --vpn de:ad:bf:ff:22:22 --vpn de:ad:bf:ff:03:03 --vpn de:ad:bf:ff:05:05 --vpn de:ad:bf:ff:01:01