Fix: 修正H3C解析器输出索引

- outputs[4] 是 display lldp neighbor-information
- outputs[5] 是 display arp
- 修正后邻居和ARP表解析正确
Цей коміт міститься в:
Your Name
2026-04-26 02:05:06 +08:00
джерело 21326b6731
коміт 0d92ff8ef0
+3 -3
Переглянути файл
@@ -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))