mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-05 05:07:59 +00:00
asus_ap: Fix whitespace
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
'''
|
"""
|
||||||
NAME:
|
NAME:
|
||||||
asus_ap.py
|
asus_ap.py
|
||||||
|
|
||||||
@@ -19,9 +19,10 @@ NOTES:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
'''
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
if sys.version_info[0] != 3:
|
if sys.version_info[0] != 3:
|
||||||
print("This script requires Python3")
|
print("This script requires Python3")
|
||||||
exit()
|
exit()
|
||||||
@@ -36,28 +37,30 @@ from pexpect_serial import SerialSpawn
|
|||||||
class FileAdapter(object):
|
class FileAdapter(object):
|
||||||
def __init__(self, logger):
|
def __init__(self, logger):
|
||||||
self.logger = logger
|
self.logger = logger
|
||||||
|
|
||||||
def write(self, data):
|
def write(self, data):
|
||||||
# NOTE: data can be a partial line, multiple lines
|
# NOTE: data can be a partial line, multiple lines
|
||||||
data = data.strip() # ignore leading/trailing whitespace
|
data = data.strip() # ignore leading/trailing whitespace
|
||||||
if data: # non-blank
|
if data: # non-blank
|
||||||
self.logger.info(data)
|
self.logger.info(data)
|
||||||
|
|
||||||
def flush(self):
|
def flush(self):
|
||||||
pass # leave it to logging to flush properly
|
pass # leave it to logging to flush properly
|
||||||
|
|
||||||
|
|
||||||
class lf_ap():
|
class lf_ap:
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
_ap_test_mode = False,
|
_ap_test_mode=False,
|
||||||
_ap_2G_interface = "wl0",
|
_ap_2G_interface="wl0",
|
||||||
_ap_5G_interface = "wl1",
|
_ap_5G_interface="wl1",
|
||||||
_ap_6G_interface = "wl2",
|
_ap_6G_interface="wl2",
|
||||||
_ap_scheme = 'serial',
|
_ap_scheme='serial',
|
||||||
_ap_serial_port = '/dev/ttyUSB0',
|
_ap_serial_port='/dev/ttyUSB0',
|
||||||
_ap_ssh_port = "22",
|
_ap_ssh_port="22",
|
||||||
_ap_telnet_port = "23",
|
_ap_telnet_port="23",
|
||||||
_ap_serial_baud = '115200',
|
_ap_serial_baud='115200',
|
||||||
_ap_report_dir = "",
|
_ap_report_dir="",
|
||||||
_ap_log_file = ""):
|
_ap_log_file=""):
|
||||||
self.ap_test_mode = _ap_test_mode
|
self.ap_test_mode = _ap_test_mode
|
||||||
self.ap_2G_interface = _ap_2G_interface
|
self.ap_2G_interface = _ap_2G_interface
|
||||||
self.ap_5G_interface = _ap_5G_interface
|
self.ap_5G_interface = _ap_5G_interface
|
||||||
@@ -78,56 +81,56 @@ class lf_ap():
|
|||||||
ss = SerialSpawn(ser)
|
ss = SerialSpawn(ser)
|
||||||
ss.sendline(str(self.ap_cmd))
|
ss.sendline(str(self.ap_cmd))
|
||||||
ss.expect([pexpect.TIMEOUT], timeout=2) # do not detete line, waits for output
|
ss.expect([pexpect.TIMEOUT], timeout=2) # do not detete line, waits for output
|
||||||
ap_results = ss.before.decode('utf-8','ignore')
|
ap_results = ss.before.decode('utf-8', 'ignore')
|
||||||
print("ap_results {}".format(ap_results))
|
print("ap_results {}".format(ap_results))
|
||||||
except:
|
except:
|
||||||
ap_results = "exception on accessing {} Command: {}\r\n".format(self.ap_port,self.ap_cmd)
|
ap_results = "exception on accessing {} Command: {}\r\n".format(self.ap_port, self.ap_cmd)
|
||||||
print("{}".format(ap_results))
|
print("{}".format(ap_results))
|
||||||
|
|
||||||
if(self.ap_file != None):
|
if self.ap_file is not None:
|
||||||
ap_file = open(str(self.ap_file),"a")
|
ap_file = open(str(self.ap_file), "a")
|
||||||
ap_file.write(ap_results)
|
ap_file.write(ap_results)
|
||||||
ap_file.close()
|
ap_file.close()
|
||||||
print("ap file written {}".format(str(self.ap_file)))
|
print("ap file written {}".format(str(self.ap_file)))
|
||||||
|
|
||||||
# ASUS
|
# ASUS
|
||||||
def ap_clear_stats(self,band):
|
def ap_clear_stats(self, band):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# ASUS bs_data
|
# ASUS bs_data
|
||||||
def ap_ul_data(self,band):
|
def ap_ul_data(self, band):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# ASUS rx_report
|
# ASUS rx_report
|
||||||
def ap_dl_data(self,band):
|
def ap_dl_data(self, band):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# ASUS chanel info (channel utilization)
|
# ASUS chanel info (channel utilization)
|
||||||
def ap_chanim(self,band):
|
def ap_chanim(self, band):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def ap_ul_stats(self,band):
|
def ap_ul_stats(self, band):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def ap_dl_stats(self,band):
|
def ap_dl_stats(self, band):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def ap_store_dl_scheduler_stats(self,band):
|
@staticmethod
|
||||||
|
def ap_store_dl_scheduler_stats(band):
|
||||||
if band is "6G":
|
if band is "6G":
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def ap_store_ul_scheduler_stats(self,band):
|
def ap_store_ul_scheduler_stats(self, band):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def ap_ofdma_stats(self, band):
|
||||||
def ap_ofdma_stats(self,band):
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
prog='lf_ap.py',
|
prog='lf_ap.py',
|
||||||
#formatter_class=argparse.RawDescriptionHelpFormatter,
|
# formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||||
formatter_class=argparse.RawTextHelpFormatter,
|
formatter_class=argparse.RawTextHelpFormatter,
|
||||||
epilog='''\
|
epilog='''\
|
||||||
Useful Information:
|
Useful Information:
|
||||||
@@ -152,10 +155,10 @@ Generic command layout:
|
|||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
''')
|
''')
|
||||||
parser.add_argument('--ap_test_mode', help='--ap_mode ',default=True)
|
parser.add_argument('--ap_test_mode', help='--ap_mode ', default=True)
|
||||||
parser.add_argument('--ap_port', help='--ap_port \'/dev/ttyUSB0\'',default='/dev/ttyUSB0')
|
parser.add_argument('--ap_port', help='--ap_port \'/dev/ttyUSB0\'', default='/dev/ttyUSB0')
|
||||||
parser.add_argument('--ap_baud', help='--ap_baud \'115200\'',default='115200')
|
parser.add_argument('--ap_baud', help='--ap_baud \'115200\'', default='115200')
|
||||||
parser.add_argument('--ap_cmd', help='--ap_cmd \'wl -i wl1 bs_data\'',default='wl -i wl1 bs_data')
|
parser.add_argument('--ap_cmd', help='--ap_cmd \'wl -i wl1 bs_data\'', default='wl -i wl1 bs_data')
|
||||||
parser.add_argument('--ap_file', help='--ap_file \'ap_file.txt\'')
|
parser.add_argument('--ap_file', help='--ap_file \'ap_file.txt\'')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
@@ -166,14 +169,13 @@ Generic command layout:
|
|||||||
__ap_file = args.ap_file
|
__ap_file = args.ap_file
|
||||||
|
|
||||||
ap_dut = lf_ap(
|
ap_dut = lf_ap(
|
||||||
_ap_port = __ap_port,
|
_ap_port=__ap_port,
|
||||||
_ap_baud = __ap_baud,
|
_ap_baud=__ap_baud,
|
||||||
_ap_cmd = __ap_cmd ,
|
_ap_cmd=__ap_cmd,
|
||||||
_ap_file = __ap_file)
|
_ap_file=__ap_file)
|
||||||
|
|
||||||
ap_dut.ap_action()
|
ap_dut.ap_action()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user