From 0d92ff8ef0ff6bab4e8ea8c52702c25a7bad0cae Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 26 Apr 2026 02:05:06 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=20=E4=BF=AE=E6=AD=A3H3C=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E5=99=A8=E8=BE=93=E5=87=BA=E7=B4=A2=E5=BC=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - outputs[4] 是 display lldp neighbor-information - outputs[5] 是 display arp - 修正后邻居和ARP表解析正确 --- internal/device/h3c.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/device/h3c.go b/internal/device/h3c.go index 785794d..83d8621 100644 --- a/internal/device/h3c.go +++ b/internal/device/h3c.go @@ -73,8 +73,8 @@ func (p *H3CParser) Parse(device *models.Device, outputs []string) error { // 解析ARP表用于MAC到IP映射(允许失败) arpTable := make(map[string]string) - if outputs[4] != "" { - arpTable = p.parseARPTable(outputs[4]) + if outputs[5] != "" { + arpTable = p.parseARPTable(outputs[5]) if len(arpTable) == 0 { fmt.Printf("Warning: ARP table is empty for device %s\n", device.IP) } @@ -83,7 +83,7 @@ func (p *H3CParser) Parse(device *models.Device, outputs []string) error { } // 解析LLDP邻居,使用ARP表进行MAC到IP的映射 - device.Neighbors = p.parseNeighbors(outputs[3], arpTable) + device.Neighbors = p.parseNeighbors(outputs[4], arpTable) fmt.Printf("Device %s: %d interfaces, %d neighbors, %d ARP entries\n", device.IP, len(device.Interfaces), len(device.Neighbors), len(arpTable))