mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-05 21:28:03 +00:00
cisco_ap_ctl.py lf_cisco_dfs.py : updates for DFS testing
This commit is contained in:
@@ -176,42 +176,42 @@ def main():
|
|||||||
if i == 0:
|
if i == 0:
|
||||||
logg.info("Expect: {} i: {} loop_count: {}before: {} after: {}".format(AP_ESCAPE,i,egg.before,egg.after))
|
logg.info("Expect: {} i: {} loop_count: {}before: {} after: {}".format(AP_ESCAPE,i,egg.before,egg.after))
|
||||||
egg.sendline(CR) # Needed after Escape or should just do timeout and then a CR?
|
egg.sendline(CR) # Needed after Escape or should just do timeout and then a CR?
|
||||||
sleep(0.2)
|
sleep(0.4)
|
||||||
if i == 1:
|
if i == 1:
|
||||||
logg.info("Expect: {} i: {} before: {} after: {}".format(AP_PROMPT,i,egg.before,egg.after))
|
logg.info("Expect: {} i: {} before: {} after: {}".format(AP_PROMPT,i,egg.before,egg.after))
|
||||||
egg.sendline(AP_EN)
|
egg.sendline(AP_EN)
|
||||||
sleep(0.2)
|
sleep(0.4)
|
||||||
if i == 2:
|
if i == 2:
|
||||||
logg.info("Expect: {} i: {} before: {} after: {}".format(AP_HASH,i,egg.before,egg.after))
|
logg.info("Expect: {} i: {} before: {} after: {}".format(AP_HASH,i,egg.before,egg.after))
|
||||||
logged_in = True
|
logged_in = True
|
||||||
sleep(0.2)
|
sleep(0.4)
|
||||||
if i == 3:
|
if i == 3:
|
||||||
logg.info("Expect: {} i: {} before: {} after: {}".format(AP_USERNAME,i,egg.before,egg.after))
|
logg.info("Expect: {} i: {} before: {} after: {}".format(AP_USERNAME,i,egg.before,egg.after))
|
||||||
egg.sendline(args.user)
|
egg.sendline(args.user)
|
||||||
sleep(0.2)
|
sleep(0.4)
|
||||||
if i == 4:
|
if i == 4:
|
||||||
logg.info("Expect: {} i: {} before: {} after: {}".format(AP_PASSWORD,i,egg.before,egg.after))
|
logg.info("Expect: {} i: {} before: {} after: {}".format(AP_PASSWORD,i,egg.before,egg.after))
|
||||||
egg.sendline(args.passwd)
|
egg.sendline(args.passwd)
|
||||||
sleep(0.2)
|
sleep(0.4)
|
||||||
if i == 5:
|
if i == 5:
|
||||||
logg.info("Expect: {} i: {} before: {} after: {}".format(AP_MORE,i,egg.before,egg.after))
|
logg.info("Expect: {} i: {} before: {} after: {}".format(AP_MORE,i,egg.before,egg.after))
|
||||||
if (scheme == "serial"):
|
if (scheme == "serial"):
|
||||||
egg.sendline("r")
|
egg.sendline("r")
|
||||||
else:
|
else:
|
||||||
egg.sendcontrol('c')
|
egg.sendcontrol('c')
|
||||||
sleep(0.2)
|
sleep(0.4)
|
||||||
# for Testing serial connection using Lanforge
|
# for Testing serial connection using Lanforge
|
||||||
if i == 6:
|
if i == 6:
|
||||||
logg.info("Expect: {} i: {} before: {} after: {}".format(LF_PROMPT,i,egg.before.decode('utf-8', 'ignore'),egg.after.decode('utf-8', 'ignore')))
|
logg.info("Expect: {} i: {} before: {} after: {}".format(LF_PROMPT,i,egg.before.decode('utf-8', 'ignore'),egg.after.decode('utf-8', 'ignore')))
|
||||||
if (loop_count < 3):
|
if (loop_count < 3):
|
||||||
egg.send("ls -lrt")
|
egg.send("ls -lrt")
|
||||||
sleep(0.2)
|
sleep(0.4)
|
||||||
if (loop_count > 4):
|
if (loop_count > 4):
|
||||||
logged_in = True # basically a test mode using lanforge serial
|
logged_in = True # basically a test mode using lanforge serial
|
||||||
if i == 7:
|
if i == 7:
|
||||||
logg.info("Expect: {} i: {} before: {} after: {}".format("Timeout",i,egg.before,egg.after))
|
logg.info("Expect: {} i: {} before: {} after: {}".format("Timeout",i,egg.before,egg.after))
|
||||||
egg.sendline(CR)
|
egg.sendline(CR)
|
||||||
sleep(0.2)
|
sleep(0.4)
|
||||||
|
|
||||||
|
|
||||||
if (args.action == "powercfg"):
|
if (args.action == "powercfg"):
|
||||||
@@ -247,18 +247,19 @@ def main():
|
|||||||
else: # no other command at this time so send the same power command
|
else: # no other command at this time so send the same power command
|
||||||
#logg.info("no action so execute: show controllers dot11Radio 1 powercfg | g T1")
|
#logg.info("no action so execute: show controllers dot11Radio 1 powercfg | g T1")
|
||||||
logg.info("no action so execute: show log")
|
logg.info("no action so execute: show log")
|
||||||
egg.sendline('show controllers dot11Radio 1 powercfg | g T1')
|
egg.sendline('show log')
|
||||||
egg.expect([pexpect.TIMEOUT], timeout=3) # do not delete this allows for subprocess to see output
|
egg.expect([pexpect.TIMEOUT], timeout=3) # do not delete this allows for subprocess to see output
|
||||||
print(egg.before.decode('utf-8', 'ignore')) # do not delete this allows for subprocess to see output
|
print(egg.before.decode('utf-8', 'ignore')) # do not delete this allows for subprocess to see output
|
||||||
|
|
||||||
i = egg.expect_exact([AP_MORE,pexpect.TIMEOUT],timeout=5)
|
i = egg.expect_exact([AP_MORE,pexpect.TIMEOUT],timeout=2)
|
||||||
# s
|
# s
|
||||||
if i == 0:
|
if i == 0:
|
||||||
egg.sendcontrol('c')
|
if (scheme != "serial"):
|
||||||
|
egg.sendcontrol('c')
|
||||||
if i == 1:
|
if i == 1:
|
||||||
logg.info("send cntl c anyway, received timeout")
|
if (scheme != "serial"):
|
||||||
egg.sendcontrol('c')
|
logg.info("send cntl c anyway, received timeout")
|
||||||
exit(1)
|
egg.sendcontrol('c')
|
||||||
|
|
||||||
i = egg.expect_exact([AP_PROMPT,AP_HASH,pexpect.TIMEOUT],timeout=1)
|
i = egg.expect_exact([AP_PROMPT,AP_HASH,pexpect.TIMEOUT],timeout=1)
|
||||||
if i == 0:
|
if i == 0:
|
||||||
|
|||||||
@@ -1699,7 +1699,7 @@ Eventual Realm at Cisco
|
|||||||
|
|
||||||
Sample script
|
Sample script
|
||||||
|
|
||||||
./lf_cisco_dfs.py -cc 192.168.100.112 -cu admin -cpw Cisco123 -cca APA453.0E7B.CF9C -ccf "a" -cwm "auto" -cc5 "52" -ccw "20" -ccd "1" -cs "3504" --endp_type 'lf_udp' --upstream_port eth2 --cisco_wlan "test_candela" --cisco_wlanID 1 --cisco_wlanSSID "test_candela" --cisco_directions "upstream" --cisco_prompt "(Cisco Controller)" --radio "radio==1.wiphy0 stations==1 ssid==test_candela ssid_pw==[BLANK] security==open wifimode==auto" --ap_info "ap_scheme==serial ap_prompt==APA53.0E7B.EF9C ap_ip==0 ap_port==0 ap_user==admin ap_pw==Admin123 ap_tty==/dev/ttyUSB2"
|
./lf_cisco_dfs.py -cc 192.168.100.112 -cu admin -cpw Cisco123 -cca APA453.0E7B.CF9C -ccf "a" -cwm "auto" -cc5 "52" -ccw "20" -ccd "1" -cs "3504" --endp_type 'lf_udp' --upstream_port eth2 --cisco_wlan "test_candela" --cisco_wlanID 1 --cisco_wlanSSID "test_candela" --cisco_directions "upstream" --cisco_prompt "(Cisco Controller)" --radio "radio==1.wiphy0 stations==1 ssid==test_candela ssid_pw==[BLANK] security==open wifimode==auto" --ap_info "ap_scheme==serial ap_prompt==APA453.0E7B.EF9C ap_ip==0 ap_port==0 ap_user==admin ap_pw==Admin123 ap_tty==/dev/ttyUSB2 ap_baud==9600"
|
||||||
|
|
||||||
|
|
||||||
''')
|
''')
|
||||||
@@ -2424,6 +2424,8 @@ Sample script
|
|||||||
logg.info("__dfs_channel line: {}".format(line))
|
logg.info("__dfs_channel line: {}".format(line))
|
||||||
else:
|
else:
|
||||||
logg.info("__dfs_channel COULD NOT FIND LINE")
|
logg.info("__dfs_channel COULD NOT FIND LINE")
|
||||||
|
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@@ -2432,8 +2434,6 @@ Sample script
|
|||||||
##########################################
|
##########################################
|
||||||
# end of cisco controller code
|
# end of cisco controller code
|
||||||
##########################################
|
##########################################
|
||||||
exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logg.info("###############################################")
|
logg.info("###############################################")
|
||||||
|
|||||||
Reference in New Issue
Block a user