ap_ctl.py : added slot parameter, added powerreg command

Signed-off-by: Chuck SmileyRekiere <chuck.smileyrekiere@candelatech.com>
This commit is contained in:
Chuck SmileyRekiere
2022-04-01 10:58:02 -04:00
committed by shivam
parent 329cc4c98e
commit e93ea41bd0

View File

@@ -125,7 +125,7 @@ def main():
parser = argparse.ArgumentParser(description="Cisco AP Control Script")
parser.add_argument("-s", "--scheme", type=str, choices=["serial", "ssh", "telnet", "mux_client"], help="Connect via serial, ssh, telnet, mux_client")
parser.add_argument("-d", "--dest", type=str, help="address of the AP 172.19.27.55 or address of the mux_serial server 192.168.100.239")
# parser.add_argument("-m", "--host", type=str, help="address of the mux_serial server 192.168.100.239")
parser.add_argument("-s", "--slot", type=str, help="slot of the radio for powerreg and powercfg commands",default='2')
parser.add_argument("-a", "--prompt", type=str, help="ap prompt")
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")
@@ -293,6 +293,8 @@ def main():
sleep(1)
# show controllers dot11Radio 2 powerreg
if (args.action == "powercfg"):
logg.info("execute: show controllers dot11Radio 1 powercfg | g T1")
@@ -306,6 +308,22 @@ def main():
logg.info("send cntl c anyway")
egg.sendcontrol('c')
elif (args.action == "powerreg"):
command = "show controllers dot11Radio {slot} powerreg".format(slot=args.slot)
logg.info("execute: {command}".format(command=command))
egg.sendline(command)
sleep(0.4)
egg.expect([pexpect.TIMEOUT], timeout=2) # do not delete this for it allows for subprocess to see output
print(egg.before.decode('utf-8', 'ignore')) # do not delete this for it allows for subprocess to see output
i = egg.expect_exact([AP_MORE,pexpect.TIMEOUT],timeout=4)
if i == 0:
egg.sendline('r')
egg.expect([pexpect.TIMEOUT], timeout=4) # do not delete this for it allows for subprocess to see output
print(egg.before.decode('utf-8', 'ignore')) # do not delete this for it allows for subprocess to see output
if i == 1:
print(egg.before.decode('utf-8', 'ignore')) # do not delete this for it allows for subprocess to see output
elif (args.action == "clear_log"):
logg.info("execute: clear log")
egg.sendline('clear log')