def get_ap_status():
  status = {'IP': utils.get_wan_ip(), 'MAC': utils.get_wan_mac(), 'timestamp': dt.now().isoformat(), 'band2g':{}, 'band5g':{}}
  for iface, band in [('wlan0', 'band2g'), ('wlan1', 'band5g')]:
    if iface not in subprocess.check_output('iwinfo', shell=True):
      status[band]['enabled'] = False
    else:
      status[band]['enabled'] = True
      status[band].update(parse_iwinfo(subprocess.check_output('iwinfo %s info' % (iface), shell=True)))
  return status
def get_station_dump():
  station_dump = {'MAC': utils.get_wan_mac(), 'timestamp': dt.now().isoformat()}
  for iface, band in [('wlan0', 'band2g'), ('wlan1', 'band5g')]:
    try:
      station_dump[band] = parse_iw_station_dump(subprocess.check_output('iw %s station dump' % (iface), shell=True))
      ip_table = parse_dhcp_leases()
      for s in station_dump[band]:
        if s['MAC'] in ip_table:
          s['IP'] = ip_table[s['MAC']]
    except:
      logger.exception("Failed to get station dump for %s", iface)
      station_dump[band] = []
  return station_dump