Fix: 修正H3C ARP表解析器适配真实输出格式

- 修正标题行匹配: Type: (带冒号)
- 跳过IP address标题行
- 适配真实ARP表格式: IP MAC VLAN Interface Aging Type
- 正确解析MAC到IP映射
This commit is contained in:
Your Name
2026-04-26 00:50:27 +08:00
parent 4abfd0716e
commit 30b05709eb
+5 -4
View File
@@ -199,13 +199,14 @@ func (p *H3CParser) parseARPTable(output string) map[string]string {
for _, line := range lines {
// 跳过空行和标题行
if strings.TrimSpace(line) == "" ||
strings.Contains(line, "Type") ||
strings.Contains(line, "------") {
strings.Contains(line, "Type:") ||
strings.Contains(line, "------") ||
strings.Contains(line, "IP address") {
continue
}
// ARP表格式: IP Address MAC Address Interface/Vlan
// 例: 172.16.12.1 a4bb-6de2-62cd GE1/0/1
// ARP表格式: IP address MAC address VLAN/VSI name Interface Aging Type
// 例: 172.16.8.10 743a-2047-38e0 8 GE1/0/47 1163 D
fields := strings.Fields(line)
if len(fields) >= 2 {
ip := fields[0]