Compare commits
3
Commits
V1.2.5
..
738f1dd1c6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
738f1dd1c6 | ||
|
|
0407bbe04f | ||
|
|
319ee07de3 |
+3
-2
@@ -207,6 +207,7 @@ Blanton_TTL_Script/
|
||||
├── blanton_ber.sh # 全機 SerDes BER 掃描(phydiag prbs / prbsstat)
|
||||
│ # V1.2.2 起含 port 268(100G ce0),summary 每 unit 分 200G/100G/TOTAL
|
||||
├── blanton_ber_debug.sh # BER 原始輸出(p=p31、sleep 40、-u 0|1),不判定
|
||||
├── blanton_fdr.sh # FDR 統計(phydiag fdrstat start/clear/Counters/STOp),A/B/C 夾住流量
|
||||
├── bcm_100g_dsc_cycle.sh # 100G link down/up 循環 + 每輪 DSC 與 retimer TX/RX 讀回(未驗證)
|
||||
├── bcm_dsc_scan.sh # 全機 SerDes DSC dump(phydiag <port> dsc,~445 port × 2 unit)
|
||||
│ # 由 EN_TX_FIR 控制,A 與 C 各掃一次;單次約 10 分鐘
|
||||
@@ -387,7 +388,7 @@ PROFILE_CHANNELS=( "0:high:8" "1:low:8" ... ) # "channel:operation:change_perc
|
||||
|
||||
| 模組 | 進入點 | 功能 |
|
||||
|------|--------|------|
|
||||
| **Script A(Pre-test)** | `1_Blanton_Script_A.ttl` V1.2.5 | root 登入 → `date -s` 對時 → 清 job log → **收掉前一輪殘留**(`hw-test-session finish` → `bgctl reset --yes` → `bgctl stop --all` → `bgctl list` 確認清空)→ `hw-test-session start` → **設定風扇轉速** → **等資料面就緒**(`wait_init.ttl`)→ DUT 清單(boot/version/fwutil/syseeprom/ssdhealth/TPM/NVMe)→ BMC enroll + version/status → source bash 工具 → 清/讀 7 組 PCIe AER + `ras-mc-ctl --summary` → `lspci` → margin → PMON → dmesg → **10G/1G 管理網路 ping** → **NFC 基線**(start → 30s → stop → report)→ 100G uplink 設定與狀態 → **BER 基線掃描**(依 `SWB_UNIT`,V1.2.1 新增)→ **一輪流量基線** → **SerDes DSC 基線**(`EN_TX_FIR`)→ `show uptime` |
|
||||
| **Script A(Pre-test)** | `1_Blanton_Script_A.ttl` V1.2.6 | root 登入 → `date -s` 對時 → 清 job log → **收掉前一輪殘留**(`hw-test-session finish` → `bgctl reset --yes` → `bgctl stop --all` → `bgctl list` 確認清空)→ `hw-test-session start` → **設定風扇轉速** → **等資料面就緒**(`wait_init.ttl`)→ DUT 清單(boot/version/fwutil/syseeprom/ssdhealth/TPM/NVMe)→ BMC enroll + version/status → source bash 工具 → 清/讀 7 組 PCIe AER + `ras-mc-ctl --summary` → `lspci` → margin → PMON → dmesg → **10G/1G 管理網路 ping** → **NFC 基線**(start → 30s → stop → report)→ 100G uplink 設定與狀態 → **`unused_lanes.sh off`**(V1.2.6)→ **BER 基線掃描**(依 `SWB_UNIT`,V1.2.1 新增)→ **一輪流量基線**(V1.2.6 起兩 unit 時夾 FDR,sleep 40) → **SerDes DSC 基線**(`EN_TX_FIR`)→ `show uptime` |
|
||||
| **Script B(Stress)** | `2_Blanton_Script_B.ttl` | **V1.1.8 起 `mlucas-avx2 -cpu 0:15` 由 `systemd-run --unit=mlucas-amm`(`Type=exec`、`Restart=always`)啟動,不再是 shell 的 `&` 背景 job** + `bgctl run` 的 `memtester` / SSD / USB 壓力(v1.1.7 起 SSD/USB 的 `--runtime`/`--passes` 讀 `config.ttl` 的 `SSD_RUNTIME`/`SSD_COUNT`、`USB_RUNTIME`/`USB_COUNT`;BMC memtester 不帶次數 = 跑到被停) + BMC DDR(`bmc-manager run memtester`)→ BMC USB net test(探測 cdc_ncm 介面,`systemd-run` 掛 `BMC_USB_RUNTIME` 秒的 ping,V1.1.8 前寫死 4 小時)→ 啟動 mgmt ping 監控 → **啟動 NFC 輪詢** → `jobs` / `systemctl is-active mlucas-amm` / `bgctl list` → traffic(依 `SWB_UNIT`)→ `while 1` 每輪 PMON + `bgctl list`/`jobs`/`systemctl is-active mlucas-amm` + `sleep 60`(**V1.1.4 起 margin 不在迴圈內**;V1.2.0 起等待走 DUT 端 `sleep` 而非 macro 端 `pause`)|
|
||||
| **Script C(Post-test)** | `3_Blanton_Script_C.ttl` | `kill $(jobs -p)` + **`systemctl stop mlucas-amm`**(systemd unit 不是 shell job,`jobs -p` 抓不到)+ `bgctl stop --all` / `reset` + 停 BMC USB unit、mgmt ping 與 **NFC 輪詢** → PMON + dmesg → 7 組 AER + `ras-mc-ctl` → BMC USB `journalctl` **寫進 `log/bmc_usb_net.log`**(不再印在 console) → `ip -s link show eth0/eth1` → `cat` mlucas log(並 `cp` 進 job 目錄一起帶走)→ **NFC `report`** → traffic `stop` + `report` → **SerDes DSC 收尾**(`EN_TX_FIR`)→ **BER 掃描**(依 `SWB_UNIT`)→ NVMe 健康 → `show reboot-cause` → **margin 掃描**(`EN_Margin`,V1.1.4 由 Script B 移來)→ `uptime` → **job log 複製到 USB(帶時戳)** → `exit` + wait『Script done』→ `hw-test-session finish` |
|
||||
| **Script 4(Thermal / Safety)** | `4_Blanton_Script_thermal_safety.ttl` | **獨立腳本,不接 A→B→C。** Script A 式的環境建立(登入 / session / 風扇 / `wait_init` / DUT 清單 / BMC / PCIe 清除 / `pcie_bus` / PMON / dmesg)→ **滿載**(`mlucas-avx2 -cpu 0:15`,V1.1.8 起與 Script B 同樣掛成 `mlucas-amm` systemd unit + `blanton_tr518.sh start`)→ `while 1`:PMON + `TH6_SWB0/1_power_readback.sh` + `avt_pmpower.sh`(CPU 封裝功耗,V1.2.3)+ `bgctl list` / `jobs` / `systemctl is-active mlucas-amm`,`pause 60`。**沒有收尾段** —— 中斷後 DUT 仍在 `port cd lb=mac` / `l2 learn off` / `test mode nr=yes`,且 CPU 仍滿載,要手動 `blanton_tr518.sh stop` + `systemctl stop mlucas-amm` |
|
||||
@@ -818,7 +819,7 @@ margin status、全部 VRM 軌的 Vin/Vout/Iout/Temp、CB + ICB 溫感讀值,
|
||||
- [ ] `CHANGELOG.md`:延續三支腳本頂端的 Version History,集中成一份
|
||||
- [ ] 三支腳本的 header 版號與 `CHANGELOG.md` 對齊,`config.ttl` 加 `script_version` 並寫進 log 開頭
|
||||
- [ ] `docs/TTL_Script_Blanton_Status_*.xlsx` 更新為全 OK,或把剩餘項目移進 Future Extensions
|
||||
- [x] 打 git tag,push `nas` + `gitea`(已至 `V1.2.5`;`publish/` 依 Script A 檔頭版號打包)
|
||||
- [x] 打 git tag,push `nas` + `gitea`(已至 `V1.2.6`;`publish/` 依 Script A 檔頭版號打包)
|
||||
|
||||
**驗收條件:** 從 zip 解壓到一台乾淨的測試 NB,照 README 操作,不看原始碼就能完成一輪 A→B→C
|
||||
並產出 summary;`publish/` 內容與 git tag 一致。
|
||||
|
||||
@@ -9,7 +9,7 @@ DUT 端的取數能力由一組 **bash 工具庫** 提供(CB FPGA `pcimem` →
|
||||
|
||||
完整架構見 [ARCHITECTURE.md](ARCHITECTURE.md)。
|
||||
|
||||
**目前狀態(2026-10-21)**:Script A 為 **V1.2.5**(A 集中記錄所有 TTL 的變更)。涵蓋
|
||||
**目前狀態(2026-10-21)**:Script A 為 **V1.2.6**(A 集中記錄所有 TTL 的變更)。涵蓋
|
||||
PCIe AER / DDR EDAC / PMON+TPM / 電壓 margin(9 顆 LTC2980)/ SWB loopback 線速流量 /
|
||||
10G+1G 管理網路 ping / BMC DDR 與 USB / NVMe 健康,壓力層走平台的 `bgctl`。
|
||||
switch unit 數量由 `config.ttl` 的 `SWB_UNIT0` / `SWB_UNIT1` 宣告,風扇轉速由 `FAN_SPEED` 指定
|
||||
@@ -43,11 +43,14 @@ NFC tag 讀取由 `nfc_polling.sh` 背景輪詢(A 做基線、B 起、C 停並
|
||||
⚠️ Script 4 迴圈原本就自己讀一次,現在**每輪讀兩次**。V1.2.5 另有 `blanton_ber_debug.sh`(BER 原始輸出、`p=p31`、`sleep 40`)、
|
||||
`retimer_lanes.sh` / `unused_lanes.sh`(把沒接線的 retimer lane / TH6 port 關 TX),以及
|
||||
`5_1_Blanton_Script_Boot_Cycle_Fast.ttl`(Script 5 拿掉流量那段,只留 `ps`)。
|
||||
**V1.2.6 起 FDR 統計(`blanton_fdr.sh`,`phydiag fdrstat`)接進流量**:A 包住流量基線(sleep 15→40)、
|
||||
B 在 soak 前 start、C 收尾 rdcnt + stop,**只在兩個 unit 都開時才跑**。Script A 另在 BER 前先 `unused_lanes.sh off`,
|
||||
⚠️ **沒有任何地方再 `on` 回來**。
|
||||
以及 **`5_Blanton_Script_Boot_Cycle.ttl`**(重開機循環,**獨立跑不接 A→B→C**:登入 → 風扇 →
|
||||
Check Pt1~Pt13 → `reboot` → `wait "Booting in blind mode"`,`cnt_cycle` 每輪遞增,`while 1` 無止境,
|
||||
要停就關 Tera Term 的 macro)。**尚未上機驗證**。
|
||||
流程圖:`docs/Blanton_Test_Flow.drawio`。
|
||||
最後一次發布是 **V1.2.5**;SWB 的 I2C 通道與位址已於 2026-08-19 上機驗證。
|
||||
最後一次發布是 **V1.2.6**;SWB 的 I2C 通道與位址已於 2026-08-19 上機驗證。
|
||||
margin 的 `VNOM` 已於 2026-08-30 改為 Blanton 實測中位數(144 條軌中 86 條上調 0.8~2.5%)。
|
||||
交付用 `./publish/publish.sh` 打包。
|
||||
|
||||
@@ -188,7 +191,14 @@ sleep 30 # 至少等一個 interval 再 rep
|
||||
# 清單同 tools/BER_Test.txt,不含 268;BER_PORTS="...,268" 可加
|
||||
# ⚠️ 這支是 p=p31(已上機驗證),blanton_ber.sh 仍是 p=3 —— 兩者量的碼型可能不同
|
||||
|
||||
# ── 沒接線的 retimer lane / TH6 port 關 TX(V1.2.5,TTL 未接)──
|
||||
# ── FDR 統計(V1.2.6,A/B/C 已接,只在 SWB_UNIT0=SWB_UNIT1=1)──
|
||||
~/Blanton_Script/blanton_fdr.sh start # fdrstat STArt bin_group=both Interval=30,unit 0 → 1
|
||||
~/Blanton_Script/blanton_fdr.sh clear # fdrstat clear
|
||||
~/Blanton_Script/blanton_fdr.sh rdcnt # fdrstat Counters(Interval 結算後才讀,A 用 sleep 40)
|
||||
~/Blanton_Script/blanton_fdr.sh stop # fdrstat STOp ⚠️ 關鍵字是類推的,未上機驗證
|
||||
# -u 0|1 單邊;-i <sec> 改 Interval;-n dry-run。ports 預設 '1-259,270-565'(FDR_PORTS 可改)
|
||||
|
||||
# ── 沒接線的 retimer lane / TH6 port 關 TX(V1.2.5;V1.2.6 起 Script A 會 off,沒人 on 回來)──
|
||||
./Blanton_Script/unused_lanes.sh status # 兩 unit 全部列出 rx_lock / tx_off
|
||||
./Blanton_Script/unused_lanes.sh off [--asic 0] [--th6] # 預設 TX squelch;--th6 連 retimer 後面的 TH6 port 一起關
|
||||
./Blanton_Script/unused_lanes.sh on
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
# v1.2.6 — FDR statistics around the traffic run, and unused lanes turned off before the baseline
|
||||
|
||||
## ✨ New features
|
||||
|
||||
**`blanton_fdr.sh` — FDR statistics through `phydiag fdrstat`**
|
||||
* Four sub-commands, each run on unit 0 then unit 1, over ports `'1-259,270-565'`:
|
||||
`start` (`fdrstat STArt bin_group=both Interval=30`), `clear` (`fdrstat clear`), `rdcnt` (`fdrstat Counters`), `stop` (`fdrstat STOp`).
|
||||
* Output is printed as is, under a `### [time] unit N: ...` header — no parsing, no PASS/FAIL.
|
||||
* `-u 0` / `-u 1` for one switch unit, `-i <sec>` for the interval, `-n` for a dry run. `FDR_PORTS` overrides the port list.
|
||||
|
||||
**FDR runs alongside the traffic test in Script A, B and C**
|
||||
* **Script A** wraps its traffic baseline: `fdr start` after `init`, `fdr clear` after `clear`, `fdr rdcnt` after the run, `fdr stop` after the traffic stop. The traffic run is now **40 s instead of 15 s**, so the counters are read after the first 30 s interval has been published — the same rule as `prbsstat Ber`.
|
||||
* **Script B** starts and clears FDR with the traffic setup, before the soak loop — the counters run for the whole soak.
|
||||
* **Script C** reads them (`rdcnt`) before stopping the traffic and stops FDR after it — the closing read of the counters Script B started.
|
||||
|
||||
**Script A turns off the unused lanes before the BER baseline**
|
||||
* `unused_lanes.sh off` — TX squelch on the unused retimer lanes and TSC31 (`cd112-cd115`) disabled on the TH6, on both switch boards.
|
||||
|
||||
## 📦 Downloads
|
||||
|
||||
| File | Contents |
|
||||
|---|---|
|
||||
| `Script_ABC_Blanton_V1.2.6.zip` | The full Tera Term working directory, including `Blanton_Script/` to copy onto the DUT |
|
||||
|
||||
```bash
|
||||
chmod +x ~/Blanton_Script/*.sh
|
||||
grep -rlU $'\r' ~/Blanton_Script # expect no output
|
||||
```
|
||||
|
||||
## ⚠️ Before you run
|
||||
|
||||
* **`chmod +x` after deploying.** `blanton_fdr.sh`, `unused_lanes.sh` and `retimer_lanes.sh` are all called by path; `unused_lanes.sh` also refuses to start if `retimer_lanes.sh` is not executable.
|
||||
* **`blanton_fdr.sh stop` sends `fdrstat STOp` — that keyword is inferred from `prbsstat STOp` and has not been checked on the bench.** `bcmcmd` exits 0 even when the BCM shell rejects a command, so if it is wrong, FDR keeps running and only the log shows it. Check the first run.
|
||||
* **FDR only runs when both switch units are enabled** (`SWB_UNIT0 = SWB_UNIT1 = 1`). The single-unit branches have no FDR, and Script A's single-unit traffic run is still 15 s.
|
||||
* **Nothing turns the unused lanes back on.** Script C has no `unused_lanes.sh on`; run it by hand when the DUT is needed in its normal state. Whether a reboot clears it has not been checked.
|
||||
* **`unused_lanes.sh off` is not gated by `SWB_UNIT0` / `SWB_UNIT1`** — it always acts on both boards.
|
||||
* **`blanton_ber.sh` (Script A / C) still uses `p=3` and `sleep 30`**; see v1.2.5.
|
||||
* **Script 4 has no teardown**: finish it with `blanton_tr518.sh stop` **and** `systemctl stop mlucas-amm`.
|
||||
* **`FAN_SPEED` is 100.**
|
||||
|
||||
## 🔗 Links
|
||||
|
||||
* [ARCHITECTURE.md](https://etgit.et-wen.com/etwen/Blanton_TTL_Script/src/branch/main/ARCHITECTURE.md) — test flow, data models, constraints
|
||||
* [CLAUDE.md](https://etgit.et-wen.com/etwen/Blanton_TTL_Script/src/branch/main/CLAUDE.md) — commands and the bench gotchas
|
||||
|
||||
**Full changelog:** [V1.2.5...V1.2.6](https://etgit.et-wen.com/etwen/Blanton_TTL_Script/compare/V1.2.5...V1.2.6)
|
||||
@@ -1,6 +1,6 @@
|
||||
; =============================================================================
|
||||
; Script A for Blanton
|
||||
; Version : V1.2.5
|
||||
; Version : V1.2.6
|
||||
; Date : 2026-10-21
|
||||
; Author : ETWen
|
||||
; =============================================================================
|
||||
@@ -848,6 +848,35 @@
|
||||
; same as Script 5
|
||||
; tools/BER_Test.txt p=3 -> p=p31; add a unit 1 block, a both-units block and
|
||||
; port en=0 / en=1 for all cabled ports on each unit
|
||||
; V1.2.6 2026-10-21 Blanton_Script/blanton_fdr.sh Created v1.0.0 - FDR statistics through phydiag fdrstat
|
||||
; start / clear / rdcnt / stop on ports '1-259,270-565':
|
||||
; fdrstat STArt bin_group=both Interval=30 / clear / Counters /
|
||||
; STOp. bcmcmd output printed as is, no parsing or PASS/FAIL
|
||||
; -u 0 / -u 1 (default both), -i <sec> Interval, -n dry run
|
||||
; !! 'stop' sends 'fdrstat STOp', by analogy with prbsstat STOp
|
||||
; - NOT verified on the bench. If the BCM shell rejects it,
|
||||
; FDR keeps running and only the log shows it (bcmcmd exits 0)
|
||||
; !! called by path - chmod +x ~/Blanton_Script/*.sh
|
||||
; ScriptA Turn off unused lanes before the BER baseline
|
||||
; unused_lanes.sh off - both units, TX squelch on the unused
|
||||
; retimer lanes and TSC31 (cd112-cd115) disabled on the TH6
|
||||
; !! nothing turns them back on: no 'unused_lanes.sh on' in
|
||||
; Script C. They stay off until 'unused_lanes.sh on' is run
|
||||
; by hand (whether a reboot clears them is not checked)
|
||||
; !! not gated by SWB_UNIT0 / SWB_UNIT1 - always both units
|
||||
; !! needs the exec bit on unused_lanes.sh AND retimer_lanes.sh
|
||||
; ScriptA FDR around the traffic baseline (SWB_UNIT0 = SWB_UNIT1 = 1 only)
|
||||
; init -> fdr start -> clear -> fdr clear -> ... -> start ->
|
||||
; sleep 40 -> fdr rdcnt -> traffic stop -> fdr stop -> report
|
||||
; Traffic sleep 15 -> 40 so rdcnt reads after the first 30 s
|
||||
; Interval is published (same rule as prbsstat Ber)
|
||||
; !! the single-unit branches have no FDR and still sleep 15
|
||||
; ScriptB fdr start + fdr clear with the traffic setup, before the loop
|
||||
; (SWB_UNIT0 = SWB_UNIT1 = 1 only) - the counters run for the
|
||||
; whole soak
|
||||
; ScriptC fdr rdcnt before traffic stop, fdr stop after it
|
||||
; (SWB_UNIT0 = SWB_UNIT1 = 1 only) - the closing read of the
|
||||
; counters Script B started, bracketing the soak
|
||||
; =============================================================================
|
||||
include "config.ttl"
|
||||
|
||||
@@ -1061,6 +1090,10 @@ sendln "config feature state lldp disabled"
|
||||
wait prompt_sonic_root
|
||||
sendln "config save -y"
|
||||
|
||||
; ========== Turn off unused lanes ==========
|
||||
wait prompt_sonic_root
|
||||
sendln "~/Blanton_Script/unused_lanes.sh off"
|
||||
|
||||
; ========== BER ==========
|
||||
; Baseline sweep, taken BEFORE the traffic run - ScriptC takes the closing
|
||||
; one after its traffic report, so the pair brackets the soak.
|
||||
@@ -1117,18 +1150,26 @@ if SWB_UNIT0 = 1 && SWB_UNIT1 = 1 then
|
||||
wait prompt_sonic_root
|
||||
sendln "blanton_traffic_linespeed init"
|
||||
wait prompt_sonic_root
|
||||
sendln "~/Blanton_Script/blanton_fdr.sh start"
|
||||
wait prompt_sonic_root
|
||||
sendln "blanton_traffic_linespeed clear"
|
||||
wait prompt_sonic_root
|
||||
sendln "~/Blanton_Script/blanton_fdr.sh clear"
|
||||
wait prompt_sonic_root
|
||||
sendln "sleep 5"
|
||||
wait prompt_sonic_root
|
||||
sendln "blanton_traffic_linespeed show"
|
||||
wait prompt_sonic_root
|
||||
sendln "blanton_traffic_linespeed start"
|
||||
wait prompt_sonic_root
|
||||
sendln "sleep 15"
|
||||
sendln "sleep 40"
|
||||
wait prompt_sonic_root
|
||||
sendln "~/Blanton_Script/blanton_fdr.sh rdcnt"
|
||||
wait prompt_sonic_root
|
||||
sendln "blanton_traffic_linespeed stop"
|
||||
wait prompt_sonic_root
|
||||
sendln "~/Blanton_Script/blanton_fdr.sh stop"
|
||||
wait prompt_sonic_root
|
||||
sendln "blanton_traffic_linespeed report"
|
||||
elseif SWB_UNIT0 = 1 && SWB_UNIT1 = 0 then
|
||||
wait prompt_sonic_root
|
||||
|
||||
@@ -138,8 +138,12 @@ if SWB_UNIT0 = 1 && SWB_UNIT1 = 1 then
|
||||
wait prompt_sonic_root
|
||||
sendln "blanton_traffic_linespeed init"
|
||||
wait prompt_sonic_root
|
||||
sendln "~/Blanton_Script/blanton_fdr.sh start"
|
||||
wait prompt_sonic_root
|
||||
sendln "blanton_traffic_linespeed clear"
|
||||
wait prompt_sonic_root
|
||||
sendln "~/Blanton_Script/blanton_fdr.sh clear"
|
||||
wait prompt_sonic_root
|
||||
sendln "sleep 5"
|
||||
wait prompt_sonic_root
|
||||
sendln "blanton_traffic_linespeed show"
|
||||
|
||||
@@ -85,9 +85,13 @@ sendln "show interfaces status Ethernet513,Ethernet514"
|
||||
|
||||
; ========== CHECK Traffic counters ==========
|
||||
if SWB_UNIT0 = 1 && SWB_UNIT1 = 1 then
|
||||
wait prompt_sonic_root
|
||||
sendln "~/Blanton_Script/blanton_fdr.sh rdcnt"
|
||||
wait prompt_sonic_root
|
||||
sendln "blanton_traffic_linespeed stop"
|
||||
wait prompt_sonic_root
|
||||
sendln "~/Blanton_Script/blanton_fdr.sh stop"
|
||||
wait prompt_sonic_root
|
||||
sendln "blanton_traffic_linespeed report"
|
||||
elseif SWB_UNIT0 = 1 && SWB_UNIT1 = 0 then
|
||||
wait prompt_sonic_root
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
#!/usr/bin/env bash
|
||||
# =============================================================================
|
||||
# blanton_fdr.sh -- SerDes FDR statistics (phydiag fdrstat), raw output
|
||||
# =============================================================================
|
||||
# Version History:
|
||||
# V1.0.0 2026-10-21 First version. start / clear / rdcnt / stop over
|
||||
# 'phydiag <ports> fdrstat ...' through bcmcmd, the same
|
||||
# way blanton_ber_debug.sh drives prbsstat. Every bcmcmd
|
||||
# output is printed as is -- no parsing, no PASS/FAIL.
|
||||
#
|
||||
# Sub-commands (each one runs on unit 0, then unit 1):
|
||||
# start phydiag '<ports>' fdrstat STArt bin_group=both Interval=30
|
||||
# clear phydiag '<ports>' fdrstat clear
|
||||
# rdcnt phydiag '<ports>' fdrstat Counters
|
||||
# stop phydiag '<ports>' fdrstat STOp
|
||||
#
|
||||
# ⚠️ 'stop' sends 'fdrstat STOp', by analogy with 'prbsstat STOp'. It has
|
||||
# not been checked on the bench -- if the BCM shell rejects it, look at
|
||||
# 'phydiag help' (or 'fdrstat' with no argument) for the right keyword.
|
||||
# ⚠️ bcmcmd exits 0 even when the BCM shell refuses a command, so this
|
||||
# script cannot tell success from failure. Read the output.
|
||||
#
|
||||
# Usage:
|
||||
# ./blanton_fdr.sh <start|clear|rdcnt|stop> [-u 0|1] [-i <sec>] [-n]
|
||||
# -u 0 | -u 1 one switch unit only (default: both, 0 then 1)
|
||||
# -i <sec> start: fdrstat Interval (default 30)
|
||||
# -n dry run: print the bcmcmd lines, do not run them
|
||||
#
|
||||
# Env overrides:
|
||||
# BCMCMD_CMD=bcmcmd FDR_PORTS=1-259,270-565 FDR_INTERVAL=30
|
||||
# FDR_BIN_GROUP=both
|
||||
# =============================================================================
|
||||
|
||||
BCMCMD_CMD="${BCMCMD_CMD:-bcmcmd}"
|
||||
FDR_UNITS="0 1"
|
||||
FDR_PORTS="${FDR_PORTS:-1-259,270-565}"
|
||||
FDR_INTERVAL="${FDR_INTERVAL:-30}"
|
||||
FDR_BIN_GROUP="${FDR_BIN_GROUP:-both}"
|
||||
FDR_DRY_RUN=0
|
||||
|
||||
usage() {
|
||||
sed -n '/^# Usage:/,/^# =====/p' "$0" | sed '$d; s/^# \{0,1\}//'
|
||||
}
|
||||
|
||||
[ $# -ge 1 ] || { usage >&2; exit 2; }
|
||||
ACT=$1; shift
|
||||
case "$ACT" in
|
||||
start|clear|rdcnt|stop) ;;
|
||||
-h|--help|help) usage; exit 0 ;;
|
||||
*) echo "[ERR ] unknown sub-command '$ACT'" >&2; usage >&2; exit 2 ;;
|
||||
esac
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
-u|--unit)
|
||||
case "$2" in
|
||||
0|1) FDR_UNITS="$2" ;;
|
||||
*) echo "[ERR ] invalid unit '$2' (use 0 or 1)" >&2; exit 2 ;;
|
||||
esac
|
||||
shift 2 ;;
|
||||
-i|--interval)
|
||||
case "$2" in
|
||||
''|*[!0-9]*) echo "[ERR ] invalid interval '$2'" >&2; exit 2 ;;
|
||||
*) FDR_INTERVAL="$2" ;;
|
||||
esac
|
||||
shift 2 ;;
|
||||
-n|--dry-run) FDR_DRY_RUN=1; shift ;;
|
||||
-h|--help) usage; exit 0 ;;
|
||||
*) echo "[ERR ] unknown option '$1'" >&2; usage >&2; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# bcmcmd reads stdin -- keep it on /dev/null (see blanton_traffic_linespeed.sh V0.3.1)
|
||||
_bcm() {
|
||||
local unit="$1"; shift
|
||||
local cmd="dsh -c \"phydiag '${FDR_PORTS}' fdrstat $*\""
|
||||
echo
|
||||
echo "### [$(date '+%F %T')] unit $unit: phydiag '${FDR_PORTS}' fdrstat $*"
|
||||
if [ "$FDR_DRY_RUN" = "1" ]; then
|
||||
echo "[DRY ] $BCMCMD_CMD -n $unit -c ' ${cmd} '"
|
||||
return 0
|
||||
fi
|
||||
"$BCMCMD_CMD" -n "$unit" -c " ${cmd} " </dev/null 2>&1
|
||||
}
|
||||
|
||||
case "$ACT" in
|
||||
start) SUB="STArt bin_group=${FDR_BIN_GROUP} Interval=${FDR_INTERVAL}" ;;
|
||||
clear) SUB="clear" ;;
|
||||
rdcnt) SUB="Counters" ;;
|
||||
stop) SUB="STOp" ;;
|
||||
esac
|
||||
|
||||
for u in $FDR_UNITS; do
|
||||
_bcm "$u" "$SUB"
|
||||
done
|
||||
|
||||
echo
|
||||
echo "### [$(date '+%F %T')] FDR_${ACT^^}_DONE units: $FDR_UNITS"
|
||||
Reference in New Issue
Block a user