From 9ec7840e92653d45c51ec3774405b6e7cc63bc46 Mon Sep 17 00:00:00 2001 From: neingeist Date: Wed, 4 Nov 2015 22:52:32 +0100 Subject: [PATCH] add script to generate bat-hosts --- bat-hosts-gen | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 bat-hosts-gen diff --git a/bat-hosts-gen b/bat-hosts-gen new file mode 100755 index 0000000..305e099 --- /dev/null +++ b/bat-hosts-gen @@ -0,0 +1,13 @@ +#!/usr/bin/python +from __future__ import division, print_function +import requests + + +r = requests.get('http://mapsrv0.ffka.net/json/ffka/nodes.json') +j = r.json() + +for nodeid in j['nodes'].keys(): + nodeinfo = j['nodes'][nodeid]['nodeinfo'] + hostname = nodeinfo['hostname'] + for i, mac in enumerate(nodeinfo['network']['mesh_interfaces']): + print('{} {}_int{}'.format(mac, hostname, i))