diff --git a/ap_ctl.py b/ap_ctl.py index c562b302..ab2296b7 100755 --- a/ap_ctl.py +++ b/ap_ctl.py @@ -47,6 +47,13 @@ import argparse import pexpect import serial from pexpect_serial import SerialSpawn +import importlib + + +sys.path.append(os.path.join(os.path.abspath(__file__ + "../../"))) +logger = logging.getLogger(__name__) +lf_logger_config = importlib.import_module("py-scripts.lf_logger_config") +mux_client = importlib.import_module("mux_client") # pip install pexpect-serial (on Ubuntu) # sudo pip install pexpect-serial (on Ubuntu for everyone) @@ -55,7 +62,8 @@ default_host = "localhost" default_ports = { "serial": None, "ssh": 22, - "telnet": 23 + "telnet": 23, + "mux_serial": 23200 } NL = "\n" CR = "\r\n" @@ -119,11 +127,13 @@ def main(): parser.add_argument("-o", "--port", type=int, help="control port on the AP, 2008") parser.add_argument("-u", "--user", type=str, help="credential login/username, admin") parser.add_argument("-p", "--passwd", type=str, help="credential password Wnbulab@123") - parser.add_argument("-s", "--scheme", type=str, choices=["serial", "ssh", "telnet"], help="Connect via serial, ssh or telnet") + parser.add_argument("-s", "--scheme", type=str, choices=["serial", "ssh", "telnet", "mux_client"], help="Connect via serial, ssh, telnet, mux_client") parser.add_argument("-t", "--tty", type=str, help="tty serial device for connecting to AP") parser.add_argument("-l", "--log", type=str, help="logfile for messages, stdout means output to console",default="stdout") parser.add_argument("-z", "--action", type=str, help="action, current action is powercfg") - parser.add_argument("-b", "--baud", type=str, help="action, baud rate lanforge: 115200 cisco: 9600") + parser.add_argument("-b", "--baud", type=str, help="baud, baud rate lanforge: 115200 cisco: 9600") + parser.add_argument("--mux_client_module", type=str, help="mux client module") + args = None try: @@ -168,7 +178,7 @@ def main(): elif (scheme == "ssh"): if (port is None): - port = 22 + port = default_ports["ssh"] cmd = "ssh -p%d %s@%s"%(port, user, host) logg.info("Spawn: "+cmd+NL) egg = pexpect.spawn(cmd) @@ -176,12 +186,18 @@ def main(): egg.logfile = FileAdapter(logg) elif (scheme == "telnet"): if (port is None): - port = 23 + port = default_ports["telnet"] cmd = "telnet {} {}".format(host, port) logg.info("Spawn: "+cmd+NL) egg = pexpect.spawn(cmd) egg.logfile = FileAdapter(logg) # Will login below as needed. + elif (scheme == "mux_serial"): + # sudo ./mux_server.py --device /dev/ttyUSB0 --baud 115200 --port 23200 + if port is None: + port = default_ports["mux_serial"] + cmd = "./mux_client.py " + else: usage() exit(1) @@ -251,6 +267,7 @@ def main(): sleep(1) + # show controllers dot11Radio 2 powerreg if (args.action == "powercfg"): logg.info("execute: show controllers dot11Radio 1 powercfg | g T1") egg.sendline('show controllers dot11Radio 1 powercfg | g T1') diff --git a/lf_tx_power.py b/lf_tx_power.py index d58180c5..020ac3e6 100755 --- a/lf_tx_power.py +++ b/lf_tx_power.py @@ -1730,6 +1730,7 @@ def main(): try: logg.info("ap_ctl.py: read AP power information") + # TODO use ap module ap_info = subprocess.run(["./ap_ctl.py", "--scheme", ap_dict['ap_scheme'], "--prompt", ap_dict['ap_prompt'], "--dest", ap_dict['ap_ip'], "--port", ap_dict["ap_port"], "--user", ap_dict['ap_user'], "--passwd", ap_dict['ap_pw'], "--action", "powercfg"], stdout=subprocess.PIPE) try: diff --git a/py-scripts/tools/ct_9136_tx_power_tests.json b/py-scripts/tools/ct_9136_tx_power_tests.json index 7d2c2e88..f488629d 100644 --- a/py-scripts/tools/ct_9136_tx_power_tests.json +++ b/py-scripts/tools/ct_9136_tx_power_tests.json @@ -138,8 +138,9 @@ "load_db":"skip", "timeout":"180", "iterations":"1", - "batch_channel":"1", - "batch_nss":"2", + "batch_channel":"1 33 65", + "batch_nss":"1 2", + "batch_bandwidth":"20 40 80 160", "command":"lf_tx_power.py", "args":"", "args_list":[ @@ -148,11 +149,11 @@ " --ap USE_DUT_NAME --ap_slot 4 --ap_band_slot_6g 3 ", " use_ssid_idx=2 --wlan SSID_USED --wlan_id WLAN_ID_USED --wlan_ssid SSID_USED", " --tag_policy RM204-TB1-AP5 --policy_profile default-policy-profile", - " use_ssid_idx=2 --radio wiphy2 --create_station --station sta0000 --ssid SSID_USED --ssidpw SSID_PW_USED --security SECURITY_USED", + " use_ssid_idx=2 --radio wiphy2 --station sta0000 --ssid SSID_USED --ssidpw SSID_PW_USED --security SECURITY_USED", " --pathloss 59 --antenna_gain 6", " --lfmgr LF_MGR_IP --upstream_port UPSTREAM_ALIAS --lfresource 1", " --vht160 --ieee80211w required --wifi_mode abgnAX", - " --channel USE_BATCH_CHANNEL --nss USE_BATCH_NSS --bandwidth '20' --txpower '2'", + " --channel USE_BATCH_CHANNEL --nss USE_BATCH_NSS --bandwidth USE_BATCH_CHANNEL --txpower '1 2 3 4 5 6 7 8'", " --outfile tx_power_2B24 --no_cleanup --no_cleanup_station --testbed_id Cisco-WLC1-AP5", " --local_lf_report_dir REPORT_PATH", " --test_tag 'tx_power C9136I-B AP687D.B45C.2B24'",