batman: add batadv-vis socket support, needs at least alfred 2014.4.0
parent
90ab26d50b
commit
b143e3f2e5
|
@ -50,7 +50,7 @@ def main(params):
|
|||
|
||||
bm = list(map(lambda d:
|
||||
(d.vis_data(True), d.gateway_list()),
|
||||
map(Batman, params['mesh'])))
|
||||
map(Batman, params['mesh'], params['alfred_sock'])))
|
||||
for vis_data, gateway_list in bm:
|
||||
nodes.import_mesh_ifs_vis_data(nodedb['nodes'], vis_data)
|
||||
nodes.import_vis_clientcount(nodedb['nodes'], vis_data)
|
||||
|
|
|
@ -8,8 +8,9 @@ class Batman(object):
|
|||
Bindings for B.A.T.M.A.N. Advanced
|
||||
commandline interface "batctl"
|
||||
"""
|
||||
def __init__(self, mesh_interface='bat0'):
|
||||
def __init__(self, mesh_interface='bat0', alfred_sockpath=None):
|
||||
self.mesh_interface = mesh_interface
|
||||
self.alfred_sock = alfred_sockpath
|
||||
|
||||
def vis_data(self, batadv_vis=False):
|
||||
vds = self.vis_data_batctl_legacy()
|
||||
|
@ -44,8 +45,10 @@ class Batman(object):
|
|||
Parse "batadv-vis -i <mesh_interface> -f json"
|
||||
into an array of dictionaries.
|
||||
"""
|
||||
output = subprocess.check_output(
|
||||
['batadv-vis', '-i', self.mesh_interface, '-f', 'json'])
|
||||
cmd = ['batadv-vis', '-i', self.mesh_interface, '-f', 'json']
|
||||
if self.alfred_sock:
|
||||
cmd.extend(['-u', self.alfred_sock])
|
||||
output = subprocess.check_output(cmd)
|
||||
lines = output.splitlines()
|
||||
return self.vis_data_helper(lines)
|
||||
|
||||
|
|
Loading…
Reference in New Issue