mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 19:28:00 +00:00
cicd: Support capturing bugcheck output on openwrt systems.
Signed-off-by: Ben Greear <greearb@candelatech.com>
This commit is contained in:
@@ -137,6 +137,17 @@ function post_test {
|
|||||||
pkill -f ".*openwrt_ctl.*$AP_SERIAL.*"
|
pkill -f ".*openwrt_ctl.*$AP_SERIAL.*"
|
||||||
mv $DUT_SER_LOG $DEST/logs/dut_console_log.txt
|
mv $DUT_SER_LOG $DEST/logs/dut_console_log.txt
|
||||||
|
|
||||||
|
# Look for firmware crash files
|
||||||
|
PIDD=$$
|
||||||
|
../openwrt_ctl.py $OWRTCTL_ARGS --tty $AP_SERIAL --scheme serial --action cmd --value "tar -cvzf /tmp/bugcheck.tgz /tmp/bugcheck"
|
||||||
|
../openwrt_ctl.py $OWRTCTL_ARGS --tty $AP_SERIAL --scheme serial --action upload --value "/tmp/bugcheck.tgz" --value2 "lanforge\@$ap_gw:bugcheck-$PIDD.tgz"
|
||||||
|
|
||||||
|
# Grab the file from LANforge
|
||||||
|
scp lanforge\@$LFMANAGER:bugcheck-$PIDD.tgz $DEST/logs/bugcheck.tgz
|
||||||
|
|
||||||
|
# Clean log file
|
||||||
|
ssh lanforge\@$LFMANAGER "rm bugcheck-$PIDD.tgz"
|
||||||
|
|
||||||
# detect a few fatal flaws and reqest AP restart if found.
|
# detect a few fatal flaws and reqest AP restart if found.
|
||||||
grep "Hardware became unavailable" $DEST/logs/dut_console_log.txt && reboot_dut
|
grep "Hardware became unavailable" $DEST/logs/dut_console_log.txt && reboot_dut
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ def usage():
|
|||||||
print("--prompt Prompt to look for when commands are done (default: root@OpenWrt)")
|
print("--prompt Prompt to look for when commands are done (default: root@OpenWrt)")
|
||||||
print("-s|--scheme (serial|telnet|ssh): connect via serial, ssh or telnet")
|
print("-s|--scheme (serial|telnet|ssh): connect via serial, ssh or telnet")
|
||||||
print("-l|--log file log messages here")
|
print("-l|--log file log messages here")
|
||||||
print("--action (logread | journalctl | lurk | sysupgrade | download | reboot | cmd")
|
print("--action (logread | journalctl | lurk | sysupgrade | download | upload | reboot | cmd")
|
||||||
print("--value (option to help complete the action")
|
print("--value (option to help complete the action")
|
||||||
print("--value2 (option to help complete the action, dest filename for download")
|
print("--value2 (option to help complete the action, dest filename for download")
|
||||||
print("-h|--help")
|
print("-h|--help")
|
||||||
@@ -78,7 +78,7 @@ def main():
|
|||||||
parser.add_argument("-t", "--tty", type=str, help="tty serial device")
|
parser.add_argument("-t", "--tty", type=str, help="tty serial device")
|
||||||
parser.add_argument("-l", "--log", type=str, help="logfile for messages, stdout means output to console")
|
parser.add_argument("-l", "--log", type=str, help="logfile for messages, stdout means output to console")
|
||||||
parser.add_argument("--action", type=str, help="perform action",
|
parser.add_argument("--action", type=str, help="perform action",
|
||||||
choices=["logread", "journalctl", "lurk", "sysupgrade", "download", "reboot", "cmd" ])
|
choices=["logread", "journalctl", "lurk", "sysupgrade", "download", "upload", "reboot", "cmd" ])
|
||||||
parser.add_argument("--value", type=str, help="set value")
|
parser.add_argument("--value", type=str, help="set value")
|
||||||
parser.add_argument("--value2", type=str, help="set value2")
|
parser.add_argument("--value2", type=str, help="set value2")
|
||||||
tty = None
|
tty = None
|
||||||
@@ -267,6 +267,30 @@ def main():
|
|||||||
egg.expect(CCPROMPT, timeout=20)
|
egg.expect(CCPROMPT, timeout=20)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if (args.action == "upload"):
|
||||||
|
command = "scp %s %s"%(args.value, args.value2)
|
||||||
|
logg.info("Command[%s]"%command)
|
||||||
|
egg.sendline(command);
|
||||||
|
|
||||||
|
i = egg.expect(["password:", "Do you want to continue connecting", "Network unreachable"], timeout=5)
|
||||||
|
if i == 2:
|
||||||
|
print("Network unreachable, wait 15 seconds and try again.")
|
||||||
|
time.sleep(15)
|
||||||
|
command = "scp /tmp/%s %s"%(args.value, args.value2)
|
||||||
|
logg.info("Command[%s]"%command)
|
||||||
|
egg.sendline(command);
|
||||||
|
|
||||||
|
i = egg.expect(["password:", "Do you want to continue connecting", "Network unreachable"], timeout=5)
|
||||||
|
if i == 2:
|
||||||
|
print("ERROR: Could not connect to LANforge to put upload file")
|
||||||
|
exit(2)
|
||||||
|
if i == 1:
|
||||||
|
egg.sendline("y")
|
||||||
|
egg.expect("password:", timeout=5)
|
||||||
|
egg.sendline("lanforge")
|
||||||
|
egg.expect(CCPROMPT, timeout=20)
|
||||||
|
return
|
||||||
|
|
||||||
if (command is None):
|
if (command is None):
|
||||||
logg.info("No command specified, going to log out.")
|
logg.info("No command specified, going to log out.")
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user