diff --git a/.gitignore b/.gitignore index 03cda2a..de3779c 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,6 @@ publish/* # 客戶板 schematic 原始檔(機密,勿入 repo) *.DSN *.dsn + +# 尚未上機驗證的腳本暫存區(不入 repo,測過再搬進 src/) +tmp/ diff --git a/src/Script_ABC_Blanton/5_Blanton_Script_Reboot_Cycle.ttl b/src/Script_ABC_Blanton/5_Blanton_Script_Reboot_Cycle.ttl new file mode 100644 index 0000000..f5f8df1 --- /dev/null +++ b/src/Script_ABC_Blanton/5_Blanton_Script_Reboot_Cycle.ttl @@ -0,0 +1,419 @@ +include "config.ttl" + +flushrecv +;================================================================ +; Log File Creation +;================================================================ +gettime str_starttime "%Y%m%d-%H%M%S" +getdir mdir + +if EN_log = 1 then + sprintf2 filename '%s\Logs\%s_%s_%s.log' mdir project_name "Reboot_Cycle" str_starttime + logopen filename 0 1 1 1 +endif + +cnt_cycle = 0 + +while 1 + cnt_cycle = cnt_cycle + 1 + ; ========== Root Login ========== + wait prompt_login + sendln "admin" + wait "Password:" + sendln "YourPaSsWoRd" + wait prompt_sonic + sendln "sudo -i" + wait prompt_sonic_root + sendln "sleep 10" + + wait prompt_sonic_root + sprintf2 strTitle "echo -e '\033[1;32mReboot Cycle : %d \033[0m'" cnt_cycle + sendln strTitle + + ; ========== Pre Setting ========== + ; Make log directory + wait prompt_sonic_root + sendln "mkdir ./logs" + + ; Setting System Time + getdate datestr + gettime timestr + sprintf2 cmd 'sudo date -s "%s %s"' datestr timestr + sendln cmd + + ; ========== FAN SPEED ========== + wait prompt_sonic_root + sendln "echo 18-0020 > /sys/bus/i2c/drivers/max31790/unbind" + wait prompt_sonic_root + sendln "sleep .5" + wait prompt_sonic_root + sendln "echo 18-0020 > /sys/bus/i2c/drivers/max31790/bind" + wait prompt_sonic_root + sendln "echo 25-0020 > /sys/bus/i2c/drivers/max31790/unbind" + wait prompt_sonic_root + sendln "sleep .5" + wait prompt_sonic_root + sendln "echo 25-0020 > /sys/bus/i2c/drivers/max31790/bind" + + wait prompt_sonic_root + sprintf2 fan_ctrl_cmd 'fan-speed-control.sh %d' FAN_SPEED + sendln fan_ctrl_cmd + + wait "Set all configured fan channels to" + sendln "y" + + ; ========== Wait DUT Init ========== + include "utils/wait_init.ttl" + + ; ========== DUT Info ========== + wait prompt_sonic_root + sprintf2 strCKPt1 "echo -e '\033[36mCheck Pt1 : DUT Info\033[0m'" + sendln strCKPt1 + + wait prompt_sonic_root + sendln "show boot" + wait prompt_sonic_root + sendln "show version" + wait prompt_sonic_root + sendln "fwutil show status" + wait prompt_sonic_root + sendln "show system-memory" + wait prompt_sonic_root + sendln "show service" + wait prompt_sonic_root + sendln "show platform syseeprom" + wait prompt_sonic_root + sendln "show platform ssdhealth" + wait prompt_sonic_root + sendln "qfx5252-tpm-version" + wait prompt_sonic_root + sendln "/usr/sbin/nvme smart-log -H /dev/nvme0" + wait prompt_sonic_root + sendln "/usr/sbin/smartctl -x /dev/nvme0" + + ; ========== BMC version ========== + wait prompt_sonic_root + sprintf2 strCKPt2 "echo -e '\033[36mCheck Pt2 : BMC Info\033[0m'" + sendln strCKPt2 + + wait prompt_sonic_root + sendln "bmc-first-enroll" + wait prompt_sonic_root + sendln "bmc-manager version" + wait prompt_sonic_root + sendln "bmc-manager status" + + ; ========== Load Shell Script ========== + wait prompt_sonic_root + sendln "source ~/Blanton_Script/blanton_fpga_pcimem.sh" + wait prompt_sonic_root + sendln "source ~/Blanton_Script/blanton_cb_i2c.sh" + wait prompt_sonic_root + sendln "source ~/Blanton_Script/blanton_icb_vi2c.sh" + wait prompt_sonic_root + sendln "source ~/Blanton_Script/blanton_pwr_data.sh" + wait prompt_sonic_root + sendln "source ~/Blanton_Script/blanton_traffic_linespeed.sh" + wait prompt_sonic_root + sendln "source ~/Blanton_Script/LTC2980_Margin_Script/margin.sh" + + ; ========== CLEAR PCIE Error ========== + include "utils/show_pcie_error_reg_TH6_SWB0.ttl" + include "utils/show_pcie_error_reg_TH6_SWB1.ttl" + include "utils/show_pcie_error_reg_FPGA.ttl" + include "utils/show_pcie_error_reg_BMC.ttl" + include "utils/show_pcie_error_reg_DDR.ttl" + include "utils/show_pcie_error_reg_I210.ttl" + include "utils/show_pcie_error_reg_SSD.ttl" + + wait prompt_sonic_root + sendln "/usr/sbin/ras-mc-ctl --summary" + + ; ========== Check PCIE tree + PCIE link status + GET PCIE bandwidth Test ========== + include "utils/pcie_bus.ttl" + + ; ========== TAKE DATA ========== + include "utils/setup_pmon.ttl" + include "utils/show_dmesg.ttl" + + ; ========== 10G/1G MGMT Ping Test ========== + wait prompt_sonic_root + sprintf2 strCKPt3 "echo -e '\033[36mCheck Pt3 : Mgmt Ping Test\033[0m'" + sendln strCKPt3 + + wait prompt_sonic_root + sendln "./Blanton_Script/mgmt_ping_monitor.sh start" + wait prompt_sonic_root + pause 30 + sendln "~/Blanton_Script/mgmt_ping_monitor.sh stop" + wait prompt_sonic_root + sendln "cat ~/Blanton_Script/log/mgmt_ping.log" + wait prompt_sonic_root + sendln "~/Blanton_Script/mgmt_ping_monitor.sh clear" + + ; ========== NFC Test ========== + wait prompt_sonic_root + sprintf2 strCKPt4 "echo -e '\033[36mCheck Pt4 : NFC Test\033[0m'" + sendln strCKPt4 + + wait prompt_sonic_root + sendln "~/Blanton_Script/nfc_polling.sh start" + wait prompt_sonic_root + sendln "~/Blanton_Script/nfc_polling.sh status" + wait prompt_sonic_root + sendln "sleep 20" + wait prompt_sonic_root + sendln "~/Blanton_Script/nfc_polling.sh stop" + wait prompt_sonic_root + sendln "~/Blanton_Script/nfc_polling.sh report" + + ; ========== SSD read/write ========== + wait prompt_sonic_root + sprintf2 strCKPt5 "echo -e '\033[36mCheck Pt5 : SSD Test\033[0m'" + sendln strCKPt5 + + wait prompt_sonic_root + sendln "qfx5252-stress-ssd 1G --runtime 30 --passes 2 --write --force --log /host/hw-eval/jobs/qfx5252-stress-ssd.log" + wait prompt_sonic_root + sendln "cat /host/hw-eval/jobs/qfx5252-stress-ssd.log" + + ; ========== USB read/write ========== + wait prompt_sonic_root + sprintf2 strCKPt6 "echo -e '\033[36mCheck Pt6 : USB Test\033[0m'" + sendln strCKPt6 + + ; ---- Get USB partition node -> usb_dev ---- + usb_dev = '' + wait prompt_sonic_root + sendln 'D=$(bash ~/Blanton_Script/usb_target.sh -o dev 2>/dev/null); echo "<>"' + waitregex '<]*)>>' + usb_dev = groupmatchstr1 + + wait prompt_sonic_root + sprintf2 cmd "qfx5252-stress-usb %s 256M --runtime 30 --passes 2 --write --log /host/hw-eval/jobs/qfx5252-stress-usb.log" usb_dev + sendln cmd + wait prompt_sonic_root + sendln "cat /host/hw-eval/jobs/qfx5252-stress-usb.log" + + ; ========== BMC USB Test ========== + wait prompt_sonic_root + sprintf2 strCKPt7 "echo -e '\033[36mCheck Pt7 : BMC USB Test\033[0m'" + sendln strCKPt7 + + wait prompt_sonic_root + sendln 'echo "NCMIF=$(ls -d /sys/bus/usb/drivers/cdc_ncm/*/net/* 2>/dev/null | head -n 1 | xargs -r basename)"' + ; timeout is GLOBAL and sticky: left at 15, every 'wait' below gives up after + ; 15 s instead of blocking, the macro runs ahead of the DUT and the whole + ; cycle desynchronises. Restore it BEFORE the branch so both paths are + ; covered - the ping block below waits on 'sleep 10', which is already two + ; thirds of the 15 s cap on a loaded DUT. + timeout = 15 + waitregex 'NCMIF=[A-Za-z0-9_-]+' + ncm_found = result ; hold it: 'result' is reused below + timeout = 0 ; restore, both paths + if ncm_found = 0 then + messagebox 'cdc_ncm interface not found. Ping test skipped.' 'ERROR' + goto skip_ping + endif + strlen matchstr + cut_len = result - 6 ; 'NCMIF=' = 6 chars + strcopy matchstr 7 cut_len ncm_if ; -> ncm_if = "eth2" / "eth3" + + sprintf2 cmd 'ip -br link show %s' ncm_if + wait prompt_sonic_root + sendln cmd + + wait prompt_sonic_root + sendln 'systemctl stop qfx5252-bmc-usb-net-test.service 2>/dev/null || true' + wait prompt_sonic_root + sendln 'systemctl reset-failed qfx5252-bmc-usb-net-test.service 2>/dev/null || true' + sprintf2 cmd 'systemd-run --unit=qfx5252-bmc-usb-net-test --property=Type=exec /usr/bin/ping -I %s -i 1 -W 2 -w 14400 192.168.200.200' ncm_if + wait prompt_sonic_root + sendln cmd + wait prompt_sonic_root + sendln "sleep 10" + wait prompt_sonic_root + sendln "systemctl stop qfx5252-bmc-usb-net-test.service" + wait prompt_sonic_root + sendln "journalctl -u qfx5252-bmc-usb-net-test.service --no-pager" + +:skip_ping + timeout = 0 ; backstop, same as Script B + + ; ========== 100G Port Setting ========== + wait prompt_sonic_root + sendln "sudo sfputil lpmode off Ethernet513" + wait prompt_sonic_root + sendln "sudo sfputil lpmode off Ethernet514" + wait prompt_sonic_root + sendln "config interface -n asic0 startup Ethernet513" + wait prompt_sonic_root + sendln "config interface -n asic1 startup Ethernet514" + wait prompt_sonic_root + sendln "config save -y" + + ; ========== First Traffic Test ========== + ; Silent MAC + wait prompt_sonic_root + sendln "config feature state lldp disabled" + wait prompt_sonic_root + sendln "config save -y" + + ; ========== 100G Port Status ========== + wait prompt_sonic_root + sprintf2 strCKPt8 "echo -e '\033[36mCheck Pt8 : Port Status and 15sec Traffic \033[0m'" + sendln strCKPt8 + + wait prompt_sonic_root + sendln "show interfaces status Ethernet513,Ethernet514" + + ; ========== Traffic Test ========== + if SWB_UNIT0 = 1 && SWB_UNIT1 = 1 then + wait prompt_sonic_root + sendln "blanton_traffic_linespeed ps" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed init" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed clear" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed show" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed start" + wait prompt_sonic_root + pause 15 + sendln "blanton_traffic_linespeed stop" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed report" + elseif SWB_UNIT0 = 1 && SWB_UNIT1 = 0 then + wait prompt_sonic_root + sendln "blanton_traffic_linespeed ps -u 0" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed init -u 0" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed clear -u 0" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed show -u 0" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed start -u 0" + wait prompt_sonic_root + pause 15 + sendln "blanton_traffic_linespeed stop -u 0" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed report -u 0" + elseif SWB_UNIT0 = 0 && SWB_UNIT1 = 1 then + wait prompt_sonic_root + sendln "blanton_traffic_linespeed ps -u 1" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed init -u 1" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed clear -u 1" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed show -u 1" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed start -u 1" + wait prompt_sonic_root + pause 15 + sendln "blanton_traffic_linespeed stop -u 1" + wait prompt_sonic_root + sendln "blanton_traffic_linespeed report -u 1" + else + + endif + + ; ========== BER ========== + ; PRBS takes the SerDes out of normal operation, so this runs AFTER the + ; traffic report. sleep 30 matches blanton_ber.sh BER_INTERVAL - reporting + ; earlier reads an interval that has not finished accumulating. + wait prompt_sonic_root + sprintf2 strCKPt8 "echo -e '\033[36mCheck Pt9 : BER Test \033[0m'" + sendln strCKPt8 + + if SWB_UNIT0 = 1 && SWB_UNIT1 = 1 then + wait prompt_sonic_root + sendln "./Blanton_Script/blanton_ber.sh init" + wait prompt_sonic_root + sendln "./Blanton_Script/blanton_ber.sh start" + wait prompt_sonic_root + sendln "sleep 30" + wait prompt_sonic_root + sendln "./Blanton_Script/blanton_ber.sh report" + wait prompt_sonic_root + sendln "./Blanton_Script/blanton_ber.sh stop" + wait prompt_sonic_root + sendln "./Blanton_Script/blanton_ber.sh clear" + elseif SWB_UNIT0 = 1 && SWB_UNIT1 = 0 then + wait prompt_sonic_root + sendln "./Blanton_Script/blanton_ber.sh init -u 0" + wait prompt_sonic_root + sendln "./Blanton_Script/blanton_ber.sh start -u 0" + wait prompt_sonic_root + sendln "sleep 30" + wait prompt_sonic_root + sendln "./Blanton_Script/blanton_ber.sh report -u 0" + wait prompt_sonic_root + sendln "./Blanton_Script/blanton_ber.sh stop -u 0" + wait prompt_sonic_root + sendln "./Blanton_Script/blanton_ber.sh clear -u 0" + elseif SWB_UNIT0 = 0 && SWB_UNIT1 = 1 then + wait prompt_sonic_root + sendln "./Blanton_Script/blanton_ber.sh init -u 1" + wait prompt_sonic_root + sendln "./Blanton_Script/blanton_ber.sh start -u 1" + wait prompt_sonic_root + sendln "sleep 30" + wait prompt_sonic_root + sendln "./Blanton_Script/blanton_ber.sh report -u 1" + wait prompt_sonic_root + sendln "./Blanton_Script/blanton_ber.sh stop -u 1" + wait prompt_sonic_root + sendln "./Blanton_Script/blanton_ber.sh clear -u 1" + else + + endif + + ; ========== NVME Err Info ========== + wait prompt_sonic_root + sprintf2 strCKPt9 "echo -e '\033[36mCheck Pt10 : NVME Err Info \033[0m'" + sendln strCKPt9 + + wait prompt_sonic_root + sendln "/usr/sbin/nvme smart-log -H /dev/nvme0" + wait prompt_sonic_root + sendln "/usr/sbin/smartctl -x /dev/nvme0" + + ; ========== TAKE DATA ========== + wait prompt_sonic_root + sprintf2 strCKPt10 "echo -e '\033[36mCheck Pt11 : Platform Data \033[0m'" + sendln strCKPt10 + include "utils/setup_pmon.ttl" + + wait prompt_sonic_root + sprintf2 strCKPt12 "echo -e '\033[36mCheck Pt12 : Dmesg_i2c \033[0m'" + sendln strCKPt12 + include "utils/show_dmesg.ttl" + + ; ========== Check PCIE error counters ========== + wait prompt_sonic_root + sprintf2 strCKPt13 "echo -e '\033[36mCheck Pt13 : PCIE Error Counters \033[0m'" + sendln strCKPt13 + include "utils/show_pcie_error_reg_TH6_SWB0.ttl" + include "utils/show_pcie_error_reg_TH6_SWB1.ttl" + include "utils/show_pcie_error_reg_FPGA.ttl" + include "utils/show_pcie_error_reg_BMC.ttl" + include "utils/show_pcie_error_reg_DDR.ttl" + include "utils/show_pcie_error_reg_I210.ttl" + include "utils/show_pcie_error_reg_SSD.ttl" + + wait prompt_sonic_root + sendln "/usr/sbin/ras-mc-ctl --summary" + + ; ========== Show Power on uptime ========== + wait prompt_sonic_root + sendln "show uptime" + + ; ========== Show Power on uptime ========== + wait prompt_sonic_root + sendln "reboot" + + wait "Booting in blind mode" +endwhile