parent
98d4618156
commit
dd8f6b92af
|
@ -82,7 +82,7 @@ def main(params):
|
||||||
# acquire gwl and visdata for each batman instance
|
# acquire gwl and visdata for each batman instance
|
||||||
mesh_info = []
|
mesh_info = []
|
||||||
for batman in batman_instances:
|
for batman in batman_instances:
|
||||||
vd = batman.vis_data(True)
|
vd = batman.vis_data()
|
||||||
gwl = batman.gateway_list()
|
gwl = batman.gateway_list()
|
||||||
|
|
||||||
mesh_info.append((vd, gwl))
|
mesh_info.append((vd, gwl))
|
||||||
|
|
|
@ -15,11 +15,8 @@ class Batman(object):
|
||||||
# compile regular expressions only once on startup
|
# compile regular expressions only once on startup
|
||||||
self.mac_addr_pattern = re.compile(r'(([a-z0-9]{2}:){5}[a-z0-9]{2})')
|
self.mac_addr_pattern = re.compile(r'(([a-z0-9]{2}:){5}[a-z0-9]{2})')
|
||||||
|
|
||||||
def vis_data(self, batadv_vis=False):
|
def vis_data(self):
|
||||||
vds = self.vis_data_batctl_legacy()
|
return self.vis_data_batadv_vis()
|
||||||
if batadv_vis:
|
|
||||||
vds += self.vis_data_batadv_vis()
|
|
||||||
return vds
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def vis_data_helper(lines):
|
def vis_data_helper(lines):
|
||||||
|
@ -32,17 +29,6 @@ class Batman(object):
|
||||||
pass
|
pass
|
||||||
return vd_tmp
|
return vd_tmp
|
||||||
|
|
||||||
def vis_data_batctl_legacy(self):
|
|
||||||
"""
|
|
||||||
Parse "batctl -m <mesh_interface> vd json -n"
|
|
||||||
into an array of dictionaries.
|
|
||||||
"""
|
|
||||||
output = subprocess.check_output(
|
|
||||||
['batctl', '-m', self.mesh_interface, 'vd', 'json', '-n'])
|
|
||||||
lines = output.splitlines()
|
|
||||||
vds = self.vis_data_helper(lines)
|
|
||||||
return vds
|
|
||||||
|
|
||||||
def vis_data_batadv_vis(self):
|
def vis_data_batadv_vis(self):
|
||||||
"""
|
"""
|
||||||
Parse "batadv-vis -i <mesh_interface> -f json"
|
Parse "batadv-vis -i <mesh_interface> -f json"
|
||||||
|
|
Loading…
Reference in New Issue