Problem / 问题
Manual serial-number reconciliation of AOC cables, optics, and switches is error-prone. A daily sheet and three registers are compared by hand with show inventory, ipmitool fru print, and lshw -json. Missing serials, unknown serials, duplicates, a host or port that moved, and a part number that does not match are easy to skip.
手工核对 AOC、光模块和交换机的序列号很容易出错。巡检表和三本台账要靠人去对 show inventory、ipmitool fru print 和 lshw -json。漏登、多出来的序列号、重复序列号、位置变化和型号不一致,都容易被看漏。
Approach / 做法
A bilingual checklist covers the walk-through. CSV templates hold the AOC, optics, and switch register. A Python 3 checker parses the three dump formats, strips and uppercases each serial, and writes MISSING, UNKNOWN, DUPLICATE, MISMATCH_LOCATION, and MISMATCH_PN. A second tool diffs two register snapshots. The sample below is synthetic: 40 register rows and seven findings on purpose.
中英巡检表覆盖现场走动检查。CSV 模板分别登记 AOC、光模块和交换机。Python 3 脚本解析三种采集,序列号去空白并转大写,然后写出五类差异。另一支脚本比较两份台账快照。下面的示例是合成数据:40 行台账,故意留下 7 条发现。
Demo output / 演示输出
Stdout of scripts/sn_mapping_check.py on samples/register and samples/dumps. Exit code 2.
scripts/sn_mapping_check.py 对 samples/register 和 samples/dumps 的标准输出。退出码 2。
== SN mapping check == register_rows: 40 unique_register_sn: 39 dump_records: 39 unique_dump_sn: 39 findings: 7 exit: 2 finding count ----------------- ----- MISSING 2 UNKNOWN 2 DUPLICATE 1 MISMATCH_LOCATION 1 MISMATCH_PN 1 type sn asset_ids detail ----------------- -------------- ------------------- --------------------------------------------------------------------------------------------------------------------------------- MISSING SYNMISSAOC0002 AOC-MISS in register, not in dumps; asset_ids=AOC-MISS; host=dc1-rack-a01-srv01 port=NIC4 pn=SMP-AOC-10G-5M MISSING SYNMISSOPT0001 OPT-MISS in register, not in dumps; asset_ids=OPT-MISS; host=dc1-rack-a01-sw01 port=Ethernet1/48 pn=SMP-SFP-10G-LR UNKNOWN SYNUNKFRU9002 seen in dumps, not in register; host=dc1-rack-a01-srv01 pn=SMP-PSU-800 source=dumps/srv01_ipmitool_fru.txt UNKNOWN SYNUNKOPT9001 seen in dumps, not in register; host=dc1-rack-a01-sw01 port=Ethernet1/40 pn=SMP-SFP28-25G-SR source=dumps/sw01_show_inventory.txt DUPLICATE SYNDUPOPT0042 OPT-0042A|OPT-0042B sn repeated in register; asset_ids=OPT-0042A|OPT-0042B MISMATCH_LOCATION SYNLOCOPT0100 OPT-0100 host/port differ; register dc1-rack-a01-sw01 Ethernet1/20; dump dc1-rack-a01-sw01 Ethernet1/28 MISMATCH_PN SYNPNOPT0200 OPT-0200 pn/model differ; register SMP-QSFP28-100G-SR4; dump SMP-QSFP28-100G-CWDM4 wrote out/sn_mapping/report.md wrote out/sn_mapping/report.csv wrote out/sn_mapping/report.json
Deliverables / 交付物
- Bilingual daily inspection checklist, Markdown and CSV. 中英每日巡检表。
- AOC, optics (SFP through QSFP-DD), and switch register templates, plus
asset_register.xlsx. AOC、光模块、交换机台账模板和工作簿。 - Inspection NG summary by area and severity. 按区域和严重级别汇总 NG。
- Dump parsers and the SN mapping check. 采集解析和序列号比对。
- Snapshot reconcile: added, removed, moved, status changed. 快照对账:新增、删除、移动、状态变化。
- Synthetic 40-row sample,
demo.py, unit tests, and an acceptance script. 40 行合成示例、演示、单元测试和验收脚本。
The free lite repo keeps the checklist and the SN checker. 免费精简仓库保留巡检表和序列号比对。
Delivery time / 交付时间
Instant download. Setup about 10 minutes. Adapting the templates to your own register about 30 minutes.
下载即得。安装并跑通大约 10 分钟。把模板改成自己的台账大约 30 分钟。
Pay what you want, $1 or more. Suggested price is $5. 愿付多少付多少,1 美元起,建议 5 美元。
Links / 链接
GitHub: dc-asset-kit-lite Gumroad: full kit (from $1)
Full n8n DevOps pack, $9 / 完整 n8n DevOps 包 9 美元: https://caoyadong.gumroad.com/l/yvmcqj